LCOV - code coverage report
Current view: top level - src/objects - bigint-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 14 14 100.0 %
Date: 2017-10-20 Functions: 0 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             : #ifndef V8_OBJECTS_BIGINT_INL_H_
       6             : #define V8_OBJECTS_BIGINT_INL_H_
       7             : 
       8             : #include "src/objects/bigint.h"
       9             : 
      10             : #include "src/objects.h"
      11             : 
      12             : // Has to be the last include (doesn't have include guards):
      13             : #include "src/objects/object-macros.h"
      14             : 
      15             : namespace v8 {
      16             : namespace internal {
      17             : 
      18             : int BigInt::length() const {
      19       23879 :   intptr_t bitfield = READ_INTPTR_FIELD(this, kBitfieldOffset);
      20             :   return LengthBits::decode(static_cast<uint32_t>(bitfield));
      21             : }
      22             : void BigInt::set_length(int new_length) {
      23        2687 :   intptr_t bitfield = READ_INTPTR_FIELD(this, kBitfieldOffset);
      24        5374 :   bitfield = LengthBits::update(static_cast<uint32_t>(bitfield), new_length);
      25        2687 :   WRITE_INTPTR_FIELD(this, kBitfieldOffset, bitfield);
      26             : }
      27             : 
      28             : bool BigInt::sign() const {
      29        2475 :   intptr_t bitfield = READ_INTPTR_FIELD(this, kBitfieldOffset);
      30        4653 :   return SignBits::decode(static_cast<uint32_t>(bitfield));
      31             : }
      32             : void BigInt::set_sign(bool new_sign) {
      33        1387 :   intptr_t bitfield = READ_INTPTR_FIELD(this, kBitfieldOffset);
      34        5353 :   bitfield = SignBits::update(static_cast<uint32_t>(bitfield), new_sign);
      35        3966 :   WRITE_INTPTR_FIELD(this, kBitfieldOffset, bitfield);
      36             : }
      37             : 
      38             : BigInt::digit_t BigInt::digit(int n) const {
      39             :   SLOW_DCHECK(0 <= n && n < length());
      40       58963 :   const byte* address = FIELD_ADDR_CONST(this, kDigitsOffset + n * kDigitSize);
      41       60682 :   return *reinterpret_cast<digit_t*>(reinterpret_cast<intptr_t>(address));
      42             : }
      43             : void BigInt::set_digit(int n, digit_t value) {
      44             :   SLOW_DCHECK(0 <= n && n < length());
      45       52656 :   byte* address = FIELD_ADDR(this, kDigitsOffset + n * kDigitSize);
      46       53516 :   (*reinterpret_cast<digit_t*>(reinterpret_cast<intptr_t>(address))) = value;
      47             : }
      48             : 
      49     3883364 : TYPE_CHECKER(BigInt, BIGINT_TYPE)
      50             : 
      51             : }  // namespace internal
      52             : }  // namespace v8
      53             : 
      54             : #include "src/objects/object-macros-undef.h"
      55             : 
      56             : #endif  // V8_OBJECTS_BIGINT_INL_H_

Generated by: LCOV version 1.10