Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: src/hydrogen.cc

Issue 21356002: Improve instruction creating/adding shorthand in HGraphBuilder (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 0875f29112247f6288472a2c9430fbd4fc1c82ab..282ff61ef5f5d51c355b155356353acd0f83cac2 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -609,7 +609,7 @@ void HGraph::Verify(bool do_full_verify) const {
HConstant* HGraph::GetConstant(SetOncePointer<HConstant>* pointer,
int32_t value) {
if (!pointer->is_set()) {
- HConstant* constant = new(zone()) HConstant(value);
+ HConstant* constant = HConstant::New(zone(), NULL, value);
constant->InsertAfter(GetConstantUndefined());
pointer->set(constant);
}
@@ -835,9 +835,9 @@ void HGraphBuilder::IfBuilder::Deopt() {
void HGraphBuilder::IfBuilder::Return(HValue* value) {
HBasicBlock* block = builder_->current_block();
- HValue* context = builder_->environment()->LookupContext();
HValue* parameter_count = builder_->graph()->GetConstantMinus1();
- block->FinishExit(new(zone()) HReturn(value, context, parameter_count));
+ block->FinishExit(builder_->NewAndCast<HReturn>(value,
+ parameter_count));
builder_->set_current_block(NULL);
if (did_else_) {
first_false_block_ = NULL;
@@ -991,15 +991,24 @@ void HGraphBuilder::AddIncrementCounter(StatsCounter* counter,
HValue* context) {
if (FLAG_native_code_counters && counter->Enabled()) {
HValue* reference = Add<HConstant>(ExternalReference(counter));
- HValue* old_value = AddLoad(reference, HObjectAccess::ForCounter(), NULL);
- HValue* new_value = AddInstruction(
- HAdd::New(zone(), context, old_value, graph()->GetConstant1()));
+ HValue* old_value = Add<HLoadNamedField>(reference,
+ HObjectAccess::ForCounter());
+ HValue* new_value = Add<HAdd>(old_value, graph()->GetConstant1());
new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
- AddStore(reference, HObjectAccess::ForCounter(), new_value);
+ Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(),
+ new_value);
}
}
+void HGraphBuilder::AddSimulate(BailoutId id,
+ RemovableSimulate removable) {
+ ASSERT(current_block() != NULL);
+ ASSERT(no_side_effects_scope_count_ == 0);
+ current_block()->AddSimulate(id, removable);
+}
+
+
HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
HBasicBlock* b = graph()->CreateBasicBlock();
b->SetInitialEnvironment(env);
@@ -1090,18 +1099,17 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
Token::GTE);
capacity_checker.Then();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HValue* max_gap = Add<HConstant>(static_cast<int32_t>(JSObject::kMaxGap));
- HValue* max_capacity = AddInstruction(
- HAdd::New(zone, context, current_capacity, max_gap));
+ HValue* max_capacity = Add<HAdd>(current_capacity, max_gap);
IfBuilder key_checker(this);
key_checker.If<HCompareNumericAndBranch>(key, max_capacity, Token::LT);
key_checker.Then();
key_checker.ElseDeopt();
key_checker.End();
- HValue* new_capacity = BuildNewElementsCapacity(context, key);
+ HValue* new_capacity = BuildNewElementsCapacity(key);
HValue* new_elements = BuildGrowElementsCapacity(object, elements,
kind, kind, length,
new_capacity);
@@ -1117,7 +1125,8 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
HAdd::New(zone, context, key, graph_->GetConstant1()));
new_length->ClearFlag(HValue::kCanOverflow);
- AddStore(object, HObjectAccess::ForArrayLength(kind), new_length);
+ Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind),
+ new_length);
}
length_checker.Else();
@@ -1174,7 +1183,7 @@ void HGraphBuilder::BuildTransitionElementsKind(HValue* object,
HInstruction* elements = AddLoadElements(object);
HInstruction* empty_fixed_array = Add<HConstant>(
- isolate()->factory()->empty_fixed_array(), Representation::Tagged());
+ isolate()->factory()->empty_fixed_array());
IfBuilder if_builder(this);
@@ -1185,7 +1194,7 @@ void HGraphBuilder::BuildTransitionElementsKind(HValue* object,
HInstruction* elements_length = AddLoadFixedArrayLength(elements);
HInstruction* array_length = is_jsarray
- ? AddLoad(object, HObjectAccess::ForArrayLength(from_kind), NULL)
+ ? Add<HLoadNamedField>(object, HObjectAccess::ForArrayLength(from_kind))
: elements_length;
BuildGrowElementsCapacity(object, elements, from_kind, to_kind,
@@ -1194,7 +1203,7 @@ void HGraphBuilder::BuildTransitionElementsKind(HValue* object,
if_builder.End();
}
- AddStore(object, HObjectAccess::ForMap(), map);
+ Add<HStoreNamedField>(object, HObjectAccess::ForMap(), map);
}
@@ -1234,8 +1243,8 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
}
HInstruction* length = NULL;
if (is_js_array) {
- length = AddLoad(object, HObjectAccess::ForArrayLength(elements_kind),
- mapcheck);
+ length = Add<HLoadNamedField>(object,
+ HObjectAccess::ForArrayLength(elements_kind), mapcheck);
} else {
length = AddLoadFixedArrayLength(elements);
}
@@ -1244,8 +1253,8 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
if (IsExternalArrayElementsKind(elements_kind)) {
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
NoObservableSideEffectsScope no_effects(this);
- HLoadExternalArrayPointer* external_elements =
- Add<HLoadExternalArrayPointer>(elements);
+ HLoadExternalArrayPointer* external_elements =
+ AddAndCast<HLoadExternalArrayPointer>(elements);
IfBuilder length_checker(this);
length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT);
length_checker.Then();
@@ -1262,7 +1271,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
ASSERT(store_mode == STANDARD_STORE);
checked_key = Add<HBoundsCheck>(key, length);
HLoadExternalArrayPointer* external_elements =
- Add<HLoadExternalArrayPointer>(elements);
+ AddAndCast<HLoadExternalArrayPointer>(elements);
return AddExternalArrayElementAccess(
external_elements, checked_key, val,
mapcheck, elements_kind, is_store);
@@ -1308,21 +1317,16 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
}
-HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
- ElementsKind kind,
+HValue* HGraphBuilder::BuildAllocateElements(ElementsKind kind,
HValue* capacity) {
- Zone* zone = this->zone();
-
int elements_size = IsFastDoubleElementsKind(kind)
? kDoubleSize : kPointerSize;
- HConstant* elements_size_value = Add<HConstant>(elements_size);
- HValue* mul = AddInstruction(
- HMul::New(zone, context, capacity, elements_size_value));
+ HConstant* elements_size_value = AddAndCast<HConstant>(elements_size);
+ HValue* mul = Add<HMul>(capacity, elements_size_value);
mul->ClearFlag(HValue::kCanOverflow);
- HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize);
- HValue* total_size = AddInstruction(
- HAdd::New(zone, context, mul, header_size));
+ HConstant* header_size = AddAndCast<HConstant>(FixedArray::kHeaderSize);
+ HValue* total_size = Add<HAdd>(mul, header_size);
total_size->ClearFlag(HValue::kCanOverflow);
HAllocate::Flags flags = HAllocate::DefaultFlags(kind);
@@ -1338,7 +1342,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
}
}
- return Add<HAllocate>(context, total_size, HType::JSArray(), flags);
+ return Add<HAllocate>(total_size, HType::JSArray(), flags);
}
@@ -1351,18 +1355,18 @@ void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements,
: factory->fixed_array_map();
AddStoreMapConstant(elements, map);
- AddStore(elements, HObjectAccess::ForFixedArrayLength(), capacity);
+ Add<HStoreNamedField>(elements, HObjectAccess::ForFixedArrayLength(),
+ capacity);
}
HValue* HGraphBuilder::BuildAllocateElementsAndInitializeElementsHeader(
- HValue* context,
ElementsKind kind,
HValue* capacity) {
// The HForceRepresentation is to prevent possible deopt on int-smi
// conversion after allocation but before the new object fields are set.
capacity = Add<HForceRepresentation>(capacity, Representation::Smi());
- HValue* new_elements = BuildAllocateElements(context, kind, capacity);
+ HValue* new_elements = BuildAllocateElements(kind, capacity);
BuildInitializeElementsHeader(new_elements, kind, capacity);
return new_elements;
}
@@ -1375,14 +1379,15 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array,
HValue* allocation_site_payload,
HValue* length_field) {
- AddStore(array, HObjectAccess::ForMap(), array_map);
+ Add<HStoreNamedField>(array, HObjectAccess::ForMap(), array_map);
HConstant* empty_fixed_array =
- Add<HConstant>(isolate()->factory()->empty_fixed_array());
+ AddAndCast<HConstant>(isolate()->factory()->empty_fixed_array());
HObjectAccess access = HObjectAccess::ForPropertiesPointer();
- AddStore(array, access, empty_fixed_array);
- AddStore(array, HObjectAccess::ForArrayLength(elements_kind), length_field);
+ Add<HStoreNamedField>(array, access, empty_fixed_array);
+ Add<HStoreNamedField>(array, HObjectAccess::ForArrayLength(elements_kind),
+ length_field);
if (mode == TRACK_ALLOCATION_SITE) {
BuildCreateAllocationMemento(array,
@@ -1395,10 +1400,10 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array,
elements_location += AllocationMemento::kSize;
}
- HInnerAllocatedObject* elements =
+ HValue* elements =
Add<HInnerAllocatedObject>(array, elements_location);
- AddStore(array, HObjectAccess::ForElementsPointer(), elements);
- return elements;
+ Add<HStoreNamedField>(array, HObjectAccess::ForElementsPointer(), elements);
+ return static_cast<HInnerAllocatedObject*>(elements);
}
@@ -1441,8 +1446,10 @@ HInstruction* HGraphBuilder::AddExternalArrayElementAccess(
return Add<HStoreKeyed>(external_elements, checked_key, val, elements_kind);
} else {
ASSERT(val == NULL);
- HLoadKeyed* load = Add<HLoadKeyed>(external_elements, checked_key,
- dependency, elements_kind);
+ HLoadKeyed* load = HLoadKeyed::cast(Add<HLoadKeyed>(external_elements,
+ checked_key,
+ dependency,
+ elements_kind));
if (FLAG_opt_safe_uint32_operations &&
elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) {
graph()->RecordUint32Instruction(load);
@@ -1484,30 +1491,27 @@ HInstruction* HGraphBuilder::AddFastElementAccess(
HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object,
HValue* typecheck) {
- return AddLoad(object, HObjectAccess::ForElementsPointer(), typecheck);
+ return AddAndCast<HLoadNamedField>(object,
+ HObjectAccess::ForElementsPointer(),
+ typecheck);
}
HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) {
- return AddLoad(object, HObjectAccess::ForFixedArrayLength());
+ return AddAndCast<HLoadNamedField>(object,
+ HObjectAccess::ForFixedArrayLength());
}
-HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context,
- HValue* old_capacity) {
- Zone* zone = this->zone();
- HValue* half_old_capacity =
- AddInstruction(HShr::New(zone, context, old_capacity,
- graph_->GetConstant1()));
+HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) {
+ HValue* half_old_capacity = Add<HShr>(old_capacity, graph_->GetConstant1());
- HValue* new_capacity = AddInstruction(
- HAdd::New(zone, context, half_old_capacity, old_capacity));
+ HValue* new_capacity = Add<HAdd>(half_old_capacity, old_capacity);
new_capacity->ClearFlag(HValue::kCanOverflow);
HValue* min_growth = Add<HConstant>(16);
- new_capacity = AddInstruction(
- HAdd::New(zone, context, new_capacity, min_growth));
+ new_capacity = Add<HAdd>(new_capacity, min_growth);
new_capacity->ClearFlag(HValue::kCanOverflow);
return new_capacity;
@@ -1520,7 +1524,7 @@ void HGraphBuilder::BuildNewSpaceArrayCheck(HValue* length, ElementsKind kind) {
: kPointerSize;
int max_size = heap->MaxRegularSpaceAllocationSize() / element_size;
max_size -= JSArray::kSize / element_size;
- HConstant* max_size_constant = Add<HConstant>(max_size);
+ HConstant* max_size_constant = AddAndCast<HConstant>(max_size);
Add<HBoundsCheck>(length, max_size_constant);
}
@@ -1531,25 +1535,23 @@ HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
ElementsKind new_kind,
HValue* length,
HValue* new_capacity) {
- HValue* context = environment()->LookupContext();
-
BuildNewSpaceArrayCheck(new_capacity, new_kind);
HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
- context, new_kind, new_capacity);
+ new_kind, new_capacity);
- BuildCopyElements(context, elements, kind,
+ BuildCopyElements(elements, kind,
new_elements, new_kind,
length, new_capacity);
- AddStore(object, HObjectAccess::ForElementsPointer(), new_elements);
+ Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
+ new_elements);
return new_elements;
}
-void HGraphBuilder::BuildFillElementsWithHole(HValue* context,
- HValue* elements,
+void HGraphBuilder::BuildFillElementsWithHole(HValue* elements,
ElementsKind elements_kind,
HValue* from,
HValue* to) {
@@ -1591,7 +1593,7 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* context,
Add<HStoreKeyed>(elements, key, hole, elements_kind);
}
} else {
- LoopBuilder builder(this, context, LoopBuilder::kPostIncrement);
+ LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement);
HValue* key = builder.BeginBody(from, to, Token::LT);
@@ -1602,8 +1604,7 @@ void HGraphBuilder::BuildFillElementsWithHole(HValue* context,
}
-void HGraphBuilder::BuildCopyElements(HValue* context,
- HValue* from_elements,
+void HGraphBuilder::BuildCopyElements(HValue* from_elements,
ElementsKind from_elements_kind,
HValue* to_elements,
ElementsKind to_elements_kind,
@@ -1617,11 +1618,11 @@ void HGraphBuilder::BuildCopyElements(HValue* context,
// If the copy might trigger a GC, make sure that the FixedArray is
// pre-initialized with holes to make sure that it's always in a consistent
// state.
- BuildFillElementsWithHole(context, to_elements, to_elements_kind,
+ BuildFillElementsWithHole(to_elements, to_elements_kind,
graph()->GetConstant0(), capacity);
}
- LoopBuilder builder(this, context, LoopBuilder::kPostIncrement);
+ LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement);
HValue* key = builder.BeginBody(graph()->GetConstant0(), length, Token::LT);
@@ -1643,14 +1644,13 @@ void HGraphBuilder::BuildCopyElements(HValue* context,
if (!pre_fill_with_holes && length != capacity) {
// Fill unused capacity with the hole.
- BuildFillElementsWithHole(context, to_elements, to_elements_kind,
+ BuildFillElementsWithHole(to_elements, to_elements_kind,
key, capacity);
}
}
-HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
- HValue* boilerplate,
+HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate,
HValue* allocation_site,
AllocationSiteMode mode,
ElementsKind kind,
@@ -1673,8 +1673,7 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
// Allocate both the JS array and the elements array in one big
// allocation. This avoids multiple limit checks.
HValue* size_in_bytes = Add<HConstant>(size);
- HInstruction* object = Add<HAllocate>(context,
- size_in_bytes,
+ HInstruction* object = Add<HAllocate>(size_in_bytes,
HType::JSObject(),
allocate_flags);
@@ -1682,7 +1681,8 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
if ((i != JSArray::kElementsOffset) || (length == 0)) {
HObjectAccess access = HObjectAccess::ForJSArrayOffset(i);
- AddStore(object, access, AddLoad(boilerplate, access));
+ Add<HStoreNamedField>(object, access,
+ Add<HLoadNamedField>(boilerplate, access));
}
}
@@ -1696,12 +1696,14 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
// elements pointer in the resulting object.
HValue* boilerplate_elements = AddLoadElements(boilerplate);
HValue* object_elements = Add<HInnerAllocatedObject>(object, elems_offset);
- AddStore(object, HObjectAccess::ForElementsPointer(), object_elements);
+ Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
+ object_elements);
// Copy the elements array header.
for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) {
HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i);
- AddStore(object_elements, access, AddLoad(boilerplate_elements, access));
+ Add<HStoreNamedField>(object_elements, access,
+ Add<HLoadNamedField>(boilerplate_elements, access));
}
// Copy the elements array contents.
@@ -1720,6 +1722,37 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HContext* context,
}
+HValue* HGraphBuilder::BuildKeyHash(HValue* key) {
+ int32_t seed_value = static_cast<uint32_t>(isolate()->heap()->HashSeed());
+ HValue* seed = Add<HConstant>(seed_value);
+ HValue* hash = Add<HBitwise>(Token::BIT_XOR, key, seed);
+
+ // hash = ~hash + (hash << 15);
+ HValue* shifted_hash = Add<HShl>(hash, Add<HConstant>(15));
+ hash = Add<HAdd>(shifted_hash, static_cast<HValue*>(Add<HBitNot>(hash)));
+
+ // hash = hash ^ (hash >> 12);
+ shifted_hash = Add<HShr>(hash, Add<HConstant>(12));
+ hash = Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
+
+ // hash = hash + (hash << 2);
+ shifted_hash = Add<HShl>(hash, Add<HConstant>(2));
+ hash = Add<HAdd>(hash, shifted_hash);
+
+ // hash = hash ^ (hash >> 4);
+ shifted_hash = Add<HShr>(hash, Add<HConstant>(4));
+ hash = Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
+
+ // hash = hash * 2057;
+ hash = Add<HMul>(hash, Add<HConstant>(2057));
+ hash->ClearFlag(HValue::kCanOverflow);
+
+ // hash = hash ^ (hash >> 16);
+ shifted_hash = Add<HShr>(hash, Add<HConstant>(16));
+ return Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
+}
+
+
HInstruction* HGraphBuilder::BuildUnaryMathOp(
HValue* input, Handle<Type> type, Token::Value operation) {
// We only handle the numeric cases here
@@ -1731,8 +1764,7 @@ HInstruction* HGraphBuilder::BuildUnaryMathOp(
UNREACHABLE();
case Token::SUB: {
HInstruction* instr =
- HMul::New(zone(), environment()->LookupContext(),
- input, graph()->GetConstantMinus1());
+ New<HMul>(input, graph()->GetConstantMinus1());
Representation rep = Representation::FromType(type);
if (type->Is(Type::None())) {
Add<HDeoptimize>(Deoptimizer::SOFT);
@@ -1748,7 +1780,7 @@ HInstruction* HGraphBuilder::BuildUnaryMathOp(
if (type->Is(Type::None())) {
Add<HDeoptimize>(Deoptimizer::SOFT);
}
- return new(zone()) HBitNot(input);
+ return New<HBitNot>(input);
}
}
@@ -1797,28 +1829,28 @@ HValue* HGraphBuilder::BuildCreateAllocationMemento(HValue* previous_object,
int previous_object_size,
HValue* alloc_site) {
ASSERT(alloc_site != NULL);
- HInnerAllocatedObject* alloc_memento = Add<HInnerAllocatedObject>(
+ HInnerAllocatedObject* alloc_memento = AddAndCast<HInnerAllocatedObject>(
previous_object, previous_object_size);
Handle<Map> alloc_memento_map(
isolate()->heap()->allocation_memento_map());
AddStoreMapConstant(alloc_memento, alloc_memento_map);
HObjectAccess access = HObjectAccess::ForAllocationMementoSite();
- AddStore(alloc_memento, access, alloc_site);
+ Add<HStoreNamedField>(alloc_memento, access, alloc_site);
return alloc_memento;
}
-HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) {
+HInstruction* HGraphBuilder::BuildGetNativeContext() {
// Get the global context, then the native context
- HInstruction* global_object = Add<HGlobalObject>(context);
+ HInstruction* global_object = Add<HGlobalObject>();
HObjectAccess access = HObjectAccess::ForJSObjectOffset(
GlobalObject::kNativeContextOffset);
- return AddLoad(global_object, access);
+ return Add<HLoadNamedField>(global_object, access);
}
-HInstruction* HGraphBuilder::BuildGetArrayFunction(HValue* context) {
- HInstruction* native_context = BuildGetNativeContext(context);
+HInstruction* HGraphBuilder::BuildGetArrayFunction() {
+ HInstruction* native_context = BuildGetNativeContext();
HInstruction* index =
Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX));
return Add<HLoadKeyed>(
@@ -1852,7 +1884,7 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
}
-HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) {
+HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
if (kind_ == GetInitialFastElementsKind()) {
// No need for a context lookup if the kind_ matches the initial
// map, because we can just load the map in that case.
@@ -1861,7 +1893,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) {
builder()->BuildLoadNamedField(constructor_function_, access));
}
- HInstruction* native_context = builder()->BuildGetNativeContext(context);
+ HInstruction* native_context = builder()->BuildGetNativeContext();
HInstruction* index = builder()->Add<HConstant>(
static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX));
@@ -1885,7 +1917,6 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitInternalMapCode() {
HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
HValue* length_node) {
- HValue* context = builder()->environment()->LookupContext();
ASSERT(length_node != NULL);
int base_size = JSArray::kSize;
@@ -1898,15 +1929,12 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
HInstruction* elements_size_value =
builder()->Add<HConstant>(elements_size());
- HInstruction* mul = HMul::New(zone(), context, length_node,
- elements_size_value);
+ HInstruction* mul = builder()->Add<HMul>(length_node, elements_size_value);
mul->ClearFlag(HValue::kCanOverflow);
- builder()->AddInstruction(mul);
HInstruction* base = builder()->Add<HConstant>(base_size);
- HInstruction* total_size = HAdd::New(zone(), context, base, mul);
+ HInstruction* total_size = builder()->Add<HAdd>(base, mul);
total_size->ClearFlag(HValue::kCanOverflow);
- builder()->AddInstruction(total_size);
return total_size;
}
@@ -1927,7 +1955,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishEmptyArrayAllocationSize() {
HValue* HGraphBuilder::JSArrayBuilder::AllocateEmptyArray() {
HValue* size_in_bytes = EstablishEmptyArrayAllocationSize();
- HConstant* capacity = builder()->Add<HConstant>(initial_capacity());
+ HConstant* capacity = builder()->AddAndCast<HConstant>(initial_capacity());
return AllocateArray(size_in_bytes,
capacity,
builder()->graph()->GetConstant0(),
@@ -1947,8 +1975,6 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes,
HValue* capacity,
HValue* length_field,
bool fill_with_hole) {
- HValue* context = builder()->environment()->LookupContext();
-
// These HForceRepresentations are because we store these as fields in the
// objects we construct, and an int32-to-smi HChange could deopt. Accept
// the deopt possibility now, before allocation occurs.
@@ -1956,18 +1982,17 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes,
Representation::Smi());
length_field = builder()->Add<HForceRepresentation>(length_field,
Representation::Smi());
-
// Allocate (dealing with failure appropriately)
HAllocate::Flags flags = HAllocate::DefaultFlags(kind_);
- HAllocate* new_object = builder()->Add<HAllocate>(context, size_in_bytes,
- HType::JSArray(), flags);
+ HAllocate* new_object =
+ builder()->AddAndCast<HAllocate>(size_in_bytes, HType::JSArray(), flags);
// Fill in the fields: map, properties, length
HValue* map;
if (allocation_site_payload_ == NULL) {
map = EmitInternalMapCode();
} else {
- map = EmitMapCode(context);
+ map = EmitMapCode();
}
elements_location_ = builder()->BuildJSArrayHeader(new_object,
map,
@@ -1980,7 +2005,7 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes,
builder()->BuildInitializeElementsHeader(elements_location_, kind_, capacity);
if (fill_with_hole) {
- builder()->BuildFillElementsWithHole(context, elements_location_, kind_,
+ builder()->BuildFillElementsWithHole(elements_location_, kind_,
graph()->GetConstant0(), capacity);
}
@@ -1988,36 +2013,21 @@ HValue* HGraphBuilder::JSArrayBuilder::AllocateArray(HValue* size_in_bytes,
}
-HStoreNamedField* HGraphBuilder::AddStore(HValue *object,
- HObjectAccess access,
- HValue *val) {
- return Add<HStoreNamedField>(object, access, val);
-}
-
-
-HLoadNamedField* HGraphBuilder::AddLoad(HValue *object,
- HObjectAccess access,
- HValue *typecheck) {
- return Add<HLoadNamedField>(object, access, typecheck);
-}
-
-
HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object,
Handle<Map> map) {
- return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
- Add<HConstant>(map));
+ return AddAndCast<HStoreNamedField>(object, HObjectAccess::ForMap(),
+ Add<HConstant>(map));
}
-HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin,
- HValue* context) {
- HGlobalObject* global_object = Add<HGlobalObject>(context);
+HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) {
+ HGlobalObject* global_object = AddAndCast<HGlobalObject>();
HObjectAccess access = HObjectAccess::ForJSObjectOffset(
GlobalObject::kBuiltinsOffset);
- HValue* builtins = AddLoad(global_object, access);
+ HValue* builtins = Add<HLoadNamedField>(global_object, access);
HObjectAccess function_access = HObjectAccess::ForJSObjectOffset(
JSBuiltinsObject::OffsetOfFunctionWithId(builtin));
- return AddLoad(builtins, function_access);
+ return Add<HLoadNamedField>(builtins, function_access);
}
@@ -2909,7 +2919,7 @@ bool HOptimizedGraphBuilder::BuildGraph() {
VisitDeclarations(scope->declarations());
Add<HSimulate>(BailoutId::Declarations());
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Add<HStackCheck>(context, HStackCheck::kFunctionEntry);
VisitStatements(current_info()->function()->body());
@@ -3120,15 +3130,19 @@ HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) {
void HOptimizedGraphBuilder::SetUpScope(Scope* scope) {
- HConstant* undefined_constant = Add<HConstant>(
- isolate()->factory()->undefined_value());
+ // First special is HContext.
+ HInstruction* context = Add<HContext>();
+ environment()->BindContext(context);
+
+ HConstant* undefined_constant = HConstant::cast(Add<HConstant>(
+ isolate()->factory()->undefined_value()));
graph()->set_undefined_constant(undefined_constant);
// Create an arguments object containing the initial parameters. Set the
// initial values of parameters including "this" having parameter index 0.
ASSERT_EQ(scope->num_parameters() + 1, environment()->parameter_count());
HArgumentsObject* arguments_object =
- new(zone()) HArgumentsObject(environment()->parameter_count(), zone());
+ NewAndCast<HArgumentsObject>(environment()->parameter_count());
for (int i = 0; i < environment()->parameter_count(); ++i) {
HInstruction* parameter = Add<HParameter>(i);
arguments_object->AddArgument(parameter, zone());
@@ -3137,10 +3151,6 @@ void HOptimizedGraphBuilder::SetUpScope(Scope* scope) {
AddInstruction(arguments_object);
graph()->SetArgumentsObject(arguments_object);
- // First special is HContext.
- HInstruction* context = Add<HContext>();
- environment()->BindContext(context);
-
// Initialize specials and locals to undefined.
for (int i = environment()->parameter_count() + 1;
i < environment()->length();
@@ -3408,7 +3418,7 @@ void HOptimizedGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
return Bailout("SwitchStatement: mixed or non-literal switch labels");
}
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
CHECK_ALIVE(VisitForValue(stmt->tag()));
Add<HSimulate>(stmt->EntryId());
@@ -3556,9 +3566,9 @@ void HOptimizedGraphBuilder::VisitLoopBody(IterationStatement* stmt,
BreakAndContinueInfo* break_info) {
BreakAndContinueScope push(break_info, this);
Add<HSimulate>(stmt->StackCheckId());
- HValue* context = environment()->LookupContext();
- HStackCheck* stack_check = Add<HStackCheck>(
- context, HStackCheck::kBackwardsBranch);
+ HValue* context = environment()->context();
+ HStackCheck* stack_check = HStackCheck::cast(Add<HStackCheck>(
+ context, HStackCheck::kBackwardsBranch));
ASSERT(loop_entry->IsLoopHeader());
loop_entry->loop_information()->set_stack_check(stack_check);
CHECK_BAILOUT(Visit(stmt->body()));
@@ -3714,8 +3724,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
CHECK_ALIVE(VisitForValue(stmt->enumerable()));
HValue* enumerable = Top(); // Leave enumerable at the top.
- HInstruction* map = Add<HForInPrepareMap>(
- environment()->LookupContext(), enumerable);
+ HInstruction* map = Add<HForInPrepareMap>(enumerable);
Add<HSimulate>(stmt->PrepareId());
HInstruction* array = Add<HForInCacheArray>(
@@ -3781,9 +3790,7 @@ void HOptimizedGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
set_current_block(body_exit);
HValue* current_index = Pop();
- HInstruction* new_index = HAdd::New(zone(),
- environment()->LookupContext(),
- current_index,
+ HInstruction* new_index = New<HAdd>(current_index,
graph()->GetConstant1());
PushAndAdd(new_index);
body_exit = current_block();
@@ -3862,7 +3869,7 @@ void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
}
// We also have a stack overflow if the recursive compilation did.
if (HasStackOverflow()) return;
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HFunctionLiteral* instr =
new(zone()) HFunctionLiteral(context, shared_info, expr->pretenure());
return ast_context()->ReturnInstruction(instr, expr->id());
@@ -3936,7 +3943,7 @@ HOptimizedGraphBuilder::GlobalPropertyAccess
HValue* HOptimizedGraphBuilder::BuildContextChainWalk(Variable* var) {
ASSERT(var->IsContextSlot());
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
int length = current_info()->scope()->ContextChainLength(var->scope());
while (length-- > 0) {
context = Add<HOuterContext>(context);
@@ -3961,7 +3968,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
Handle<Object> constant_value =
isolate()->factory()->GlobalConstantFor(variable->name());
if (!constant_value.is_null()) {
- HConstant* instr = new(zone()) HConstant(constant_value);
+ HConstant* instr = NewAndCast<HConstant>(constant_value);
return ast_context()->ReturnInstruction(instr, expr->id());
}
@@ -3984,7 +3991,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
constant_object =
FlattenGetString(Handle<String>::cast(constant_object));
}
- HConstant* constant = new(zone()) HConstant(constant_object);
+ HConstant* constant = NewAndCast<HConstant>(constant_object);
return ast_context()->ReturnInstruction(constant, expr->id());
} else {
HLoadGlobalCell* instr =
@@ -3992,7 +3999,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
return ast_context()->ReturnInstruction(instr, expr->id());
}
} else {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
AddInstruction(global_object);
HLoadGlobalGeneric* instr =
@@ -4032,7 +4039,7 @@ void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) {
ASSERT(!HasStackOverflow());
ASSERT(current_block() != NULL);
ASSERT(current_block()->HasPredecessor());
- HConstant* instr = new(zone()) HConstant(expr->value());
+ HConstant* instr = NewAndCast<HConstant>(expr->value());
return ast_context()->ReturnInstruction(instr, expr->id());
}
@@ -4043,7 +4050,7 @@ void HOptimizedGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
ASSERT(current_block()->HasPredecessor());
Handle<JSFunction> closure = function_state()->compilation_info()->closure();
Handle<FixedArray> literals(closure->literals());
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HRegExpLiteral* instr = new(zone()) HRegExpLiteral(context,
literals,
@@ -4220,7 +4227,7 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
ASSERT(current_block() != NULL);
ASSERT(current_block()->HasPredecessor());
Handle<JSFunction> closure = function_state()->compilation_info()->closure();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* literal;
// Check whether to use fast or slow deep-copying for boilerplate.
@@ -4265,8 +4272,7 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Runtime::FunctionId function_id =
(expr->depth() > 1 || expr->may_store_doubles())
? Runtime::kCreateObjectLiteral : Runtime::kCreateObjectLiteralShallow;
- literal = Add<HCallRuntime>(context,
- isolate()->factory()->empty_string(),
+ literal = Add<HCallRuntime>(isolate()->factory()->empty_string(),
Runtime::FunctionForId(function_id),
4);
}
@@ -4334,7 +4340,7 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
// of the object. This makes sure that the original object won't
// be used by other optimized code before it is transformed
// (e.g. because of code motion).
- HToFastProperties* result = Add<HToFastProperties>(Pop());
+ HToFastProperties* result = AddAndCast<HToFastProperties>(Pop());
return ast_context()->ReturnValue(result);
} else {
return ast_context()->ReturnValue(Pop());
@@ -4348,7 +4354,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
ASSERT(current_block()->HasPredecessor());
ZoneList<Expression*>* subexprs = expr->values();
int length = subexprs->length();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* literal;
Handle<AllocationSite> site;
@@ -4427,8 +4433,7 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Runtime::FunctionId function_id = (expr->depth() > 1)
? Runtime::kCreateArrayLiteral : Runtime::kCreateArrayLiteralShallow;
- literal = Add<HCallRuntime>(context,
- isolate()->factory()->empty_string(),
+ literal = Add<HCallRuntime>(isolate()->factory()->empty_string(),
Runtime::FunctionForId(function_id),
3);
@@ -4467,8 +4472,8 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
case FAST_HOLEY_ELEMENTS:
case FAST_DOUBLE_ELEMENTS:
case FAST_HOLEY_DOUBLE_ELEMENTS: {
- HStoreKeyed* instr = Add<HStoreKeyed>(elements, key, value,
- boilerplate_elements_kind);
+ HStoreKeyed* instr = AddAndCast<HStoreKeyed>(elements, key, value,
+ boilerplate_elements_kind);
instr->SetUninitialized(uninitialized);
break;
}
@@ -4555,9 +4560,9 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
ASSERT(proto->GetPrototype(isolate())->IsNull());
}
ASSERT(proto->IsJSObject());
- Add<HCheckPrototypeMaps>(Handle<JSObject>(JSObject::cast(map->prototype())),
- Handle<JSObject>(JSObject::cast(proto)),
- zone(), top_info());
+ Add<HCheckPrototypeMaps>(
+ Handle<JSObject>(JSObject::cast(map->prototype())),
+ Handle<JSObject>(JSObject::cast(proto)), top_info());
}
HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name);
@@ -4571,23 +4576,25 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
// The store requires a mutable HeapNumber to be allocated.
NoObservableSideEffectsScope no_side_effects(this);
HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
- HInstruction* heap_number = Add<HAllocate>(
- environment()->LookupContext(), heap_number_size,
+ HInstruction* heap_number = Add<HAllocate>(heap_number_size,
HType::HeapNumber(), HAllocate::CAN_ALLOCATE_IN_NEW_SPACE);
AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
- AddStore(heap_number, HObjectAccess::ForHeapNumberValue(), value);
- instr = new(zone()) HStoreNamedField(
- object, heap_number_access, heap_number);
+ Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
+ value);
+ instr = NewAndCast<HStoreNamedField>(object, heap_number_access,
+ heap_number);
} else {
// Already holds a HeapNumber; load the box and write its value field.
- HInstruction* heap_number = AddLoad(object, heap_number_access);
+ HInstruction* heap_number = Add<HLoadNamedField>(object,
+ heap_number_access);
heap_number->set_type(HType::HeapNumber());
- instr = new(zone()) HStoreNamedField(heap_number,
- HObjectAccess::ForHeapNumberValue(), value);
+ instr = NewAndCast<HStoreNamedField>(heap_number,
+ HObjectAccess::ForHeapNumberValue(),
+ value);
}
} else {
// This is a normal store.
- instr = new(zone()) HStoreNamedField(object, field_access, value);
+ instr = NewAndCast<HStoreNamedField>(object, field_access, value);
}
if (transition_to_field) {
@@ -4605,7 +4612,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric(
HValue* object,
Handle<String> name,
HValue* value) {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
return new(zone()) HStoreNamedGeneric(
context,
object,
@@ -4708,9 +4715,9 @@ HInstruction* HOptimizedGraphBuilder::TryLoadPolymorphicAsMonomorphic(
Handle<JSObject> holder(lookup.holder());
Handle<Map> holder_map(holder->map());
- AddInstruction(new(zone()) HCheckPrototypeMaps(
- Handle<JSObject>::cast(prototype), holder, zone(), top_info()));
- HValue* holder_value = AddInstruction(new(zone()) HConstant(holder));
+ Add<HCheckPrototypeMaps>(
+ Handle<JSObject>::cast(prototype), holder, top_info());
+ HValue* holder_value = Add<HConstant>(holder);
return BuildLoadNamedField(holder_value,
HObjectAccess::ForField(holder_map, &lookup, name));
}
@@ -4726,7 +4733,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
if (instr == NULL) {
// Something did not match; must use a polymorphic load.
BuildCheckHeapObject(object);
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
instr = new(zone()) HLoadNamedFieldPolymorphic(
context, object, types, name, zone());
}
@@ -4955,11 +4962,10 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
}
} else {
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = Add<HGlobalObject>(context);
+ HGlobalObject* global_object = AddAndCast<HGlobalObject>();
HStoreGlobalGeneric* instr =
- Add<HStoreGlobalGeneric>(context, global_object, var->name(),
- value, function_strict_mode_flag());
+ AddAndCast<HStoreGlobalGeneric>(global_object, var->name(),
+ value, function_strict_mode_flag());
instr->set_position(position);
ASSERT(instr->HasObservableSideEffects());
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
@@ -5099,8 +5105,8 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
}
HValue* context = BuildContextChainWalk(var);
- HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(),
- mode, Top());
+ HStoreContextSlot* instr = AddAndCast<HStoreContextSlot>(
+ context, var->index(), mode, Top());
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -5311,8 +5317,8 @@ void HOptimizedGraphBuilder::VisitAssignment(Assignment* expr) {
}
HValue* context = BuildContextChainWalk(var);
- HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(),
- mode, Top());
+ HStoreContextSlot* instr = AddAndCast<HStoreContextSlot>(
+ context, var->index(), mode, Top());
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -5344,9 +5350,8 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) {
ASSERT(ast_context()->IsEffect());
CHECK_ALIVE(VisitForValue(expr->exception()));
- HValue* context = environment()->LookupContext();
HValue* value = environment()->Pop();
- HThrow* instr = Add<HThrow>(context, value);
+ HThrow* instr = AddAndCast<HThrow>(value);
instr->set_position(expr->position());
Add<HSimulate>(expr->id());
current_block()->FinishExit(new(zone()) HAbnormalExit);
@@ -5355,17 +5360,17 @@ void HOptimizedGraphBuilder::VisitThrow(Throw* expr) {
HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object,
- HObjectAccess access) {
+ HObjectAccess access) {
if (FLAG_track_double_fields && access.representation().IsDouble()) {
// load the heap number
- HLoadNamedField* heap_number =
- AddLoad(object, access.WithRepresentation(Representation::Tagged()));
+ HLoadNamedField* heap_number = AddAndCast<HLoadNamedField>(
+ object, access.WithRepresentation(Representation::Tagged()));
heap_number->set_type(HType::HeapNumber());
// load the double value from it
- return new(zone()) HLoadNamedField(heap_number,
- HObjectAccess::ForHeapNumberValue(), NULL);
+ return NewAndCast<HLoadNamedField>(heap_number,
+ HObjectAccess::ForHeapNumberValue());
}
- return new(zone()) HLoadNamedField(object, access, NULL);
+ return NewAndCast<HLoadNamedField>(object, access);
}
@@ -5376,7 +5381,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric(
if (expr->IsUninitialized()) {
Add<HDeoptimize>(Deoptimizer::SOFT);
}
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
return new(zone()) HLoadNamedGeneric(context, object, name);
}
@@ -5404,7 +5409,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
if (name->Equals(isolate()->heap()->length_string())) {
if (map->instance_type() == JS_ARRAY_TYPE) {
AddCheckMapsWithTransitions(object, map);
- return new(zone()) HLoadNamedField(object,
+ return New<HLoadNamedField>(object,
HObjectAccess::ForArrayLength(map->elements_kind()));
}
}
@@ -5421,7 +5426,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
if (lookup.IsConstant()) {
AddCheckMap(object, map);
Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate());
- return new(zone()) HConstant(constant);
+ return New<HConstant>(constant);
}
// Handle a load from a known field somewhere in the prototype chain.
@@ -5431,7 +5436,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
Handle<JSObject> holder(lookup.holder());
Handle<Map> holder_map(holder->map());
AddCheckMap(object, map);
- Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info());
+ Add<HCheckPrototypeMaps>(prototype, holder, top_info());
HValue* holder_value = Add<HConstant>(holder);
return BuildLoadNamedField(holder_value,
HObjectAccess::ForField(holder_map, &lookup, name));
@@ -5443,9 +5448,9 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
Handle<JSObject> holder(lookup.holder());
Handle<Map> holder_map(holder->map());
AddCheckMap(object, map);
- Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info());
+ Add<HCheckPrototypeMaps>(prototype, holder, top_info());
Handle<Object> constant(lookup.GetConstantFromMap(*holder_map), isolate());
- return new(zone()) HConstant(constant);
+ return New<HConstant>(constant);
}
// No luck, do a generic load.
@@ -5455,7 +5460,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedMonomorphic(
HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object,
HValue* key) {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
return new(zone()) HLoadKeyedGeneric(context, object, key);
}
@@ -5481,7 +5486,7 @@ HInstruction* HOptimizedGraphBuilder::BuildMonomorphicElementAccess(
isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
Handle<JSObject> prototype(JSObject::cast(map->prototype()), isolate());
Handle<JSObject> object_prototype = isolate()->initial_object_prototype();
- Add<HCheckPrototypeMaps>(prototype, object_prototype, zone(), top_info());
+ Add<HCheckPrototypeMaps>(prototype, object_prototype, top_info());
load_mode = ALLOW_RETURN_HOLE;
graph()->MarkDependsOnEmptyArrayProtoElements();
}
@@ -5604,9 +5609,8 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
ASSERT(Map::IsValidElementsTransition(
map->elements_kind(),
transition_target.at(i)->elements_kind()));
- HValue* context = environment()->LookupContext();
- transition = Add<HTransitionElementsKind>(context, object, map,
- transition_target.at(i));
+ transition = AddAndCast<HTransitionElementsKind>(object, map,
+ transition_target.at(i));
} else {
untransitionable_maps.Add(map);
}
@@ -5656,7 +5660,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
zone(), top_info(), mapcompare));
}
if (map->instance_type() == JS_ARRAY_TYPE) {
- HInstruction* length = AddLoad(
+ HInstruction* length = Add<HLoadNamedField>(
object, HObjectAccess::ForArrayLength(elements_kind), mapcompare);
checked_key = Add<HBoundsCheck>(key, length);
} else {
@@ -5677,7 +5681,7 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
HInstruction* length = AddLoadFixedArrayLength(elements);
checked_key = Add<HBoundsCheck>(key, length);
HLoadExternalArrayPointer* external_elements =
- Add<HLoadExternalArrayPointer>(elements);
+ AddAndCast<HLoadExternalArrayPointer>(elements);
access = AddExternalArrayElementAccess(
external_elements, checked_key, val,
mapcompare, elements_kind, is_store);
@@ -5752,7 +5756,7 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreKeyedGeneric(
HValue* object,
HValue* key,
HValue* value) {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
return new(zone()) HStoreKeyedGeneric(
context,
object,
@@ -5778,13 +5782,12 @@ void HOptimizedGraphBuilder::EnsureArgumentsArePushedForAccess() {
HInstruction* insert_after = entry;
for (int i = 0; i < arguments_values->length(); i++) {
HValue* argument = arguments_values->at(i);
- HInstruction* push_argument = new(zone()) HPushArgument(argument);
+ HInstruction* push_argument = New<HPushArgument>(argument);
push_argument->InsertAfter(insert_after);
insert_after = push_argument;
}
- HArgumentsElements* arguments_elements =
- new(zone()) HArgumentsElements(true);
+ HArgumentsElements* arguments_elements = NewAndCast<HArgumentsElements>(true);
arguments_elements->ClearFlag(HValue::kUseGVN);
arguments_elements->InsertAfter(insert_after);
function_state()->set_arguments_elements(arguments_elements);
@@ -5806,12 +5809,12 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
if (function_state()->outer() == NULL) {
HInstruction* elements = Add<HArgumentsElements>(false);
- result = new(zone()) HArgumentsLength(elements);
+ result = New<HArgumentsLength>(elements);
} else {
// Number of arguments without receiver.
int argument_count = environment()->
arguments_environment()->parameter_count() - 1;
- result = new(zone()) HConstant(argument_count);
+ result = New<HConstant>(argument_count);
}
} else {
Push(graph()->GetArgumentsObject());
@@ -5855,14 +5858,14 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
HValue* string = Pop();
BuildCheckHeapObject(string);
AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
- instr = HStringLength::New(zone(), string);
+ instr = HStringLength::New(zone(), context(), string);
} else if (expr->IsStringAccess()) {
CHECK_ALIVE(VisitForValue(expr->key()));
HValue* index = Pop();
HValue* string = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* char_code =
- BuildStringCharCodeAt(context, string, index);
+ BuildStringCharCodeAt(string, index);
AddInstruction(char_code);
instr = HStringCharFromCode::New(zone(), context, char_code);
@@ -5933,7 +5936,7 @@ void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder,
Handle<Map> receiver_map) {
if (!holder.is_null()) {
Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype()));
- Add<HCheckPrototypeMaps>(prototype, holder, zone(), top_info());
+ Add<HCheckPrototypeMaps>(prototype, holder, top_info());
}
}
@@ -6158,7 +6161,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
Drop(argument_count - (ast_context()->IsEffect() ? 0 : 1));
FinishExitWithHardDeoptimization(join);
} else {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallNamed* call = new(zone()) HCallNamed(context, name, argument_count);
call->set_position(expr->position());
PreProcessCall(call);
@@ -6410,7 +6413,8 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
//
// TODO(kmillikin): implement the same inlining on other platforms so we
// can remove the unsightly ifdefs in this function.
- HConstant* context = Add<HConstant>(Handle<Context>(target->context()));
+ HConstant* context =
+ AddAndCast<HConstant>(Handle<Context>(target->context()));
inner_env->BindContext(context);
#endif
@@ -6424,7 +6428,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
ASSERT(function->scope()->arguments()->IsStackAllocated());
HEnvironment* arguments_env = inner_env->arguments_environment();
int arguments_count = arguments_env->parameter_count();
- arguments_object = Add<HArgumentsObject>(arguments_count, zone());
+ arguments_object = AddAndCast<HArgumentsObject>(arguments_count);
inner_env->Bind(function->scope()->arguments(), arguments_object);
for (int i = 0; i < arguments_count; i++) {
arguments_object->AddArgument(arguments_env->Lookup(i), zone());
@@ -6432,10 +6436,10 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
}
HEnterInlined* enter_inlined =
- Add<HEnterInlined>(target, arguments_count, function,
- function_state()->inlining_kind(),
- function->scope()->arguments(),
- arguments_object, undefined_receiver, zone());
+ AddAndCast<HEnterInlined>(target, arguments_count, function,
+ function_state()->inlining_kind(),
+ function->scope()->arguments(),
+ arguments_object, undefined_receiver, zone());
function_state()->set_entry(enter_inlined);
VisitDeclarations(target_info.scope()->declarations());
@@ -6626,7 +6630,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr,
case kMathTan:
if (expr->arguments()->length() == 1) {
HValue* argument = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Drop(1); // Receiver.
HInstruction* op =
HUnaryMathOperation::New(zone(), context, argument, id);
@@ -6641,7 +6645,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr,
HValue* right = Pop();
HValue* left = Pop();
Drop(1); // Receiver.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* op = HMul::NewImul(zone(), context, left, right);
if (drop_extra) Drop(1); // Optionally drop the function.
ast_context()->ReturnInstruction(op, expr->id());
@@ -6672,13 +6676,13 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
if (argument_count == 2 && check_type == STRING_CHECK) {
HValue* index = Pop();
HValue* string = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
ASSERT(!expr->holder().is_null());
Add<HCheckPrototypeMaps>(Call::GetPrototypeForPrimitiveCheck(
STRING_CHECK, expr->holder()->GetIsolate()),
- expr->holder(), zone(), top_info());
+ expr->holder(), top_info());
HInstruction* char_code =
- BuildStringCharCodeAt(context, string, index);
+ BuildStringCharCodeAt(string, index);
if (id == kStringCharCodeAt) {
ast_context()->ReturnInstruction(char_code, expr->id());
return true;
@@ -6694,7 +6698,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
if (argument_count == 2 && check_type == RECEIVER_MAP_CHECK) {
AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
HValue* argument = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Drop(1); // Receiver.
HInstruction* result =
HStringCharFromCode::New(zone(), context, argument);
@@ -6716,7 +6720,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
if (argument_count == 2 && check_type == RECEIVER_MAP_CHECK) {
AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
HValue* argument = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Drop(1); // Receiver.
HInstruction* op =
HUnaryMathOperation::New(zone(), context, argument, id);
@@ -6731,7 +6735,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
HValue* right = Pop();
HValue* left = Pop();
Pop(); // Pop receiver.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* result = NULL;
// Use sqrt() if exponent is 0.5 or -0.5.
if (right->IsConstant() && HConstant::cast(right)->HasDoubleValue()) {
@@ -6756,7 +6760,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
}
if (result == NULL) {
- result = HPower::New(zone(), left, right);
+ result = HPower::New(zone(), context, left, right);
}
ast_context()->ReturnInstruction(result, expr->id());
return true;
@@ -6766,8 +6770,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) {
AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
Drop(1); // Receiver.
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = Add<HGlobalObject>(context);
+ HGlobalObject* global_object = AddAndCast<HGlobalObject>();
HRandom* result = new(zone()) HRandom(global_object);
ast_context()->ReturnInstruction(result, expr->id());
return true;
@@ -6780,7 +6783,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
HValue* right = Pop();
HValue* left = Pop();
Drop(1); // Receiver.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HMathMinMax::Operation op = (id == kMathMin) ? HMathMinMax::kMathMin
: HMathMinMax::kMathMax;
HInstruction* result =
@@ -6795,7 +6798,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
HValue* right = Pop();
HValue* left = Pop();
Drop(1); // Receiver.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* result = HMul::NewImul(zone(), context, left, right);
ast_context()->ReturnInstruction(result, expr->id());
return true;
@@ -6879,12 +6882,12 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
}
Drop(arguments_count - 1);
- PushAndAdd(new(zone()) HPushArgument(Pop()));
+ PushAndAdd(New<HPushArgument>(Pop()));
for (int i = 1; i < arguments_count; i++) {
- PushAndAdd(new(zone()) HPushArgument(arguments_values->at(i)));
+ PushAndAdd(New<HPushArgument>(arguments_values->at(i)));
}
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInvokeFunction* call = new(zone()) HInvokeFunction(
context,
function,
@@ -6970,7 +6973,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
CHECK_ALIVE(VisitArgumentList(expr->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
call = new(zone()) HCallKeyed(context, key, argument_count);
call->set_position(expr->position());
Drop(argument_count + 1); // 1 is the key.
@@ -7020,7 +7023,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
// When the target has a custom call IC generator, use the IC,
// because it is likely to generate better code. Also use the IC
// when a primitive receiver check is required.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
call = PreProcessCall(
new(zone()) HCallNamed(context, name, argument_count));
} else {
@@ -7037,7 +7040,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
return;
} else {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
call = PreProcessCall(
new(zone()) HCallNamed(context, name, argument_count));
}
@@ -7065,7 +7068,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
if (known_global_function) {
// Push the global object instead of the global receiver because
// code generated by the full code generator expects it.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
PushAndAdd(global_object);
CHECK_ALIVE(VisitExpressions(expr->arguments()));
@@ -7075,7 +7078,8 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
Add<HCheckFunction>(function, expr->target());
// Replace the global object with the global receiver.
- HGlobalReceiver* global_receiver = Add<HGlobalReceiver>(global_object);
+ HGlobalReceiver* global_receiver =
+ AddAndCast<HGlobalReceiver>(global_object);
// Index of the receiver from the top of the expression stack.
const int receiver_index = argument_count - 1;
ASSERT(environment()->ExpressionStackAt(receiver_index)->
@@ -7099,7 +7103,7 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
if (CallStubCompiler::HasCustomCallGenerator(expr->target())) {
// When the target has a custom call IC generator, use the IC,
// because it is likely to generate better code.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
call = PreProcessCall(
new(zone()) HCallNamed(context, var->name(), argument_count));
} else {
@@ -7107,12 +7111,11 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
argument_count));
}
} else {
- HValue* context = environment()->LookupContext();
- HGlobalObject* receiver = Add<HGlobalObject>(context);
- PushAndAdd(new(zone()) HPushArgument(receiver));
+ HGlobalObject* receiver = AddAndCast<HGlobalObject>();
+ PushAndAdd(New<HPushArgument>(receiver));
CHECK_ALIVE(VisitArgumentList(expr->arguments()));
- call = new(zone()) HCallGlobal(context, var->name(), argument_count);
+ call = New<HCallGlobal>(var->name(), argument_count);
Drop(argument_count);
}
@@ -7121,9 +7124,8 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
// evaluation of the arguments.
CHECK_ALIVE(VisitForValue(expr->expression()));
HValue* function = Top();
- HValue* context = environment()->LookupContext();
- HGlobalObject* global = Add<HGlobalObject>(context);
- HGlobalReceiver* receiver = new(zone()) HGlobalReceiver(global);
+ HGlobalObject* global = AddAndCast<HGlobalObject>();
+ HGlobalReceiver* receiver = NewAndCast<HGlobalReceiver>(global);
PushAndAdd(receiver);
CHECK_ALIVE(VisitExpressions(expr->arguments()));
Add<HCheckFunction>(function, expr->target());
@@ -7141,23 +7143,20 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) {
return;
} else {
call = PreProcessCall(
- new(zone()) HInvokeFunction(context,
- function,
- expr->target(),
- argument_count));
+ NewAndCast<HInvokeFunction>(function, expr->target(),
+ argument_count));
Drop(1); // The function.
}
} else {
CHECK_ALIVE(VisitForValue(expr->expression()));
HValue* function = Top();
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = Add<HGlobalObject>(context);
- HGlobalReceiver* receiver = Add<HGlobalReceiver>(global_object);
- PushAndAdd(new(zone()) HPushArgument(receiver));
+ HGlobalObject* global_object = AddAndCast<HGlobalObject>();
+ HGlobalReceiver* receiver = AddAndCast<HGlobalReceiver>(global_object);
+ PushAndAdd(New<HPushArgument>(receiver));
CHECK_ALIVE(VisitArgumentList(expr->arguments()));
- call = new(zone()) HCallFunction(context, function, argument_count);
+ call = New<HCallFunction>(function, argument_count);
Drop(argument_count + 1);
}
}
@@ -7181,7 +7180,7 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
ASSERT(current_block() != NULL);
ASSERT(current_block()->HasPredecessor());
int argument_count = expr->arguments()->length() + 1; // Plus constructor.
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Factory* factory = isolate()->factory();
if (FLAG_inline_construct &&
@@ -7216,35 +7215,35 @@ void HOptimizedGraphBuilder::VisitCallNew(CallNew* expr) {
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
}
HAllocate* receiver =
- Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags);
+ AddAndCast<HAllocate>(size_in_bytes, HType::JSObject(), flags);
receiver->set_known_initial_map(initial_map);
// Load the initial map from the constructor.
HValue* constructor_value = Add<HConstant>(constructor);
HValue* initial_map_value =
- AddLoad(constructor_value, HObjectAccess::ForJSObjectOffset(
+ Add<HLoadNamedField>(constructor_value, HObjectAccess::ForJSObjectOffset(
JSFunction::kPrototypeOrInitialMapOffset));
// Initialize map and fields of the newly allocated object.
{ NoObservableSideEffectsScope no_effects(this);
ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
- AddStore(receiver,
- HObjectAccess::ForJSObjectOffset(JSObject::kMapOffset),
- initial_map_value);
+ Add<HStoreNamedField>(receiver,
+ HObjectAccess::ForJSObjectOffset(JSObject::kMapOffset),
+ initial_map_value);
HValue* empty_fixed_array = Add<HConstant>(factory->empty_fixed_array());
- AddStore(receiver,
- HObjectAccess::ForJSObjectOffset(JSObject::kPropertiesOffset),
- empty_fixed_array);
- AddStore(receiver,
- HObjectAccess::ForJSObjectOffset(JSObject::kElementsOffset),
- empty_fixed_array);
+ Add<HStoreNamedField>(receiver,
+ HObjectAccess::ForJSObjectOffset(JSObject::kPropertiesOffset),
+ empty_fixed_array);
+ Add<HStoreNamedField>(receiver,
+ HObjectAccess::ForJSObjectOffset(JSObject::kElementsOffset),
+ empty_fixed_array);
if (initial_map->inobject_properties() != 0) {
HConstant* undefined = graph()->GetConstantUndefined();
for (int i = 0; i < initial_map->inobject_properties(); i++) {
int property_offset = JSObject::kHeaderSize + i * kPointerSize;
- AddStore(receiver,
- HObjectAccess::ForJSObjectOffset(property_offset),
- undefined);
+ Add<HStoreNamedField>(receiver,
+ HObjectAccess::ForJSObjectOffset(property_offset),
+ undefined);
}
}
}
@@ -7342,11 +7341,10 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
ASSERT(function->intrinsic_type == Runtime::RUNTIME);
CHECK_ALIVE(VisitArgumentList(expr->arguments()));
- HValue* context = environment()->LookupContext();
Handle<String> name = expr->name();
int argument_count = expr->arguments()->length();
- HCallRuntime* call =
- new(zone()) HCallRuntime(context, name, function, argument_count);
+ HCallRuntime* call = NewAndCast<HCallRuntime>(name, function,
+ argument_count);
Drop(argument_count);
return ast_context()->ReturnInstruction(call, expr->id());
}
@@ -7377,14 +7375,13 @@ void HOptimizedGraphBuilder::VisitDelete(UnaryOperation* expr) {
CHECK_ALIVE(VisitForValue(prop->key()));
HValue* key = Pop();
HValue* obj = Pop();
- HValue* context = environment()->LookupContext();
- HValue* function = AddLoadJSBuiltin(Builtins::DELETE, context);
+ HValue* function = AddLoadJSBuiltin(Builtins::DELETE);
Add<HPushArgument>(obj);
Add<HPushArgument>(key);
Add<HPushArgument>(Add<HConstant>(function_strict_mode_flag()));
// TODO(olivf) InvokeFunction produces a check for the parameter count,
// even though we are certain to pass the correct number of arguments here.
- HInstruction* instr = new(zone()) HInvokeFunction(context, function, 3);
+ HInstruction* instr = New<HInvokeFunction>(function, 3);
return ast_context()->ReturnInstruction(instr, expr->id());
} else if (proxy != NULL) {
Variable* var = proxy->var();
@@ -7419,7 +7416,7 @@ void HOptimizedGraphBuilder::VisitVoid(UnaryOperation* expr) {
void HOptimizedGraphBuilder::VisitTypeof(UnaryOperation* expr) {
CHECK_ALIVE(VisitForTypeOf(expr->expression()));
HValue* value = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* instr = new(zone()) HTypeof(context, value);
return ast_context()->ReturnInstruction(instr, expr->id());
}
@@ -7516,11 +7513,9 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
HConstant* delta = (expr->op() == Token::INC)
? graph()->GetConstant1()
: graph()->GetConstantMinus1();
- HValue* context = environment()->LookupContext();
- HInstruction* instr = HAdd::New(zone(), context, Top(), delta);
+ HInstruction* instr = Add<HAdd>(Top(), delta);
instr->SetFlag(HInstruction::kCannotBeTagged);
instr->ClearAllSideEffects();
- AddInstruction(instr);
return instr;
}
@@ -7589,8 +7584,9 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
HValue* context = BuildContextChainWalk(var);
HStoreContextSlot::Mode mode = IsLexicalVariableMode(var->mode())
? HStoreContextSlot::kCheckDeoptimize : HStoreContextSlot::kNoCheck;
- HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(),
- mode, after);
+ HStoreContextSlot* instr =
+ AddAndCast<HStoreContextSlot>(context, var->index(),
+ mode, after);
if (instr->HasObservableSideEffects()) {
Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
}
@@ -7685,7 +7681,6 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
HInstruction* HOptimizedGraphBuilder::BuildStringCharCodeAt(
- HValue* context,
HValue* string,
HValue* index) {
if (string->IsConstant() && index->IsConstant()) {
@@ -7695,17 +7690,16 @@ HInstruction* HOptimizedGraphBuilder::BuildStringCharCodeAt(
int32_t i = c_index->NumberValueAsInteger32();
Handle<String> s = c_string->StringValue();
if (i < 0 || i >= s->length()) {
- return new(zone()) HConstant(OS::nan_value());
+ return New<HConstant>(OS::nan_value());
}
- return new(zone()) HConstant(s->Get(i));
+ return New<HConstant>(s->Get(i));
}
}
BuildCheckHeapObject(string);
AddInstruction(HCheckInstanceType::NewIsString(string, zone()));
- HInstruction* length = HStringLength::New(zone(), string);
- AddInstruction(length);
+ HInstruction* length = Add<HStringLength>(string);
HInstruction* checked_index = Add<HBoundsCheck>(index, length);
- return new(zone()) HStringCharCodeAt(context, string, checked_index);
+ return New<HStringCharCodeAt>(string, checked_index);
}
@@ -7794,7 +7788,7 @@ HValue* HGraphBuilder::TruncateToNumber(HValue* value, Handle<Type>* expected) {
if_nan.Then();
if_nan.ElseDeopt();
if_nan.End();
- return Add<HConstant>(OS::nan_value(), Representation::Double());
+ return Add<HConstant>(OS::nan_value());
}
return value;
@@ -7805,7 +7799,7 @@ HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
BinaryOperation* expr,
HValue* left,
HValue* right) {
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
Handle<Type> left_type = expr->left()->bounds().lower;
Handle<Type> right_type = expr->right()->bounds().lower;
Handle<Type> result_type = expr->bounds().lower;
@@ -7858,7 +7852,7 @@ HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
break;
case Token::BIT_XOR:
case Token::BIT_AND:
- instr = HBitwise::New(zone(), expr->op(), context, left, right);
+ instr = New<HBitwise>(expr->op(), left, right);
break;
case Token::BIT_OR: {
HValue* operand, *shift_amount;
@@ -7867,7 +7861,7 @@ HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
MatchRotateRight(left, right, &operand, &shift_amount)) {
instr = new(zone()) HRor(context, operand, shift_amount);
} else {
- instr = HBitwise::New(zone(), expr->op(), context, left, right);
+ instr = New<HBitwise>(expr->op(), left, right);
}
break;
}
@@ -8112,14 +8106,14 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
CHECK_ALIVE(VisitForValue(expr->left()));
CHECK_ALIVE(VisitForValue(expr->right()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HValue* right = Pop();
HValue* left = Pop();
Token::Value op = expr->op();
if (IsLiteralCompareBool(left, op, right)) {
HCompareObjectEqAndBranch* result =
- new(zone()) HCompareObjectEqAndBranch(left, right);
+ NewAndCast<HCompareObjectEqAndBranch>(left, right);
result->set_position(expr->position());
return ast_context()->ReturnControl(result, expr->id());
}
@@ -8165,7 +8159,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
// Code below assumes that we don't fall through.
UNREACHABLE();
} else if (op == Token::IN) {
- HValue* function = AddLoadJSBuiltin(Builtins::IN, context);
+ HValue* function = AddLoadJSBuiltin(Builtins::IN);
Add<HPushArgument>(left);
Add<HPushArgument>(right);
// TODO(olivf) InvokeFunction produces a check for the parameter count,
@@ -8192,7 +8186,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
AddCheckMapsWithTransitions(left, map);
AddCheckMapsWithTransitions(right, map);
HCompareObjectEqAndBranch* result =
- new(zone()) HCompareObjectEqAndBranch(left, right);
+ NewAndCast<HCompareObjectEqAndBranch>(left, right);
result->set_position(expr->position());
return ast_context()->ReturnControl(result, expr->id());
} else {
@@ -8273,7 +8267,7 @@ HInstruction* HOptimizedGraphBuilder::BuildThisFunction() {
// If we share optimized code between different closures, the
// this-function is not a constant, except inside an inlined body.
if (function_state()->outer() != NULL) {
- return new(zone()) HConstant(
+ return New<HConstant>(
function_state()->compilation_info()->closure());
} else {
return new(zone()) HThisFunction;
@@ -8302,26 +8296,26 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
static_cast<HAllocate::Flags>(HAllocate::DefaultFlags(kind) |
HAllocate::CAN_ALLOCATE_IN_OLD_DATA_SPACE);
HValue* size_in_bytes = Add<HConstant>(data_size);
- data_target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(),
+ data_target = Add<HAllocate>(size_in_bytes, HType::JSObject(),
data_flags);
Handle<Map> free_space_map = isolate()->factory()->free_space_map();
AddStoreMapConstant(data_target, free_space_map);
HObjectAccess access =
HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset);
- AddStore(data_target, access, size_in_bytes);
+ Add<HStoreNamedField>(data_target, access, size_in_bytes);
}
if (pointer_size != 0) {
HAllocate::Flags pointer_flags =
static_cast<HAllocate::Flags>(HAllocate::DefaultFlags() |
HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
HValue* size_in_bytes = Add<HConstant>(pointer_size);
- target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(),
+ target = Add<HAllocate>(size_in_bytes, HType::JSObject(),
pointer_flags);
}
} else {
HAllocate::Flags flags = HAllocate::DefaultFlags(kind);
HValue* size_in_bytes = Add<HConstant>(data_size + pointer_size);
- target = Add<HAllocate>(context, size_in_bytes, HType::JSObject(), flags);
+ target = Add<HAllocate>(size_in_bytes, HType::JSObject(), flags);
}
int offset = 0;
@@ -8342,8 +8336,6 @@ void HOptimizedGraphBuilder::BuildEmitDeepCopy(
HInstruction* data_target,
int* data_offset,
AllocationSiteMode mode) {
- Zone* zone = this->zone();
-
bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE &&
boilerplate_object->map()->CanTrackAllocationSite();
@@ -8355,8 +8347,7 @@ void HOptimizedGraphBuilder::BuildEmitDeepCopy(
HInstruction* allocation_site = NULL;
if (create_allocation_site_info) {
- allocation_site = AddInstruction(new(zone) HConstant(
- allocation_site_object, Representation::Tagged()));
+ allocation_site = Add<HConstant>(allocation_site_object);
}
// Only elements backing stores for non-COW arrays need to be copied.
@@ -8437,14 +8428,15 @@ HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader(
}
result = elements;
}
- AddStore(object_header, HObjectAccess::ForElementsPointer(), elements);
+ Add<HStoreNamedField>(object_header, HObjectAccess::ForElementsPointer(),
+ elements);
Handle<Object> properties_field =
Handle<Object>(boilerplate_object->properties(), isolate());
ASSERT(*properties_field == isolate()->heap()->empty_fixed_array());
HInstruction* properties = Add<HConstant>(properties_field);
HObjectAccess access = HObjectAccess::ForPropertiesPointer();
- AddStore(object_header, access, properties);
+ Add<HStoreNamedField>(object_header, access, properties);
if (boilerplate_object->IsJSArray()) {
Handle<JSArray> boilerplate_array =
@@ -8454,7 +8446,7 @@ HValue* HOptimizedGraphBuilder::BuildEmitObjectHeader(
HInstruction* length = Add<HConstant>(length_field);
ASSERT(boilerplate_array->length()->IsSmi());
- AddStore(object_header, HObjectAccess::ForArrayLength(
+ Add<HStoreNamedField>(object_header, HObjectAccess::ForArrayLength(
boilerplate_array->GetElementsKind()), length);
}
@@ -8499,7 +8491,7 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
HInstruction* value_instruction = Add<HInnerAllocatedObject>(target,
*offset);
- AddStore(object_properties, access, value_instruction);
+ Add<HStoreNamedField>(object_properties, access, value_instruction);
BuildEmitDeepCopy(value_object, original_value_object,
Handle<Object>::null(), target,
offset, data_target, data_offset,
@@ -8520,12 +8512,12 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
}
AddStoreMapConstant(double_box,
isolate()->factory()->heap_number_map());
- AddStore(double_box, HObjectAccess::ForHeapNumberValue(),
+ Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(),
value_instruction);
value_instruction = double_box;
}
- AddStore(object_properties, access, value_instruction);
+ Add<HStoreNamedField>(object_properties, access, value_instruction);
}
}
@@ -8536,7 +8528,7 @@ void HOptimizedGraphBuilder::BuildEmitInObjectProperties(
ASSERT(boilerplate_object->IsJSObject());
int property_offset = boilerplate_object->GetInObjectPropertyOffset(i);
HObjectAccess access = HObjectAccess::ForJSObjectOffset(property_offset);
- AddStore(object_properties, access, value_instruction);
+ Add<HStoreNamedField>(object_properties, access, value_instruction);
}
}
@@ -8645,7 +8637,7 @@ void HOptimizedGraphBuilder::VisitDeclarations(
int flags = DeclareGlobalsEvalFlag::encode(current_info()->is_eval()) |
DeclareGlobalsNativeFlag::encode(current_info()->is_native()) |
DeclareGlobalsLanguageMode::encode(current_info()->language_mode());
- Add<HDeclareGlobals>(environment()->LookupContext(), array, flags);
+ Add<HDeclareGlobals>(array, flags);
globals_.Clear();
}
}
@@ -8674,8 +8666,8 @@ void HOptimizedGraphBuilder::VisitVariableDeclaration(
case Variable::CONTEXT:
if (hole_init) {
HValue* value = graph()->GetConstantHole();
- HValue* context = environment()->LookupContext();
- HStoreContextSlot* store = Add<HStoreContextSlot>(
+ HValue* context = environment()->context();
+ HStoreContextSlot* store = AddAndCast<HStoreContextSlot>(
context, variable->index(), HStoreContextSlot::kNoCheck, value);
if (store->HasObservableSideEffects()) {
Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
@@ -8712,8 +8704,8 @@ void HOptimizedGraphBuilder::VisitFunctionDeclaration(
case Variable::CONTEXT: {
CHECK_ALIVE(VisitForValue(declaration->fun()));
HValue* value = Pop();
- HValue* context = environment()->LookupContext();
- HStoreContextSlot* store = Add<HStoreContextSlot>(
+ HValue* context = environment()->context();
+ HStoreContextSlot* store = AddAndCast<HStoreContextSlot>(
context, variable->index(), HStoreContextSlot::kNoCheck, value);
if (store->HasObservableSideEffects()) {
Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
@@ -8887,7 +8879,7 @@ void HOptimizedGraphBuilder::GenerateArgumentsLength(CallRuntime* call) {
ASSERT(function_state()->outer() == NULL);
ASSERT(call->arguments()->length() == 0);
HInstruction* elements = Add<HArgumentsElements>(false);
- HArgumentsLength* result = new(zone()) HArgumentsLength(elements);
+ HArgumentsLength* result = NewAndCast<HArgumentsLength>(elements);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -8996,7 +8988,7 @@ void HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
// Create in-object property store to kValueOffset.
set_current_block(if_js_value);
- AddStore(object,
+ Add<HStoreNamedField>(object,
HObjectAccess::ForJSObjectOffset(JSValue::kValueOffset), value);
if_js_value->Goto(join);
join->SetJoinId(call->id());
@@ -9012,8 +9004,7 @@ void HOptimizedGraphBuilder::GenerateStringCharCodeAt(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
HValue* index = Pop();
HValue* string = Pop();
- HValue* context = environment()->LookupContext();
- HInstruction* result = BuildStringCharCodeAt(context, string, index);
+ HInstruction* result = BuildStringCharCodeAt(string, index);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -9023,8 +9014,7 @@ void HOptimizedGraphBuilder::GenerateStringCharFromCode(CallRuntime* call) {
ASSERT(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* char_code = Pop();
- HValue* context = environment()->LookupContext();
- HInstruction* result = HStringCharFromCode::New(zone(), context, char_code);
+ HInstruction* result = New<HStringCharFromCode>(char_code);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -9036,10 +9026,9 @@ void HOptimizedGraphBuilder::GenerateStringCharAt(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
HValue* index = Pop();
HValue* string = Pop();
- HValue* context = environment()->LookupContext();
- HInstruction* char_code = BuildStringCharCodeAt(context, string, index);
+ HInstruction* char_code = BuildStringCharCodeAt(string, index);
AddInstruction(char_code);
- HInstruction* result = HStringCharFromCode::New(zone(), context, char_code);
+ HInstruction* result = New<HStringCharFromCode>(char_code);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -9052,7 +9041,7 @@ void HOptimizedGraphBuilder::GenerateObjectEquals(CallRuntime* call) {
HValue* right = Pop();
HValue* left = Pop();
HCompareObjectEqAndBranch* result =
- new(zone()) HCompareObjectEqAndBranch(left, right);
+ NewAndCast<HCompareObjectEqAndBranch>(left, right);
return ast_context()->ReturnControl(result, call->id());
}
@@ -9065,8 +9054,7 @@ void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) {
// Fast support for Math.random().
void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) {
- HValue* context = environment()->LookupContext();
- HGlobalObject* global_object = Add<HGlobalObject>(context);
+ HGlobalObject* global_object = AddAndCast<HGlobalObject>();
HRandom* result = new(zone()) HRandom(global_object);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -9079,7 +9067,7 @@ void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
HValue* right = Pop();
HValue* left = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* result = HStringAdd::New(
zone(), context, left, right, STRING_ADD_CHECK_BOTH);
return ast_context()->ReturnInstruction(result, call->id());
@@ -9090,7 +9078,7 @@ void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) {
ASSERT_EQ(3, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result = new(zone()) HCallStub(context, CodeStub::SubString, 3);
Drop(3);
return ast_context()->ReturnInstruction(result, call->id());
@@ -9101,7 +9089,7 @@ void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateStringCompare(CallRuntime* call) {
ASSERT_EQ(2, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::StringCompare, 2);
Drop(2);
@@ -9113,7 +9101,7 @@ void HOptimizedGraphBuilder::GenerateStringCompare(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) {
ASSERT_EQ(4, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result = new(zone()) HCallStub(context, CodeStub::RegExpExec, 4);
Drop(4);
return ast_context()->ReturnInstruction(result, call->id());
@@ -9124,7 +9112,7 @@ void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateRegExpConstructResult(CallRuntime* call) {
ASSERT_EQ(3, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::RegExpConstructResult, 3);
Drop(3);
@@ -9142,7 +9130,7 @@ void HOptimizedGraphBuilder::GenerateGetFromCache(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateNumberToString(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::NumberToString, 1);
Drop(1);
@@ -9162,7 +9150,6 @@ void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->last()));
HValue* function = Pop();
- HValue* context = environment()->LookupContext();
// Branch for function proxies, or other non-functions.
HHasInstanceTypeAndBranch* typecheck =
@@ -9175,14 +9162,13 @@ void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) {
current_block()->Finish(typecheck);
set_current_block(if_jsfunction);
- HInstruction* invoke_result =
- Add<HInvokeFunction>(context, function, arg_count);
+ HInstruction* invoke_result = Add<HInvokeFunction>(function, arg_count);
Drop(arg_count);
Push(invoke_result);
if_jsfunction->Goto(join);
set_current_block(if_nonfunction);
- HInstruction* call_result = Add<HCallFunction>(context, function, arg_count);
+ HInstruction* call_result = Add<HCallFunction>(function, arg_count);
Drop(arg_count);
Push(call_result);
if_nonfunction->Goto(join);
@@ -9200,7 +9186,7 @@ void HOptimizedGraphBuilder::GenerateMathPow(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
HValue* right = Pop();
HValue* left = Pop();
- HInstruction* result = HPower::New(zone(), left, right);
+ HInstruction* result = HPower::New(zone(), context(), left, right);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -9208,7 +9194,7 @@ void HOptimizedGraphBuilder::GenerateMathPow(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateMathSin(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::SIN);
@@ -9220,7 +9206,7 @@ void HOptimizedGraphBuilder::GenerateMathSin(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateMathCos(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::COS);
@@ -9232,7 +9218,7 @@ void HOptimizedGraphBuilder::GenerateMathCos(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateMathTan(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::TAN);
@@ -9244,7 +9230,7 @@ void HOptimizedGraphBuilder::GenerateMathTan(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateMathLog(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::LOG);
@@ -9257,7 +9243,7 @@ void HOptimizedGraphBuilder::GenerateMathSqrt(CallRuntime* call) {
ASSERT(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop();
- HValue* context = environment()->LookupContext();
+ HValue* context = environment()->context();
HInstruction* result =
HUnaryMathOperation::New(zone(), context, value, kMathSqrt);
return ast_context()->ReturnInstruction(result, call->id());
@@ -9567,7 +9553,7 @@ HEnvironment* HEnvironment::CopyForInlining(
if (undefined_receiver) {
inner->SetValueAt(0, undefined);
}
- inner->SetValueAt(arity + 1, LookupContext());
+ inner->SetValueAt(arity + 1, context());
for (int i = arity + 2; i < inner->length(); ++i) {
inner->SetValueAt(i, undefined);
}

Powered by Google App Engine
This is Rietveld 408576698