LCOV - code coverage report
Current view: top level - src/trap-handler - handler-shared.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 7 9 77.8 %
Date: 2017-04-26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2017 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : // PLEASE READ BEFORE CHANGING THIS FILE!
       6             : //
       7             : // This file contains code that is used both inside and outside the out of
       8             : // bounds signal handler. Because this code runs in a signal handler context,
       9             : // use extra care when modifying this file. Here are some rules to follow.
      10             : //
      11             : // 1. Do not introduce any new external dependencies. This file needs
      12             : //    to be self contained so it is easy to audit everything that a
      13             : //    signal handler might do.
      14             : //
      15             : // 2. Any changes must be reviewed by someone from the crash reporting
      16             : //    or security team. See OWNERS for suggested reviewers.
      17             : //
      18             : // For more information, see https://goo.gl/yMeyUY.
      19             : 
      20             : #include "src/trap-handler/trap-handler-internal.h"
      21             : 
      22             : namespace v8 {
      23             : namespace internal {
      24             : namespace trap_handler {
      25             : 
      26             : THREAD_LOCAL bool g_thread_in_wasm_code = false;
      27             : 
      28             : size_t gNumCodeObjects = 0;
      29             : CodeProtectionInfoListEntry* gCodeObjects = nullptr;
      30             : 
      31             : std::atomic_flag MetadataLock::spinlock_ = ATOMIC_FLAG_INIT;
      32             : 
      33        2756 : MetadataLock::MetadataLock() {
      34        2756 :   if (g_thread_in_wasm_code) {
      35           0 :     abort();
      36             :   }
      37             : 
      38        2756 :   while (spinlock_.test_and_set(std::memory_order::memory_order_acquire)) {
      39             :   }
      40        2756 : }
      41             : 
      42        2756 : MetadataLock::~MetadataLock() {
      43        2756 :   if (g_thread_in_wasm_code) {
      44           0 :     abort();
      45             :   }
      46             : 
      47             :   spinlock_.clear(std::memory_order::memory_order_release);
      48        2756 : }
      49             : 
      50             : }  // namespace trap_handler
      51             : }  // namespace internal
      52             : }  // namespace v8

Generated by: LCOV version 1.10