LCOV - code coverage report
Current view: top level - src/compiler - allocation-builder-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 12 12 100.0 %
Date: 2019-04-17 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2018 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_COMPILER_ALLOCATION_BUILDER_INL_H_
       6             : #define V8_COMPILER_ALLOCATION_BUILDER_INL_H_
       7             : 
       8             : #include "src/compiler/allocation-builder.h"
       9             : 
      10             : #include "src/compiler/access-builder.h"
      11             : #include "src/objects/map-inl.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : namespace compiler {
      16             : 
      17       49741 : void AllocationBuilder::AllocateContext(int variadic_part_length,
      18             :                                         Handle<Map> map) {
      19             :   DCHECK(
      20             :       IsInRange(map->instance_type(), FIRST_CONTEXT_TYPE, LAST_CONTEXT_TYPE));
      21             :   DCHECK_NE(NATIVE_CONTEXT_TYPE, map->instance_type());
      22             :   int size = Context::SizeFor(variadic_part_length);
      23       49741 :   Allocate(size, AllocationType::kYoung, Type::OtherInternal());
      24       49741 :   Store(AccessBuilder::ForMap(), map);
      25             :   STATIC_ASSERT(static_cast<int>(Context::kLengthOffset) ==
      26             :                 static_cast<int>(FixedArray::kLengthOffset));
      27       99482 :   Store(AccessBuilder::ForFixedArrayLength(),
      28       49741 :         jsgraph()->Constant(variadic_part_length));
      29       49741 : }
      30             : 
      31             : // Compound allocation of a FixedArray.
      32        9145 : void AllocationBuilder::AllocateArray(int length, Handle<Map> map,
      33             :                                       AllocationType allocation) {
      34             :   DCHECK(map->instance_type() == FIXED_ARRAY_TYPE ||
      35             :          map->instance_type() == FIXED_DOUBLE_ARRAY_TYPE);
      36             :   int size = (map->instance_type() == FIXED_ARRAY_TYPE)
      37             :                  ? FixedArray::SizeFor(length)
      38        9145 :                  : FixedDoubleArray::SizeFor(length);
      39        9145 :   Allocate(size, allocation, Type::OtherInternal());
      40        9145 :   Store(AccessBuilder::ForMap(), map);
      41        9145 :   Store(AccessBuilder::ForFixedArrayLength(), jsgraph()->Constant(length));
      42        9145 : }
      43             : 
      44             : }  // namespace compiler
      45             : }  // namespace internal
      46             : }  // namespace v8
      47             : 
      48             : #endif  // V8_COMPILER_ALLOCATION_BUILDER_INL_H_

Generated by: LCOV version 1.10