5 #ifndef V8_COMPILER_ALLOCATION_BUILDER_INL_H_ 6 #define V8_COMPILER_ALLOCATION_BUILDER_INL_H_ 8 #include "src/compiler/allocation-builder.h" 10 #include "src/compiler/access-builder.h" 11 #include "src/objects/map-inl.h" 17 void AllocationBuilder::AllocateContext(
int variadic_part_length,
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 Allocate(size, NOT_TENURED, Type::OtherInternal());
24 Store(AccessBuilder::ForMap(), map);
25 STATIC_ASSERT(static_cast<int>(Context::kLengthOffset) ==
26 static_cast<int>(FixedArray::kLengthOffset));
27 Store(AccessBuilder::ForFixedArrayLength(),
28 jsgraph()->Constant(variadic_part_length));
32 void AllocationBuilder::AllocateArray(
int length, Handle<Map> map,
33 PretenureFlag pretenure) {
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 : FixedDoubleArray::SizeFor(length);
39 Allocate(size, pretenure, Type::OtherInternal());
40 Store(AccessBuilder::ForMap(), map);
41 Store(AccessBuilder::ForFixedArrayLength(), jsgraph()->Constant(length));
48 #endif // V8_COMPILER_ALLOCATION_BUILDER_INL_H_