LCOV - code coverage report
Current view: top level - src/runtime - runtime-futex.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 15 15 100.0 %
Date: 2017-04-26 Functions: 2 4 50.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.h"
       8             : #include "src/base/platform/time.h"
       9             : #include "src/conversions-inl.h"
      10             : #include "src/futex-emulation.h"
      11             : #include "src/globals.h"
      12             : 
      13             : // Implement Futex API for SharedArrayBuffers as defined in the
      14             : // SharedArrayBuffer draft spec, found here:
      15             : // https://github.com/tc39/ecmascript_sharedmem
      16             : 
      17             : namespace v8 {
      18             : namespace internal {
      19             : 
      20             : 
      21    37383980 : RUNTIME_FUNCTION(Runtime_AtomicsNumWaitersForTesting) {
      22    18691990 :   HandleScope scope(isolate);
      23             :   DCHECK_EQ(2, args.length());
      24    37383980 :   CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
      25    56075970 :   CONVERT_SIZE_ARG_CHECKED(index, 1);
      26    37383980 :   CHECK(sta->GetBuffer()->is_shared());
      27    18691990 :   CHECK_LT(index, NumberToSize(sta->length()));
      28    18691990 :   CHECK_EQ(sta->type(), kExternalInt32Array);
      29             : 
      30    18691990 :   Handle<JSArrayBuffer> array_buffer = sta->GetBuffer();
      31    37383980 :   size_t addr = (index << 2) + NumberToSize(sta->byte_offset());
      32             : 
      33    18691990 :   return FutexEmulation::NumWaitersForTesting(isolate, array_buffer, addr);
      34             : }
      35             : 
      36          56 : RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) {
      37          28 :   HandleScope scope(isolate);
      38             :   DCHECK_EQ(1, args.length());
      39          56 :   CONVERT_BOOLEAN_ARG_CHECKED(set, 0);
      40             : 
      41          28 :   isolate->set_allow_atomics_wait(set);
      42          28 :   return isolate->heap()->undefined_value();
      43             : }
      44             : }  // namespace internal
      45             : }  // namespace v8

Generated by: LCOV version 1.10