LCOV - code coverage report
Current view: top level - src/runtime - runtime-futex.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 13 13 100.0 %
Date: 2019-04-19 Functions: 3 5 60.0 %

          Line data    Source code
       1             : // Copyright 2015 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             : #include "src/runtime/runtime-utils.h"
       6             : 
       7             : #include "src/arguments-inl.h"
       8             : #include "src/base/platform/time.h"
       9             : #include "src/conversions-inl.h"
      10             : #include "src/counters.h"
      11             : #include "src/futex-emulation.h"
      12             : #include "src/globals.h"
      13             : #include "src/objects/heap-object-inl.h"
      14             : #include "src/objects/js-array-buffer-inl.h"
      15             : 
      16             : // Implement Futex API for SharedArrayBuffers as defined in the
      17             : // SharedArrayBuffer draft spec, found here:
      18             : // https://github.com/tc39/ecmascript_sharedmem
      19             : 
      20             : namespace v8 {
      21             : namespace internal {
      22             : 
      23    71736798 : RUNTIME_FUNCTION(Runtime_AtomicsNumWaitersForTesting) {
      24             :   HandleScope scope(isolate);
      25             :   DCHECK_EQ(2, args.length());
      26    35868399 :   CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
      27    71736798 :   CONVERT_SIZE_ARG_CHECKED(index, 1);
      28    35868399 :   CHECK(!sta->WasDetached());
      29    71736798 :   CHECK(sta->GetBuffer()->is_shared());
      30    35868399 :   CHECK_LT(index, sta->length());
      31    35868399 :   CHECK_EQ(sta->type(), kExternalInt32Array);
      32             : 
      33    35868399 :   Handle<JSArrayBuffer> array_buffer = sta->GetBuffer();
      34    71736798 :   size_t addr = (index << 2) + sta->byte_offset();
      35             : 
      36    35868399 :   return FutexEmulation::NumWaitersForTesting(array_buffer, addr);
      37             : }
      38             : 
      39          36 : RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) {
      40             :   HandleScope scope(isolate);
      41             :   DCHECK_EQ(1, args.length());
      42          18 :   CONVERT_BOOLEAN_ARG_CHECKED(set, 0);
      43             : 
      44             :   isolate->set_allow_atomics_wait(set);
      45             :   return ReadOnlyRoots(isolate).undefined_value();
      46             : }
      47             : 
      48             : }  // namespace internal
      49      122036 : }  // namespace v8

Generated by: LCOV version 1.10