Commit 4fb4d75d authored by adamk's avatar adamk Committed by Commit bot

Use C++11 nullptr in Hydrogen to replace static_cast<HValue*>(NULL)

Review URL: https://codereview.chromium.org/805523002

Cr-Commit-Position: refs/heads/master@{#25810}
parent b24f04d4
...@@ -323,10 +323,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { ...@@ -323,10 +323,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
// so that it doesn't build and eager frame. // so that it doesn't build and eager frame.
info()->MarkMustNotHaveEagerFrame(); info()->MarkMustNotHaveEagerFrame();
HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), HInstruction* allocation_site =
GetParameter(1), Add<HLoadKeyed>(GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS);
static_cast<HValue*>(NULL),
FAST_ELEMENTS);
IfBuilder checker(this); IfBuilder checker(this);
checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
undefined); undefined);
...@@ -334,8 +332,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { ...@@ -334,8 +332,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset); AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>( HInstruction* boilerplate =
allocation_site, static_cast<HValue*>(NULL), access); Add<HLoadNamedField>(allocation_site, nullptr, access);
HValue* elements = AddLoadElements(boilerplate); HValue* elements = AddLoadElements(boilerplate);
HValue* capacity = AddLoadFixedArrayLength(elements); HValue* capacity = AddLoadFixedArrayLength(elements);
IfBuilder zero_capacity(this); IfBuilder zero_capacity(this);
...@@ -387,10 +385,8 @@ template <> ...@@ -387,10 +385,8 @@ template <>
HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
HValue* undefined = graph()->GetConstantUndefined(); HValue* undefined = graph()->GetConstantUndefined();
HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), HInstruction* allocation_site =
GetParameter(1), Add<HLoadKeyed>(GetParameter(0), GetParameter(1), nullptr, FAST_ELEMENTS);
static_cast<HValue*>(NULL),
FAST_ELEMENTS);
IfBuilder checker(this); IfBuilder checker(this);
checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
...@@ -399,8 +395,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -399,8 +395,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset); AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>( HInstruction* boilerplate =
allocation_site, static_cast<HValue*>(NULL), access); Add<HLoadNamedField>(allocation_site, nullptr, access);
int length = casted_stub()->length(); int length = casted_stub()->length();
if (length == 0) { if (length == 0) {
...@@ -413,12 +409,10 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -413,12 +409,10 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
size += AllocationMemento::kSize; size += AllocationMemento::kSize;
} }
HValue* boilerplate_map = Add<HLoadNamedField>( HValue* boilerplate_map =
boilerplate, static_cast<HValue*>(NULL), Add<HLoadNamedField>(boilerplate, nullptr, HObjectAccess::ForMap());
HObjectAccess::ForMap());
HValue* boilerplate_size = Add<HLoadNamedField>( HValue* boilerplate_size = Add<HLoadNamedField>(
boilerplate_map, static_cast<HValue*>(NULL), boilerplate_map, nullptr, HObjectAccess::ForMapInstanceSize());
HObjectAccess::ForMapInstanceSize());
HValue* size_in_words = Add<HConstant>(object_size >> kPointerSizeLog2); HValue* size_in_words = Add<HConstant>(object_size >> kPointerSizeLog2);
checker.If<HCompareNumericAndBranch>(boilerplate_size, checker.If<HCompareNumericAndBranch>(boilerplate_size,
size_in_words, Token::EQ); size_in_words, Token::EQ);
...@@ -431,9 +425,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -431,9 +425,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
for (int i = 0; i < object_size; i += kPointerSize) { for (int i = 0; i < object_size; i += kPointerSize) {
HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(i); HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(i);
Add<HStoreNamedField>( Add<HStoreNamedField>(object, access,
object, access, Add<HLoadNamedField>( Add<HLoadNamedField>(boilerplate, nullptr, access));
boilerplate, static_cast<HValue*>(NULL), access));
} }
DCHECK(FLAG_allocation_site_pretenuring || (size == object_size)); DCHECK(FLAG_allocation_site_pretenuring || (size == object_size));
...@@ -502,9 +495,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { ...@@ -502,9 +495,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
// Link the object to the allocation site list // Link the object to the allocation site list
HValue* site_list = Add<HConstant>( HValue* site_list = Add<HConstant>(
ExternalReference::allocation_sites_list_address(isolate())); ExternalReference::allocation_sites_list_address(isolate()));
HValue* site = Add<HLoadNamedField>( HValue* site = Add<HLoadNamedField>(site_list, nullptr,
site_list, static_cast<HValue*>(NULL), HObjectAccess::ForAllocationSiteList());
HObjectAccess::ForAllocationSiteList());
// TODO(mvstanton): This is a store to a weak pointer, which we may want to // TODO(mvstanton): This is a store to a weak pointer, which we may want to
// mark as such in order to skip the write barrier, once we have a unified // mark as such in order to skip the write barrier, once we have a unified
// system for weakness. For now we decided to keep it like this because having // system for weakness. For now we decided to keep it like this because having
...@@ -536,7 +528,7 @@ HValue* CodeStubGraphBuilder<LoadScriptContextFieldStub>::BuildCodeStub() { ...@@ -536,7 +528,7 @@ HValue* CodeStubGraphBuilder<LoadScriptContextFieldStub>::BuildCodeStub() {
int slot_index = casted_stub()->slot_index(); int slot_index = casted_stub()->slot_index();
HValue* script_context = BuildGetScriptContext(context_index); HValue* script_context = BuildGetScriptContext(context_index);
return Add<HLoadNamedField>(script_context, static_cast<HValue*>(NULL), return Add<HLoadNamedField>(script_context, nullptr,
HObjectAccess::ForContextSlot(slot_index)); HObjectAccess::ForContextSlot(slot_index));
} }
...@@ -593,12 +585,11 @@ HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( ...@@ -593,12 +585,11 @@ HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField(
(!FLAG_unbox_double_fields || !index.is_inobject())) { (!FLAG_unbox_double_fields || !index.is_inobject())) {
// Load the heap number. // Load the heap number.
object = Add<HLoadNamedField>( object = Add<HLoadNamedField>(
object, static_cast<HValue*>(NULL), object, nullptr, access.WithRepresentation(Representation::Tagged()));
access.WithRepresentation(Representation::Tagged()));
// Load the double value from it. // Load the double value from it.
access = HObjectAccess::ForHeapNumberValue(); access = HObjectAccess::ForHeapNumberValue();
} }
return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); return Add<HLoadNamedField>(object, nullptr, access);
} }
...@@ -618,12 +609,10 @@ HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() { ...@@ -618,12 +609,10 @@ HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() {
HValue* map = AddLoadMap(GetParameter(0), NULL); HValue* map = AddLoadMap(GetParameter(0), NULL);
HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset( HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset(
Map::kDescriptorsOffset, Representation::Tagged()); Map::kDescriptorsOffset, Representation::Tagged());
HValue* descriptors = HValue* descriptors = Add<HLoadNamedField>(map, nullptr, descriptors_access);
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), descriptors_access);
HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset( HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset(
DescriptorArray::GetValueOffset(casted_stub()->constant_index())); DescriptorArray::GetValueOffset(casted_stub()->constant_index()));
return Add<HLoadNamedField>(descriptors, static_cast<HValue*>(NULL), return Add<HLoadNamedField>(descriptors, nullptr, value_access);
value_access);
} }
...@@ -632,20 +621,19 @@ Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); } ...@@ -632,20 +621,19 @@ Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); }
HValue* CodeStubGraphBuilderBase::UnmappedCase(HValue* elements, HValue* key) { HValue* CodeStubGraphBuilderBase::UnmappedCase(HValue* elements, HValue* key) {
HValue* result; HValue* result;
HInstruction* backing_store = Add<HLoadKeyed>( HInstruction* backing_store =
elements, graph()->GetConstant1(), static_cast<HValue*>(NULL), Add<HLoadKeyed>(elements, graph()->GetConstant1(), nullptr, FAST_ELEMENTS,
FAST_ELEMENTS, ALLOW_RETURN_HOLE); ALLOW_RETURN_HOLE);
Add<HCheckMaps>(backing_store, isolate()->factory()->fixed_array_map()); Add<HCheckMaps>(backing_store, isolate()->factory()->fixed_array_map());
HValue* backing_store_length = HValue* backing_store_length = Add<HLoadNamedField>(
Add<HLoadNamedField>(backing_store, static_cast<HValue*>(NULL), backing_store, nullptr, HObjectAccess::ForFixedArrayLength());
HObjectAccess::ForFixedArrayLength());
IfBuilder in_unmapped_range(this); IfBuilder in_unmapped_range(this);
in_unmapped_range.If<HCompareNumericAndBranch>(key, backing_store_length, in_unmapped_range.If<HCompareNumericAndBranch>(key, backing_store_length,
Token::LT); Token::LT);
in_unmapped_range.Then(); in_unmapped_range.Then();
{ {
result = Add<HLoadKeyed>(backing_store, key, static_cast<HValue*>(NULL), result = Add<HLoadKeyed>(backing_store, key, nullptr, FAST_HOLEY_ELEMENTS,
FAST_HOLEY_ELEMENTS, NEVER_RETURN_HOLE); NEVER_RETURN_HOLE);
} }
in_unmapped_range.ElseDeopt("Outside of range"); in_unmapped_range.ElseDeopt("Outside of range");
in_unmapped_range.End(); in_unmapped_range.End();
...@@ -692,19 +680,17 @@ HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() { ...@@ -692,19 +680,17 @@ HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() {
positive_smi.End(); positive_smi.End();
HValue* constant_two = Add<HConstant>(2); HValue* constant_two = Add<HConstant>(2);
HValue* elements = AddLoadElements(receiver, static_cast<HValue*>(NULL)); HValue* elements = AddLoadElements(receiver, nullptr);
HValue* elements_length = HValue* elements_length = Add<HLoadNamedField>(
Add<HLoadNamedField>(elements, static_cast<HValue*>(NULL), elements, nullptr, HObjectAccess::ForFixedArrayLength());
HObjectAccess::ForFixedArrayLength());
HValue* adjusted_length = AddUncasted<HSub>(elements_length, constant_two); HValue* adjusted_length = AddUncasted<HSub>(elements_length, constant_two);
IfBuilder in_range(this); IfBuilder in_range(this);
in_range.If<HCompareNumericAndBranch>(key, adjusted_length, Token::LT); in_range.If<HCompareNumericAndBranch>(key, adjusted_length, Token::LT);
in_range.Then(); in_range.Then();
{ {
HValue* index = AddUncasted<HAdd>(key, constant_two); HValue* index = AddUncasted<HAdd>(key, constant_two);
HInstruction* mapped_index = HInstruction* mapped_index = Add<HLoadKeyed>(
Add<HLoadKeyed>(elements, index, static_cast<HValue*>(NULL), elements, index, nullptr, FAST_HOLEY_ELEMENTS, ALLOW_RETURN_HOLE);
FAST_HOLEY_ELEMENTS, ALLOW_RETURN_HOLE);
IfBuilder is_valid(this); IfBuilder is_valid(this);
is_valid.IfNot<HCompareObjectEqAndBranch>(mapped_index, is_valid.IfNot<HCompareObjectEqAndBranch>(mapped_index,
...@@ -714,13 +700,11 @@ HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() { ...@@ -714,13 +700,11 @@ HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() {
// TODO(mvstanton): I'd like to assert from this point, that if the // TODO(mvstanton): I'd like to assert from this point, that if the
// mapped_index is not the hole that it is indeed, a smi. An unnecessary // mapped_index is not the hole that it is indeed, a smi. An unnecessary
// smi check is being emitted. // smi check is being emitted.
HValue* the_context = HValue* the_context = Add<HLoadKeyed>(elements, graph()->GetConstant0(),
Add<HLoadKeyed>(elements, graph()->GetConstant0(), nullptr, FAST_ELEMENTS);
static_cast<HValue*>(NULL), FAST_ELEMENTS);
DCHECK(Context::kHeaderSize == FixedArray::kHeaderSize); DCHECK(Context::kHeaderSize == FixedArray::kHeaderSize);
HValue* result = HValue* result = Add<HLoadKeyed>(the_context, mapped_index, nullptr,
Add<HLoadKeyed>(the_context, mapped_index, static_cast<HValue*>(NULL), FAST_ELEMENTS, ALLOW_RETURN_HOLE);
FAST_ELEMENTS, ALLOW_RETURN_HOLE);
environment()->Push(result); environment()->Push(result);
} }
is_valid.Else(); is_valid.Else();
...@@ -778,8 +762,7 @@ void CodeStubGraphBuilderBase::BuildStoreNamedField( ...@@ -778,8 +762,7 @@ void CodeStubGraphBuilderBase::BuildStoreNamedField(
value = heap_number; value = heap_number;
} else { } else {
// Load the heap number. // Load the heap number.
object = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), object = Add<HLoadNamedField>(object, nullptr, heap_number_access);
heap_number_access);
// Store the double value into it. // Store the double value into it.
access = HObjectAccess::ForHeapNumberValue(); access = HObjectAccess::ForHeapNumberValue();
} }
...@@ -809,9 +792,8 @@ HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { ...@@ -809,9 +792,8 @@ HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() {
switch (casted_stub()->store_mode()) { switch (casted_stub()->store_mode()) {
case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: { case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: {
HValue* properties = HValue* properties = Add<HLoadNamedField>(
Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), object, nullptr, HObjectAccess::ForPropertiesPointer());
HObjectAccess::ForPropertiesPointer());
HValue* length = AddLoadFixedArrayLength(properties); HValue* length = AddLoadFixedArrayLength(properties);
HValue* delta = HValue* delta =
Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded)); Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded));
...@@ -1345,8 +1327,7 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { ...@@ -1345,8 +1327,7 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
HValue* cell = Add<HConstant>(placeholder_cell); HValue* cell = Add<HConstant>(placeholder_cell);
HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
HValue* cell_contents = Add<HLoadNamedField>( HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
cell, static_cast<HValue*>(NULL), access);
if (stub->is_constant()) { if (stub->is_constant()) {
IfBuilder builder(this); IfBuilder builder(this);
...@@ -1444,7 +1425,7 @@ void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( ...@@ -1444,7 +1425,7 @@ void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode(
// Now link a function into a list of optimized functions. // Now link a function into a list of optimized functions.
HValue* optimized_functions_list = Add<HLoadNamedField>( HValue* optimized_functions_list = Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL), native_context, nullptr,
HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST));
Add<HStoreNamedField>(js_function, Add<HStoreNamedField>(js_function,
HObjectAccess::ForNextFunctionLinkPointer(), HObjectAccess::ForNextFunctionLinkPointer(),
...@@ -1464,8 +1445,8 @@ void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function, ...@@ -1464,8 +1445,8 @@ void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function,
Add<HStoreNamedField>(js_function, Add<HStoreNamedField>(js_function,
HObjectAccess::ForNextFunctionLinkPointer(), HObjectAccess::ForNextFunctionLinkPointer(),
graph()->GetConstantUndefined()); graph()->GetConstantUndefined());
HValue* code_object = Add<HLoadNamedField>( HValue* code_object = Add<HLoadNamedField>(shared_info, nullptr,
shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset()); HObjectAccess::ForCodeOffset());
Add<HStoreCodeEntry>(js_function, code_object); Add<HStoreCodeEntry>(js_function, code_object);
} }
...@@ -1482,8 +1463,8 @@ HInstruction* CodeStubGraphBuilderBase::LoadFromOptimizedCodeMap( ...@@ -1482,8 +1463,8 @@ HInstruction* CodeStubGraphBuilderBase::LoadFromOptimizedCodeMap(
HValue* field_offset_value = Add<HConstant>(field_offset); HValue* field_offset_value = Add<HConstant>(field_offset);
field_slot = AddUncasted<HAdd>(iterator, field_offset_value); field_slot = AddUncasted<HAdd>(iterator, field_offset_value);
} }
HInstruction* field_entry = Add<HLoadKeyed>(optimized_map, field_slot, HInstruction* field_entry =
static_cast<HValue*>(NULL), FAST_ELEMENTS); Add<HLoadKeyed>(optimized_map, field_slot, nullptr, FAST_ELEMENTS);
return field_entry; return field_entry;
} }
...@@ -1495,8 +1476,7 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1495,8 +1476,7 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
Counters* counters = isolate()->counters(); Counters* counters = isolate()->counters();
IfBuilder is_optimized(this); IfBuilder is_optimized(this);
HInstruction* optimized_map = Add<HLoadNamedField>( HInstruction* optimized_map = Add<HLoadNamedField>(
shared_info, static_cast<HValue*>(NULL), shared_info, nullptr, HObjectAccess::ForOptimizedCodeMap());
HObjectAccess::ForOptimizedCodeMap());
HValue* null_constant = Add<HConstant>(0); HValue* null_constant = Add<HConstant>(0);
is_optimized.If<HCompareObjectEqAndBranch>(optimized_map, null_constant); is_optimized.If<HCompareObjectEqAndBranch>(optimized_map, null_constant);
is_optimized.Then(); is_optimized.Then();
...@@ -1529,8 +1509,7 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1529,8 +1509,7 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
LoopBuilder::kPostDecrement, LoopBuilder::kPostDecrement,
shared_function_entry_length); shared_function_entry_length);
HValue* array_length = Add<HLoadNamedField>( HValue* array_length = Add<HLoadNamedField>(
optimized_map, static_cast<HValue*>(NULL), optimized_map, nullptr, HObjectAccess::ForFixedArrayLength());
HObjectAccess::ForFixedArrayLength());
HValue* start_pos = AddUncasted<HSub>(array_length, HValue* start_pos = AddUncasted<HSub>(array_length,
shared_function_entry_length); shared_function_entry_length);
HValue* slot_iterator = loop_builder.BeginBody(start_pos, HValue* slot_iterator = loop_builder.BeginBody(start_pos,
...@@ -1583,9 +1562,8 @@ HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { ...@@ -1583,9 +1562,8 @@ HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() {
// Compute the function map in the current native context and set that // Compute the function map in the current native context and set that
// as the map of the allocated object. // as the map of the allocated object.
HInstruction* native_context = BuildGetNativeContext(); HInstruction* native_context = BuildGetNativeContext();
HInstruction* map_slot_value = HInstruction* map_slot_value = Add<HLoadNamedField>(
Add<HLoadNamedField>(native_context, static_cast<HValue*>(NULL), native_context, nullptr, HObjectAccess::ForContextSlot(map_index));
HObjectAccess::ForContextSlot(map_index));
Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value);
// Initialize the rest of the function. // Initialize the rest of the function.
...@@ -1652,7 +1630,7 @@ HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() { ...@@ -1652,7 +1630,7 @@ HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() {
// Copy the global object from the previous context. // Copy the global object from the previous context.
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
Add<HStoreNamedField>(function_context, Add<HStoreNamedField>(function_context,
HObjectAccess::ForContextSlot( HObjectAccess::ForContextSlot(
...@@ -1817,16 +1795,14 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { ...@@ -1817,16 +1795,14 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
(1 << Map::kHasIndexedInterceptor); (1 << Map::kHasIndexedInterceptor);
BuildJSObjectCheck(receiver, bit_field_mask); BuildJSObjectCheck(receiver, bit_field_mask);
HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* map =
HObjectAccess::ForMap()); Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
HValue* instance_type = HValue* instance_type =
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
HObjectAccess::ForMapInstanceType());
HValue* bit_field2 = Add<HLoadNamedField>(map, HValue* bit_field2 =
static_cast<HValue*>(NULL), Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2());
HObjectAccess::ForMapBitField2());
IfBuilder kind_if(this); IfBuilder kind_if(this);
BuildFastElementLoad(&kind_if, receiver, key, instance_type, bit_field2, BuildFastElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
...@@ -1916,12 +1892,10 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { ...@@ -1916,12 +1892,10 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
BuildNonGlobalObjectCheck(receiver); BuildNonGlobalObjectCheck(receiver);
HValue* properties = Add<HLoadNamedField>( HValue* properties = Add<HLoadNamedField>(
receiver, static_cast<HValue*>(NULL), receiver, nullptr, HObjectAccess::ForPropertiesPointer());
HObjectAccess::ForPropertiesPointer());
HValue* hash = HValue* hash =
Add<HLoadNamedField>(key, static_cast<HValue*>(NULL), Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField());
HObjectAccess::ForNameHashField());
hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift));
...@@ -1940,8 +1914,8 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { ...@@ -1940,8 +1914,8 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
ExternalReference::keyed_lookup_cache_keys(isolate()); ExternalReference::keyed_lookup_cache_keys(isolate());
HValue* cache_keys = Add<HConstant>(cache_keys_ref); HValue* cache_keys = Add<HConstant>(cache_keys_ref);
HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* map =
HObjectAccess::ForMap()); Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
HValue* base_index = AddUncasted<HMul>(hash, Add<HConstant>(2)); HValue* base_index = AddUncasted<HMul>(hash, Add<HConstant>(2));
base_index->ClearFlag(HValue::kCanOverflow); base_index->ClearFlag(HValue::kCanOverflow);
...@@ -1963,13 +1937,13 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { ...@@ -1963,13 +1937,13 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
Add<HConstant>(probe_base + KeyedLookupCache::kKeyIndex)); Add<HConstant>(probe_base + KeyedLookupCache::kKeyIndex));
key_index->ClearFlag(HValue::kCanOverflow); key_index->ClearFlag(HValue::kCanOverflow);
HValue* map_to_check = HValue* map_to_check =
Add<HLoadKeyed>(cache_keys, map_index, static_cast<HValue*>(NULL), Add<HLoadKeyed>(cache_keys, map_index, nullptr, FAST_ELEMENTS,
FAST_ELEMENTS, NEVER_RETURN_HOLE, 0); NEVER_RETURN_HOLE, 0);
lookup_if->If<HCompareObjectEqAndBranch>(map_to_check, map); lookup_if->If<HCompareObjectEqAndBranch>(map_to_check, map);
lookup_if->And(); lookup_if->And();
HValue* key_to_check = HValue* key_to_check =
Add<HLoadKeyed>(cache_keys, key_index, static_cast<HValue*>(NULL), Add<HLoadKeyed>(cache_keys, key_index, nullptr, FAST_ELEMENTS,
FAST_ELEMENTS, NEVER_RETURN_HOLE, 0); NEVER_RETURN_HOLE, 0);
lookup_if->If<HCompareObjectEqAndBranch>(key_to_check, key); lookup_if->If<HCompareObjectEqAndBranch>(key_to_check, key);
lookup_if->Then(); lookup_if->Then();
{ {
...@@ -1979,9 +1953,9 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { ...@@ -1979,9 +1953,9 @@ HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
Add<HConstant>(cache_field_offsets_ref); Add<HConstant>(cache_field_offsets_ref);
HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe)); HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe));
index->ClearFlag(HValue::kCanOverflow); index->ClearFlag(HValue::kCanOverflow);
HValue* property_index = Add<HLoadKeyed>( HValue* property_index =
cache_field_offsets, index, static_cast<HValue*>(NULL), Add<HLoadKeyed>(cache_field_offsets, index, nullptr,
EXTERNAL_INT32_ELEMENTS, NEVER_RETURN_HOLE, 0); EXTERNAL_INT32_ELEMENTS, NEVER_RETURN_HOLE, 0);
Push(property_index); Push(property_index);
} }
lookup_if->Else(); lookup_if->Else();
...@@ -2027,9 +2001,8 @@ void CodeStubGraphBuilderBase::TailCallHandler(HValue* receiver, HValue* name, ...@@ -2027,9 +2001,8 @@ void CodeStubGraphBuilderBase::TailCallHandler(HValue* receiver, HValue* name,
// to HLoadKeyed. // to HLoadKeyed.
int offset = int offset =
GetDefaultHeaderSizeForElementsKind(FAST_ELEMENTS) + kPointerSize; GetDefaultHeaderSizeForElementsKind(FAST_ELEMENTS) + kPointerSize;
HValue* handler_code = HValue* handler_code = Add<HLoadKeyed>(
Add<HLoadKeyed>(array, map_index, static_cast<HValue*>(NULL), array, map_index, nullptr, FAST_ELEMENTS, NEVER_RETURN_HOLE, offset);
FAST_ELEMENTS, NEVER_RETURN_HOLE, offset);
TailCallHandler(receiver, name, slot, vector, handler_code); TailCallHandler(receiver, name, slot, vector, handler_code);
} }
...@@ -2067,12 +2040,11 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver, ...@@ -2067,12 +2040,11 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver,
HConstant* constant_two = Add<HConstant>(2); HConstant* constant_two = Add<HConstant>(2);
HConstant* constant_three = Add<HConstant>(3); HConstant* constant_three = Add<HConstant>(3);
HValue* receiver_map = AddLoadMap(receiver, static_cast<HValue*>(NULL)); HValue* receiver_map = AddLoadMap(receiver, nullptr);
HValue* start = HValue* start =
keyed_load ? graph()->GetConstant1() : graph()->GetConstant0(); keyed_load ? graph()->GetConstant1() : graph()->GetConstant0();
HValue* array_map = HValue* array_map = Add<HLoadKeyed>(array, start, nullptr, FAST_ELEMENTS,
Add<HLoadKeyed>(array, start, static_cast<HValue*>(NULL), FAST_ELEMENTS, ALLOW_RETURN_HOLE);
ALLOW_RETURN_HOLE);
IfBuilder if_correct_map(this); IfBuilder if_correct_map(this);
if_correct_map.If<HCompareObjectEqAndBranch>(receiver_map, array_map); if_correct_map.If<HCompareObjectEqAndBranch>(receiver_map, array_map);
if_correct_map.Then(); if_correct_map.Then();
...@@ -2081,16 +2053,14 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver, ...@@ -2081,16 +2053,14 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver,
{ {
// If our array has more elements, the ic is polymorphic. Look for the // If our array has more elements, the ic is polymorphic. Look for the
// receiver map in the rest of the array. // receiver map in the rest of the array.
HValue* length = HValue* length = AddLoadFixedArrayLength(array, nullptr);
AddLoadFixedArrayLength(array, static_cast<HValue*>(NULL));
LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement, LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement,
constant_two); constant_two);
start = keyed_load ? constant_three : constant_two; start = keyed_load ? constant_three : constant_two;
HValue* key = builder.BeginBody(start, length, Token::LT); HValue* key = builder.BeginBody(start, length, Token::LT);
{ {
HValue* array_map = HValue* array_map = Add<HLoadKeyed>(array, key, nullptr, FAST_ELEMENTS,
Add<HLoadKeyed>(array, key, static_cast<HValue*>(NULL), ALLOW_RETURN_HOLE);
FAST_ELEMENTS, ALLOW_RETURN_HOLE);
IfBuilder if_correct_poly_map(this); IfBuilder if_correct_poly_map(this);
if_correct_poly_map.If<HCompareObjectEqAndBranch>(receiver_map, if_correct_poly_map.If<HCompareObjectEqAndBranch>(receiver_map,
array_map); array_map);
...@@ -2113,8 +2083,8 @@ HValue* CodeStubGraphBuilder<VectorLoadStub>::BuildCodeStub() { ...@@ -2113,8 +2083,8 @@ HValue* CodeStubGraphBuilder<VectorLoadStub>::BuildCodeStub() {
// If the feedback is an array, then the IC is in the monomorphic or // If the feedback is an array, then the IC is in the monomorphic or
// polymorphic state. // polymorphic state.
HValue* feedback = Add<HLoadKeyed>(vector, slot, static_cast<HValue*>(NULL), HValue* feedback =
FAST_ELEMENTS, ALLOW_RETURN_HOLE); Add<HLoadKeyed>(vector, slot, nullptr, FAST_ELEMENTS, ALLOW_RETURN_HOLE);
IfBuilder array_checker(this); IfBuilder array_checker(this);
array_checker.If<HCompareMap>(feedback, array_checker.If<HCompareMap>(feedback,
isolate()->factory()->fixed_array_map()); isolate()->factory()->fixed_array_map());
...@@ -2156,8 +2126,8 @@ HValue* CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() { ...@@ -2156,8 +2126,8 @@ HValue* CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() {
// If the feedback is an array, then the IC is in the monomorphic or // If the feedback is an array, then the IC is in the monomorphic or
// polymorphic state. // polymorphic state.
HValue* feedback = Add<HLoadKeyed>(vector, slot, static_cast<HValue*>(NULL), HValue* feedback =
FAST_ELEMENTS, ALLOW_RETURN_HOLE); Add<HLoadKeyed>(vector, slot, nullptr, FAST_ELEMENTS, ALLOW_RETURN_HOLE);
IfBuilder array_checker(this); IfBuilder array_checker(this);
array_checker.If<HCompareMap>(feedback, array_checker.If<HCompareMap>(feedback,
isolate()->factory()->fixed_array_map()); isolate()->factory()->fixed_array_map());
...@@ -2165,9 +2135,8 @@ HValue* CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() { ...@@ -2165,9 +2135,8 @@ HValue* CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() {
{ {
// If feedback[0] is 0, then the IC has element handlers and name should be // If feedback[0] is 0, then the IC has element handlers and name should be
// a smi. If feedback[0] is a string, verify that it matches name. // a smi. If feedback[0] is a string, verify that it matches name.
HValue* recorded_name = HValue* recorded_name = Add<HLoadKeyed>(feedback, zero, nullptr,
Add<HLoadKeyed>(feedback, zero, static_cast<HValue*>(NULL), FAST_ELEMENTS, ALLOW_RETURN_HOLE);
FAST_ELEMENTS, ALLOW_RETURN_HOLE);
IfBuilder recorded_name_is_zero(this); IfBuilder recorded_name_is_zero(this);
recorded_name_is_zero.If<HCompareObjectEqAndBranch>(recorded_name, zero); recorded_name_is_zero.If<HCompareObjectEqAndBranch>(recorded_name, zero);
......
...@@ -1217,8 +1217,8 @@ void HGraphBuilder::FinishExitCurrentBlock(HControlInstruction* instruction) { ...@@ -1217,8 +1217,8 @@ void HGraphBuilder::FinishExitCurrentBlock(HControlInstruction* instruction) {
void HGraphBuilder::AddIncrementCounter(StatsCounter* counter) { void HGraphBuilder::AddIncrementCounter(StatsCounter* counter) {
if (FLAG_native_code_counters && counter->Enabled()) { if (FLAG_native_code_counters && counter->Enabled()) {
HValue* reference = Add<HConstant>(ExternalReference(counter)); HValue* reference = Add<HConstant>(ExternalReference(counter));
HValue* old_value = Add<HLoadNamedField>( HValue* old_value =
reference, static_cast<HValue*>(NULL), HObjectAccess::ForCounter()); Add<HLoadNamedField>(reference, nullptr, HObjectAccess::ForCounter());
HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1()); HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1());
new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(), Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(),
...@@ -1252,11 +1252,10 @@ HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { ...@@ -1252,11 +1252,10 @@ HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
HValue* HGraphBuilder::BuildGetElementsKind(HValue* object) { HValue* HGraphBuilder::BuildGetElementsKind(HValue* object) {
HValue* map = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap());
HObjectAccess::ForMap());
HValue* bit_field2 = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), HValue* bit_field2 =
HObjectAccess::ForMapBitField2()); Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2());
return BuildDecodeField<Map::ElementsKindBits>(bit_field2); return BuildDecodeField<Map::ElementsKindBits>(bit_field2);
} }
...@@ -1415,10 +1414,11 @@ void HGraphBuilder::BuildTransitionElementsKind(HValue* object, ...@@ -1415,10 +1414,11 @@ void HGraphBuilder::BuildTransitionElementsKind(HValue* object,
HInstruction* elements_length = AddLoadFixedArrayLength(elements); HInstruction* elements_length = AddLoadFixedArrayLength(elements);
HInstruction* array_length = is_jsarray HInstruction* array_length =
? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), is_jsarray
HObjectAccess::ForArrayLength(from_kind)) ? Add<HLoadNamedField>(object, nullptr,
: elements_length; HObjectAccess::ForArrayLength(from_kind))
: elements_length;
BuildGrowElementsCapacity(object, elements, from_kind, to_kind, BuildGrowElementsCapacity(object, elements, from_kind, to_kind,
array_length, elements_length); array_length, elements_length);
...@@ -1436,14 +1436,14 @@ void HGraphBuilder::BuildJSObjectCheck(HValue* receiver, ...@@ -1436,14 +1436,14 @@ void HGraphBuilder::BuildJSObjectCheck(HValue* receiver,
Add<HCheckHeapObject>(receiver); Add<HCheckHeapObject>(receiver);
// Get the map of the receiver. // Get the map of the receiver.
HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* map =
HObjectAccess::ForMap()); Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
// Check the instance type and if an access check is needed, this can be // Check the instance type and if an access check is needed, this can be
// done with a single load, since both bytes are adjacent in the map. // done with a single load, since both bytes are adjacent in the map.
HObjectAccess access(HObjectAccess::ForMapInstanceTypeAndBitField()); HObjectAccess access(HObjectAccess::ForMapInstanceTypeAndBitField());
HValue* instance_type_and_bit_field = HValue* instance_type_and_bit_field =
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), access); Add<HLoadNamedField>(map, nullptr, access);
HValue* mask = Add<HConstant>(0x00FF | (bit_field_mask << 8)); HValue* mask = Add<HConstant>(0x00FF | (bit_field_mask << 8));
HValue* and_result = AddUncasted<HBitwise>(Token::BIT_AND, HValue* and_result = AddUncasted<HBitwise>(Token::BIT_AND,
...@@ -1472,11 +1472,9 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key, ...@@ -1472,11 +1472,9 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key,
} }
key_smi_if.Else(); key_smi_if.Else();
{ {
HValue* map = Add<HLoadNamedField>(key, static_cast<HValue*>(NULL), HValue* map = Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForMap());
HObjectAccess::ForMap());
HValue* instance_type = HValue* instance_type =
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
HObjectAccess::ForMapInstanceType());
// Non-unique string, check for a string with a hash code that is actually // Non-unique string, check for a string with a hash code that is actually
// an index. // an index.
...@@ -1508,9 +1506,8 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key, ...@@ -1508,9 +1506,8 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key,
{ {
// String: check whether the String is a String of an index. If it is, // String: check whether the String is a String of an index. If it is,
// extract the index value from the hash. // extract the index value from the hash.
HValue* hash = HValue* hash = Add<HLoadNamedField>(key, nullptr,
Add<HLoadNamedField>(key, static_cast<HValue*>(NULL), HObjectAccess::ForNameHashField());
HObjectAccess::ForNameHashField());
HValue* not_index_mask = Add<HConstant>(static_cast<int>( HValue* not_index_mask = Add<HConstant>(static_cast<int>(
String::kContainsCachedArrayIndexMask)); String::kContainsCachedArrayIndexMask));
...@@ -1569,11 +1566,10 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key, ...@@ -1569,11 +1566,10 @@ void HGraphBuilder::BuildKeyedIndexCheck(HValue* key,
void HGraphBuilder::BuildNonGlobalObjectCheck(HValue* receiver) { void HGraphBuilder::BuildNonGlobalObjectCheck(HValue* receiver) {
// Get the the instance type of the receiver, and make sure that it is // Get the the instance type of the receiver, and make sure that it is
// not one of the global object types. // not one of the global object types.
HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* map =
HObjectAccess::ForMap()); Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
HValue* instance_type = HValue* instance_type =
Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
HObjectAccess::ForMapInstanceType());
STATIC_ASSERT(JS_BUILTINS_OBJECT_TYPE == JS_GLOBAL_OBJECT_TYPE + 1); STATIC_ASSERT(JS_BUILTINS_OBJECT_TYPE == JS_GLOBAL_OBJECT_TYPE + 1);
HValue* min_global_type = Add<HConstant>(JS_GLOBAL_OBJECT_TYPE); HValue* min_global_type = Add<HConstant>(JS_GLOBAL_OBJECT_TYPE);
HValue* max_global_type = Add<HConstant>(JS_BUILTINS_OBJECT_TYPE); HValue* max_global_type = Add<HConstant>(JS_BUILTINS_OBJECT_TYPE);
...@@ -1595,11 +1591,9 @@ void HGraphBuilder::BuildTestForDictionaryProperties( ...@@ -1595,11 +1591,9 @@ void HGraphBuilder::BuildTestForDictionaryProperties(
HValue* object, HValue* object,
HIfContinuation* continuation) { HIfContinuation* continuation) {
HValue* properties = Add<HLoadNamedField>( HValue* properties = Add<HLoadNamedField>(
object, static_cast<HValue*>(NULL), object, nullptr, HObjectAccess::ForPropertiesPointer());
HObjectAccess::ForPropertiesPointer());
HValue* properties_map = HValue* properties_map =
Add<HLoadNamedField>(properties, static_cast<HValue*>(NULL), Add<HLoadNamedField>(properties, nullptr, HObjectAccess::ForMap());
HObjectAccess::ForMap());
HValue* hash_map = Add<HLoadRoot>(Heap::kHashTableMapRootIndex); HValue* hash_map = Add<HLoadRoot>(Heap::kHashTableMapRootIndex);
IfBuilder builder(this); IfBuilder builder(this);
builder.If<HCompareObjectEqAndBranch>(properties_map, hash_map); builder.If<HCompareObjectEqAndBranch>(properties_map, hash_map);
...@@ -1612,13 +1606,11 @@ HValue* HGraphBuilder::BuildKeyedLookupCacheHash(HValue* object, ...@@ -1612,13 +1606,11 @@ HValue* HGraphBuilder::BuildKeyedLookupCacheHash(HValue* object,
// Load the map of the receiver, compute the keyed lookup cache hash // Load the map of the receiver, compute the keyed lookup cache hash
// based on 32 bits of the map pointer and the string hash. // based on 32 bits of the map pointer and the string hash.
HValue* object_map = HValue* object_map =
Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMapAsInteger32());
HObjectAccess::ForMapAsInteger32());
HValue* shifted_map = AddUncasted<HShr>( HValue* shifted_map = AddUncasted<HShr>(
object_map, Add<HConstant>(KeyedLookupCache::kMapHashShift)); object_map, Add<HConstant>(KeyedLookupCache::kMapHashShift));
HValue* string_hash = HValue* string_hash =
Add<HLoadNamedField>(key, static_cast<HValue*>(NULL), Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForStringHashField());
HObjectAccess::ForStringHashField());
HValue* shifted_hash = AddUncasted<HShr>( HValue* shifted_hash = AddUncasted<HShr>(
string_hash, Add<HConstant>(String::kHashShift)); string_hash, Add<HConstant>(String::kHashShift));
HValue* xor_result = AddUncasted<HBitwise>(Token::BIT_XOR, shifted_map, HValue* xor_result = AddUncasted<HBitwise>(Token::BIT_XOR, shifted_map,
...@@ -1666,11 +1658,9 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, ...@@ -1666,11 +1658,9 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
HValue* elements, HValue* elements,
HValue* key, HValue* key,
HValue* hash) { HValue* hash) {
HValue* capacity = Add<HLoadKeyed>( HValue* capacity =
elements, Add<HLoadKeyed>(elements, Add<HConstant>(NameDictionary::kCapacityIndex),
Add<HConstant>(NameDictionary::kCapacityIndex), nullptr, FAST_ELEMENTS);
static_cast<HValue*>(NULL),
FAST_ELEMENTS);
HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1()); HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
mask->ChangeRepresentation(Representation::Integer32()); mask->ChangeRepresentation(Representation::Integer32());
...@@ -1700,8 +1690,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, ...@@ -1700,8 +1690,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset)); AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset));
key_index->ClearFlag(HValue::kCanOverflow); key_index->ClearFlag(HValue::kCanOverflow);
HValue* candidate_key = Add<HLoadKeyed>( HValue* candidate_key =
elements, key_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); Add<HLoadKeyed>(elements, key_index, nullptr, FAST_ELEMENTS);
IfBuilder if_undefined(this); IfBuilder if_undefined(this);
if_undefined.If<HCompareObjectEqAndBranch>(candidate_key, if_undefined.If<HCompareObjectEqAndBranch>(candidate_key,
graph()->GetConstantUndefined()); graph()->GetConstantUndefined());
...@@ -1727,8 +1717,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, ...@@ -1727,8 +1717,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
if_update_with_internalized.IfNot<HIsSmiAndBranch>(candidate_key); if_update_with_internalized.IfNot<HIsSmiAndBranch>(candidate_key);
if_update_with_internalized.And(); if_update_with_internalized.And();
HValue* map = AddLoadMap(candidate_key, smi_check); HValue* map = AddLoadMap(candidate_key, smi_check);
HValue* instance_type = Add<HLoadNamedField>( HValue* instance_type =
map, static_cast<HValue*>(NULL), HObjectAccess::ForMapInstanceType()); Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
HValue* not_internalized_bit = AddUncasted<HBitwise>( HValue* not_internalized_bit = AddUncasted<HBitwise>(
Token::BIT_AND, instance_type, Token::BIT_AND, instance_type,
Add<HConstant>(static_cast<int>(kIsNotInternalizedMask))); Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
...@@ -1755,8 +1745,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, ...@@ -1755,8 +1745,8 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
HValue* details_index = HValue* details_index =
AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2)); AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2));
details_index->ClearFlag(HValue::kCanOverflow); details_index->ClearFlag(HValue::kCanOverflow);
HValue* details = Add<HLoadKeyed>( HValue* details =
elements, details_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); Add<HLoadKeyed>(elements, details_index, nullptr, FAST_ELEMENTS);
int details_mask = PropertyDetails::TypeField::kMask | int details_mask = PropertyDetails::TypeField::kMask |
PropertyDetails::DeletedField::kMask; PropertyDetails::DeletedField::kMask;
details = AddUncasted<HBitwise>(Token::BIT_AND, details, details = AddUncasted<HBitwise>(Token::BIT_AND, details,
...@@ -1768,8 +1758,7 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver, ...@@ -1768,8 +1758,7 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
HValue* result_index = HValue* result_index =
AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1)); AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1));
result_index->ClearFlag(HValue::kCanOverflow); result_index->ClearFlag(HValue::kCanOverflow);
Push(Add<HLoadKeyed>(elements, result_index, static_cast<HValue*>(NULL), Push(Add<HLoadKeyed>(elements, result_index, nullptr, FAST_ELEMENTS));
FAST_ELEMENTS));
details_compare.Else(); details_compare.Else();
Add<HPushArguments>(receiver, key); Add<HPushArguments>(receiver, key);
Push(Add<HCallRuntime>(isolate()->factory()->empty_string(), Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
...@@ -1821,15 +1810,14 @@ HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length, ...@@ -1821,15 +1810,14 @@ HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length,
// Initialize the JSRegExpResult header. // Initialize the JSRegExpResult header.
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HValue* native_context = Add<HLoadNamedField>( HValue* native_context = Add<HLoadNamedField>(
global_object, static_cast<HValue*>(NULL), global_object, nullptr, HObjectAccess::ForGlobalObjectNativeContext());
HObjectAccess::ForGlobalObjectNativeContext());
Add<HStoreNamedField>( Add<HStoreNamedField>(
result, HObjectAccess::ForMap(), result, HObjectAccess::ForMap(),
Add<HLoadNamedField>( Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL), native_context, nullptr,
HObjectAccess::ForContextSlot(Context::REGEXP_RESULT_MAP_INDEX))); HObjectAccess::ForContextSlot(Context::REGEXP_RESULT_MAP_INDEX)));
HConstant* empty_fixed_array = HConstant* empty_fixed_array =
Add<HConstant>(isolate()->factory()->empty_fixed_array()); Add<HConstant>(isolate()->factory()->empty_fixed_array());
...@@ -1908,8 +1896,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) { ...@@ -1908,8 +1896,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
// Load the key. // Load the key.
HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1()); HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1());
HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, nullptr,
static_cast<HValue*>(NULL),
FAST_ELEMENTS, ALLOW_RETURN_HOLE); FAST_ELEMENTS, ALLOW_RETURN_HOLE);
// Check if object == key. // Check if object == key.
...@@ -1945,8 +1932,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) { ...@@ -1945,8 +1932,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
// Load the key. // Load the key.
HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1()); HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1());
HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, nullptr,
static_cast<HValue*>(NULL),
FAST_ELEMENTS, ALLOW_RETURN_HOLE); FAST_ELEMENTS, ALLOW_RETURN_HOLE);
// Check if the key is a heap number and compare it with the object. // Check if the key is a heap number and compare it with the object.
...@@ -1999,8 +1985,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) { ...@@ -1999,8 +1985,7 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
// Load the value in case of cache hit. // Load the value in case of cache hit.
HValue* key_index = Pop(); HValue* key_index = Pop();
HValue* value_index = AddUncasted<HAdd>(key_index, graph()->GetConstant1()); HValue* value_index = AddUncasted<HAdd>(key_index, graph()->GetConstant1());
Push(Add<HLoadKeyed>(number_string_cache, value_index, Push(Add<HLoadKeyed>(number_string_cache, value_index, nullptr,
static_cast<HValue*>(NULL),
FAST_ELEMENTS, ALLOW_RETURN_HOLE)); FAST_ELEMENTS, ALLOW_RETURN_HOLE));
} }
if_found.Else(); if_found.Else();
...@@ -2440,8 +2425,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( ...@@ -2440,8 +2425,7 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
HValue* backing_store; HValue* backing_store;
if (IsExternalArrayElementsKind(elements_kind)) { if (IsExternalArrayElementsKind(elements_kind)) {
backing_store = Add<HLoadNamedField>( backing_store = Add<HLoadNamedField>(
elements, static_cast<HValue*>(NULL), elements, nullptr, HObjectAccess::ForExternalArrayExternalPointer());
HObjectAccess::ForExternalArrayExternalPointer());
} else { } else {
backing_store = elements; backing_store = elements;
} }
...@@ -2847,8 +2831,7 @@ void HGraphBuilder::BuildCopyProperties(HValue* from_properties, ...@@ -2847,8 +2831,7 @@ void HGraphBuilder::BuildCopyProperties(HValue* from_properties,
key = AddUncasted<HSub>(key, graph()->GetConstant1()); key = AddUncasted<HSub>(key, graph()->GetConstant1());
key->ClearFlag(HValue::kCanOverflow); key->ClearFlag(HValue::kCanOverflow);
HValue* element = HValue* element = Add<HLoadKeyed>(from_properties, key, nullptr, kind);
Add<HLoadKeyed>(from_properties, key, static_cast<HValue*>(NULL), kind);
Add<HStoreKeyed>(to_properties, key, element, kind); Add<HStoreKeyed>(to_properties, key, element, kind);
...@@ -2888,8 +2871,7 @@ void HGraphBuilder::BuildCopyElements(HValue* from_elements, ...@@ -2888,8 +2871,7 @@ void HGraphBuilder::BuildCopyElements(HValue* from_elements,
for (int i = 0; i < constant_capacity; i++) { for (int i = 0; i < constant_capacity; i++) {
HValue* key_constant = Add<HConstant>(i); HValue* key_constant = Add<HConstant>(i);
HInstruction* value = Add<HLoadKeyed>(from_elements, key_constant, HInstruction* value = Add<HLoadKeyed>(from_elements, key_constant,
static_cast<HValue*>(NULL), nullptr, from_elements_kind);
from_elements_kind);
Add<HStoreKeyed>(to_elements, key_constant, value, to_elements_kind); Add<HStoreKeyed>(to_elements, key_constant, value, to_elements_kind);
} }
} else { } else {
...@@ -2907,10 +2889,8 @@ void HGraphBuilder::BuildCopyElements(HValue* from_elements, ...@@ -2907,10 +2889,8 @@ void HGraphBuilder::BuildCopyElements(HValue* from_elements,
key = AddUncasted<HSub>(key, graph()->GetConstant1()); key = AddUncasted<HSub>(key, graph()->GetConstant1());
key->ClearFlag(HValue::kCanOverflow); key->ClearFlag(HValue::kCanOverflow);
HValue* element = Add<HLoadKeyed>(from_elements, key, HValue* element = Add<HLoadKeyed>(from_elements, key, nullptr,
static_cast<HValue*>(NULL), from_elements_kind, ALLOW_RETURN_HOLE);
from_elements_kind,
ALLOW_RETURN_HOLE);
ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) && ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) &&
IsFastSmiElementsKind(to_elements_kind)) IsFastSmiElementsKind(to_elements_kind))
...@@ -3021,9 +3001,9 @@ HValue* HGraphBuilder::BuildCloneShallowArrayNonEmpty(HValue* boilerplate, ...@@ -3021,9 +3001,9 @@ HValue* HGraphBuilder::BuildCloneShallowArrayNonEmpty(HValue* boilerplate,
// Copy the elements array header. // Copy the elements array header.
for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) { for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) {
HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i); HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i);
Add<HStoreNamedField>(elements, access, Add<HStoreNamedField>(
Add<HLoadNamedField>(boilerplate_elements, elements, access,
static_cast<HValue*>(NULL), access)); Add<HLoadNamedField>(boilerplate_elements, nullptr, access));
} }
// And the result of the length // And the result of the length
...@@ -3102,10 +3082,10 @@ void HGraphBuilder::BuildCreateAllocationMemento( ...@@ -3102,10 +3082,10 @@ void HGraphBuilder::BuildCreateAllocationMemento(
HObjectAccess::ForAllocationMementoSite(), HObjectAccess::ForAllocationMementoSite(),
allocation_site); allocation_site);
if (FLAG_allocation_site_pretenuring) { if (FLAG_allocation_site_pretenuring) {
HValue* memento_create_count = Add<HLoadNamedField>( HValue* memento_create_count =
allocation_site, static_cast<HValue*>(NULL), Add<HLoadNamedField>(allocation_site, nullptr,
HObjectAccess::ForAllocationSiteOffset( HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kPretenureCreateCountOffset)); AllocationSite::kPretenureCreateCountOffset));
memento_create_count = AddUncasted<HAdd>( memento_create_count = AddUncasted<HAdd>(
memento_create_count, graph()->GetConstant1()); memento_create_count, graph()->GetConstant1());
// This smi value is reset to zero after every gc, overflow isn't a problem // This smi value is reset to zero after every gc, overflow isn't a problem
...@@ -3120,25 +3100,23 @@ void HGraphBuilder::BuildCreateAllocationMemento( ...@@ -3120,25 +3100,23 @@ void HGraphBuilder::BuildCreateAllocationMemento(
HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
// Get the global object, then the native context // Get the global object, then the native context
HInstruction* context = HInstruction* context = Add<HLoadNamedField>(
Add<HLoadNamedField>(closure, static_cast<HValue*>(NULL), closure, nullptr, HObjectAccess::ForFunctionContextPointer());
HObjectAccess::ForFunctionContextPointer());
HInstruction* global_object = Add<HLoadNamedField>( HInstruction* global_object = Add<HLoadNamedField>(
context, static_cast<HValue*>(NULL), context, nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset( HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
GlobalObject::kNativeContextOffset); GlobalObject::kNativeContextOffset);
return Add<HLoadNamedField>( return Add<HLoadNamedField>(global_object, nullptr, access);
global_object, static_cast<HValue*>(NULL), access);
} }
HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) { HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) {
HValue* native_context = BuildGetNativeContext(); HValue* native_context = BuildGetNativeContext();
HValue* script_context_table = Add<HLoadNamedField>( HValue* script_context_table = Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL), native_context, nullptr,
HObjectAccess::ForContextSlot(Context::SCRIPT_CONTEXT_TABLE_INDEX)); HObjectAccess::ForContextSlot(Context::SCRIPT_CONTEXT_TABLE_INDEX));
return Add<HLoadNamedField>(script_context_table, static_cast<HValue*>(NULL), return Add<HLoadNamedField>(script_context_table, nullptr,
HObjectAccess::ForScriptContext(context_index)); HObjectAccess::ForScriptContext(context_index));
} }
...@@ -3146,12 +3124,11 @@ HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) { ...@@ -3146,12 +3124,11 @@ HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) {
HInstruction* HGraphBuilder::BuildGetNativeContext() { HInstruction* HGraphBuilder::BuildGetNativeContext() {
// Get the global object, then the native context // Get the global object, then the native context
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
return Add<HLoadNamedField>( return Add<HLoadNamedField>(global_object, nullptr,
global_object, static_cast<HValue*>(NULL), HObjectAccess::ForObservableJSObjectOffset(
HObjectAccess::ForObservableJSObjectOffset( GlobalObject::kNativeContextOffset));
GlobalObject::kNativeContextOffset));
} }
...@@ -3159,8 +3136,7 @@ HInstruction* HGraphBuilder::BuildGetArrayFunction() { ...@@ -3159,8 +3136,7 @@ HInstruction* HGraphBuilder::BuildGetArrayFunction() {
HInstruction* native_context = BuildGetNativeContext(); HInstruction* native_context = BuildGetNativeContext();
HInstruction* index = HInstruction* index =
Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX)); Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX));
return Add<HLoadKeyed>( return Add<HLoadKeyed>(native_context, index, nullptr, FAST_ELEMENTS);
native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS);
} }
...@@ -3205,8 +3181,8 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() { ...@@ -3205,8 +3181,8 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
// No need for a context lookup if the kind_ matches the initial // No need for a context lookup if the kind_ matches the initial
// map, because we can just load the map in that case. // map, because we can just load the map in that case.
HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap();
return builder()->Add<HLoadNamedField>( return builder()->Add<HLoadNamedField>(constructor_function_, nullptr,
constructor_function_, static_cast<HValue*>(NULL), access); access);
} }
// TODO(mvstanton): we should always have a constructor function if we // TODO(mvstanton): we should always have a constructor function if we
...@@ -3218,21 +3194,21 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() { ...@@ -3218,21 +3194,21 @@ HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
HInstruction* index = builder()->Add<HConstant>( HInstruction* index = builder()->Add<HConstant>(
static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX));
HInstruction* map_array = builder()->Add<HLoadKeyed>( HInstruction* map_array =
native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); builder()->Add<HLoadKeyed>(native_context, index, nullptr, FAST_ELEMENTS);
HInstruction* kind_index = builder()->Add<HConstant>(kind_); HInstruction* kind_index = builder()->Add<HConstant>(kind_);
return builder()->Add<HLoadKeyed>( return builder()->Add<HLoadKeyed>(map_array, kind_index, nullptr,
map_array, kind_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); FAST_ELEMENTS);
} }
HValue* HGraphBuilder::JSArrayBuilder::EmitInternalMapCode() { HValue* HGraphBuilder::JSArrayBuilder::EmitInternalMapCode() {
// Find the map near the constructor function // Find the map near the constructor function
HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap();
return builder()->Add<HLoadNamedField>( return builder()->Add<HLoadNamedField>(constructor_function_, nullptr,
constructor_function_, static_cast<HValue*>(NULL), access); access);
} }
...@@ -3331,16 +3307,14 @@ HAllocate* HGraphBuilder::JSArrayBuilder::AllocateArray( ...@@ -3331,16 +3307,14 @@ HAllocate* HGraphBuilder::JSArrayBuilder::AllocateArray(
HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) { HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) {
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset( HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
GlobalObject::kBuiltinsOffset); GlobalObject::kBuiltinsOffset);
HValue* builtins = Add<HLoadNamedField>( HValue* builtins = Add<HLoadNamedField>(global_object, nullptr, access);
global_object, static_cast<HValue*>(NULL), access);
HObjectAccess function_access = HObjectAccess::ForObservableJSObjectOffset( HObjectAccess function_access = HObjectAccess::ForObservableJSObjectOffset(
JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); JSBuiltinsObject::OffsetOfFunctionWithId(builtin));
return Add<HLoadNamedField>( return Add<HLoadNamedField>(builtins, nullptr, function_access);
builtins, static_cast<HValue*>(NULL), function_access);
} }
...@@ -4587,7 +4561,7 @@ void HOptimizedGraphBuilder::VisitBlock(Block* stmt) { ...@@ -4587,7 +4561,7 @@ void HOptimizedGraphBuilder::VisitBlock(Block* stmt) {
if (scope != NULL && current_block() != NULL) { if (scope != NULL && current_block() != NULL) {
HValue* inner_context = environment()->context(); HValue* inner_context = environment()->context();
HValue* outer_context = Add<HLoadNamedField>( HValue* outer_context = Add<HLoadNamedField>(
inner_context, static_cast<HValue*>(NULL), inner_context, nullptr,
HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
HInstruction* instr = Add<HStoreFrameContext>(outer_context); HInstruction* instr = Add<HStoreFrameContext>(outer_context);
...@@ -4718,7 +4692,7 @@ void HOptimizedGraphBuilder::VisitContinueStatement( ...@@ -4718,7 +4692,7 @@ void HOptimizedGraphBuilder::VisitContinueStatement(
if (context_pop_count > 0) { if (context_pop_count > 0) {
while (context_pop_count-- > 0) { while (context_pop_count-- > 0) {
HInstruction* context_instruction = Add<HLoadNamedField>( HInstruction* context_instruction = Add<HLoadNamedField>(
context, static_cast<HValue*>(NULL), context, nullptr,
HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
context = context_instruction; context = context_instruction;
} }
...@@ -4750,7 +4724,7 @@ void HOptimizedGraphBuilder::VisitBreakStatement(BreakStatement* stmt) { ...@@ -4750,7 +4724,7 @@ void HOptimizedGraphBuilder::VisitBreakStatement(BreakStatement* stmt) {
if (context_pop_count > 0) { if (context_pop_count > 0) {
while (context_pop_count-- > 0) { while (context_pop_count-- > 0) {
HInstruction* context_instruction = Add<HLoadNamedField>( HInstruction* context_instruction = Add<HLoadNamedField>(
context, static_cast<HValue*>(NULL), context, nullptr,
HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
context = context_instruction; context = context_instruction;
} }
...@@ -5350,7 +5324,7 @@ HValue* HOptimizedGraphBuilder::BuildContextChainWalk(Variable* var) { ...@@ -5350,7 +5324,7 @@ HValue* HOptimizedGraphBuilder::BuildContextChainWalk(Variable* var) {
int length = scope()->ContextChainLength(var->scope()); int length = scope()->ContextChainLength(var->scope());
while (length-- > 0) { while (length-- > 0) {
context = Add<HLoadNamedField>( context = Add<HLoadNamedField>(
context, static_cast<HValue*>(NULL), context, nullptr,
HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX)); HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
} }
return context; return context;
...@@ -5392,7 +5366,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { ...@@ -5392,7 +5366,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
Handle<Context> script_context = ScriptContextTable::GetContext( Handle<Context> script_context = ScriptContextTable::GetContext(
script_contexts, lookup.context_index); script_contexts, lookup.context_index);
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
Add<HConstant>(script_context), static_cast<HValue*>(NULL), Add<HConstant>(script_context), nullptr,
HObjectAccess::ForContextSlot(lookup.slot_index)); HObjectAccess::ForContextSlot(lookup.slot_index));
return ast_context()->ReturnInstruction(result, expr->id()); return ast_context()->ReturnInstruction(result, expr->id());
} }
...@@ -5420,7 +5394,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) { ...@@ -5420,7 +5394,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
} }
} else { } else {
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HLoadGlobalGeneric* instr = HLoadGlobalGeneric* instr =
New<HLoadGlobalGeneric>(global_object, New<HLoadGlobalGeneric>(global_object,
...@@ -5872,7 +5846,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( ...@@ -5872,7 +5846,7 @@ HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField(
(!FLAG_unbox_double_fields || !access.IsInobject())) { (!FLAG_unbox_double_fields || !access.IsInobject())) {
// Load the heap number. // Load the heap number.
checked_object = Add<HLoadNamedField>( checked_object = Add<HLoadNamedField>(
checked_object, static_cast<HValue*>(NULL), checked_object, nullptr,
access.WithRepresentation(Representation::Tagged())); access.WithRepresentation(Representation::Tagged()));
// Load the double value from it. // Load the double value from it.
access = HObjectAccess::ForHeapNumberValue(); access = HObjectAccess::ForHeapNumberValue();
...@@ -5924,8 +5898,8 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( ...@@ -5924,8 +5898,8 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
heap_number); heap_number);
} else { } else {
// Already holds a HeapNumber; load the box and write its value field. // Already holds a HeapNumber; load the box and write its value field.
HInstruction* heap_number = Add<HLoadNamedField>( HInstruction* heap_number =
checked_object, static_cast<HValue*>(NULL), heap_number_access); Add<HLoadNamedField>(checked_object, nullptr, heap_number_access);
instr = New<HStoreNamedField>(heap_number, instr = New<HStoreNamedField>(heap_number,
HObjectAccess::ForHeapNumberValue(), HObjectAccess::ForHeapNumberValue(),
value, STORE_TO_INITIALIZED_ENTRY); value, STORE_TO_INITIALIZED_ENTRY);
...@@ -6589,7 +6563,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( ...@@ -6589,7 +6563,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
} }
} else { } else {
HValue* global_object = Add<HLoadNamedField>( HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL), context(), nullptr,
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
HStoreNamedGeneric* instr = HStoreNamedGeneric* instr =
Add<HStoreNamedGeneric>(global_object, var->name(), Add<HStoreNamedGeneric>(global_object, var->name(),
...@@ -6873,9 +6847,8 @@ HInstruction* HGraphBuilder::AddLoadStringInstanceType(HValue* string) { ...@@ -6873,9 +6847,8 @@ HInstruction* HGraphBuilder::AddLoadStringInstanceType(HValue* string) {
} }
} }
return Add<HLoadNamedField>( return Add<HLoadNamedField>(
Add<HLoadNamedField>(string, static_cast<HValue*>(NULL), Add<HLoadNamedField>(string, nullptr, HObjectAccess::ForMap()), nullptr,
HObjectAccess::ForMap()), HObjectAccess::ForMapInstanceType());
static_cast<HValue*>(NULL), HObjectAccess::ForMapInstanceType());
} }
...@@ -6886,7 +6859,7 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) { ...@@ -6886,7 +6859,7 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) {
return Add<HConstant>(c_string->StringValue()->length()); return Add<HConstant>(c_string->StringValue()->length());
} }
} }
return Add<HLoadNamedField>(string, static_cast<HValue*>(NULL), return Add<HLoadNamedField>(string, nullptr,
HObjectAccess::ForStringLength()); HObjectAccess::ForStringLength());
} }
...@@ -7577,8 +7550,7 @@ HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( ...@@ -7577,8 +7550,7 @@ HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction(
} else { } else {
HValue* param_count_value = Add<HConstant>(formal_parameter_count); HValue* param_count_value = Add<HConstant>(formal_parameter_count);
HValue* context = Add<HLoadNamedField>( HValue* context = Add<HLoadNamedField>(
target, static_cast<HValue*>(NULL), target, nullptr, HObjectAccess::ForFunctionContextPointer());
HObjectAccess::ForFunctionContextPointer());
return NewArgumentAdaptorCall(target, context, return NewArgumentAdaptorCall(target, context,
argument_count, param_count_value); argument_count, param_count_value);
} }
...@@ -8365,9 +8337,9 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( ...@@ -8365,9 +8337,9 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
HValue* receiver = Pop(); HValue* receiver = Pop();
HValue* checked_object = AddCheckMap(receiver, receiver_map); HValue* checked_object = AddCheckMap(receiver, receiver_map);
HValue* length = Add<HLoadNamedField>( HValue* length =
checked_object, static_cast<HValue*>(NULL), Add<HLoadNamedField>(checked_object, nullptr,
HObjectAccess::ForArrayLength(elements_kind)); HObjectAccess::ForArrayLength(elements_kind));
Drop(1); // Function. Drop(1); // Function.
...@@ -8448,8 +8420,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( ...@@ -8448,8 +8420,8 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
{ {
NoObservableSideEffectsScope scope(this); NoObservableSideEffectsScope scope(this);
length = Add<HLoadNamedField>(array, static_cast<HValue*>(NULL), length = Add<HLoadNamedField>(
HObjectAccess::ForArrayLength(elements_kind)); array, nullptr, HObjectAccess::ForArrayLength(elements_kind));
new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); new_size = AddUncasted<HAdd>(length, graph()->GetConstant1());
...@@ -8502,8 +8474,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall( ...@@ -8502,8 +8474,7 @@ bool HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(
NoObservableSideEffectsScope scope(this); NoObservableSideEffectsScope scope(this);
HValue* length = Add<HLoadNamedField>( HValue* length = Add<HLoadNamedField>(
receiver, static_cast<HValue*>(NULL), receiver, nullptr, HObjectAccess::ForArrayLength(kind));
HObjectAccess::ForArrayLength(kind));
IfBuilder if_lengthiszero(this); IfBuilder if_lengthiszero(this);
HValue* lengthiszero = if_lengthiszero.If<HCompareNumericAndBranch>( HValue* lengthiszero = if_lengthiszero.If<HCompareNumericAndBranch>(
...@@ -9010,9 +8981,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver, ...@@ -9010,9 +8981,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver,
LoopBuilder loop(this, context(), direction); LoopBuilder loop(this, context(), direction);
{ {
HValue* index = loop.BeginBody(initial, terminating, token); HValue* index = loop.BeginBody(initial, terminating, token);
HValue* element = AddUncasted<HLoadKeyed>( HValue* element = AddUncasted<HLoadKeyed>(elements, index, nullptr, kind,
elements, index, static_cast<HValue*>(NULL), ALLOW_RETURN_HOLE);
kind, ALLOW_RETURN_HOLE);
IfBuilder if_issame(this); IfBuilder if_issame(this);
if_issame.If<HCompareNumericAndBranch>(element, search_element, if_issame.If<HCompareNumericAndBranch>(element, search_element,
Token::EQ_STRICT); Token::EQ_STRICT);
...@@ -9033,9 +9003,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver, ...@@ -9033,9 +9003,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver,
LoopBuilder loop(this, context(), direction); LoopBuilder loop(this, context(), direction);
{ {
HValue* index = loop.BeginBody(initial, terminating, token); HValue* index = loop.BeginBody(initial, terminating, token);
HValue* element = AddUncasted<HLoadKeyed>( HValue* element = AddUncasted<HLoadKeyed>(elements, index, nullptr,
elements, index, static_cast<HValue*>(NULL), kind, ALLOW_RETURN_HOLE);
kind, ALLOW_RETURN_HOLE);
IfBuilder if_issame(this); IfBuilder if_issame(this);
if_issame.If<HIsStringAndBranch>(element); if_issame.If<HIsStringAndBranch>(element);
if_issame.AndIf<HStringCompareAndBranch>( if_issame.AndIf<HStringCompareAndBranch>(
...@@ -9064,9 +9033,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver, ...@@ -9064,9 +9033,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver,
LoopBuilder loop(this, context(), direction); LoopBuilder loop(this, context(), direction);
{ {
HValue* index = loop.BeginBody(initial, terminating, token); HValue* index = loop.BeginBody(initial, terminating, token);
HValue* element = AddUncasted<HLoadKeyed>( HValue* element = AddUncasted<HLoadKeyed>(elements, index, nullptr,
elements, index, static_cast<HValue*>(NULL), kind, ALLOW_RETURN_HOLE);
kind, ALLOW_RETURN_HOLE);
IfBuilder if_element_isnumber(this); IfBuilder if_element_isnumber(this);
if_element_isnumber.If<HIsSmiAndBranch>(element); if_element_isnumber.If<HIsSmiAndBranch>(element);
...@@ -9097,9 +9065,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver, ...@@ -9097,9 +9065,8 @@ HValue* HOptimizedGraphBuilder::BuildArrayIndexOf(HValue* receiver,
LoopBuilder loop(this, context(), direction); LoopBuilder loop(this, context(), direction);
{ {
HValue* index = loop.BeginBody(initial, terminating, token); HValue* index = loop.BeginBody(initial, terminating, token);
HValue* element = AddUncasted<HLoadKeyed>( HValue* element = AddUncasted<HLoadKeyed>(elements, index, nullptr,
elements, index, static_cast<HValue*>(NULL), kind, ALLOW_RETURN_HOLE);
kind, ALLOW_RETURN_HOLE);
IfBuilder if_issame(this); IfBuilder if_issame(this);
if_issame.If<HCompareObjectEqAndBranch>( if_issame.If<HCompareObjectEqAndBranch>(
element, search_element); element, search_element);
...@@ -9620,11 +9587,9 @@ void HGraphBuilder::BuildArrayBufferViewInitialization( ...@@ -9620,11 +9587,9 @@ void HGraphBuilder::BuildArrayBufferViewInitialization(
HObjectAccess::ForJSArrayBufferViewBuffer(), buffer); HObjectAccess::ForJSArrayBufferViewBuffer(), buffer);
HObjectAccess weak_first_view_access = HObjectAccess weak_first_view_access =
HObjectAccess::ForJSArrayBufferWeakFirstView(); HObjectAccess::ForJSArrayBufferWeakFirstView();
Add<HStoreNamedField>(obj, Add<HStoreNamedField>(
HObjectAccess::ForJSArrayBufferViewWeakNext(), obj, HObjectAccess::ForJSArrayBufferViewWeakNext(),
Add<HLoadNamedField>(buffer, Add<HLoadNamedField>(buffer, nullptr, weak_first_view_access));
static_cast<HValue*>(NULL),
weak_first_view_access));
Add<HStoreNamedField>(buffer, weak_first_view_access, obj); Add<HStoreNamedField>(buffer, weak_first_view_access, obj);
} else { } else {
Add<HStoreNamedField>( Add<HStoreNamedField>(
...@@ -9704,8 +9669,7 @@ HValue* HOptimizedGraphBuilder::BuildAllocateExternalElements( ...@@ -9704,8 +9669,7 @@ HValue* HOptimizedGraphBuilder::BuildAllocateExternalElements(
HObjectAccess::ForFixedArrayLength(), length); HObjectAccess::ForFixedArrayLength(), length);
HValue* backing_store = Add<HLoadNamedField>( HValue* backing_store = Add<HLoadNamedField>(
buffer, static_cast<HValue*>(NULL), buffer, nullptr, HObjectAccess::ForJSArrayBufferBackingStore());
HObjectAccess::ForJSArrayBufferBackingStore());
HValue* typed_array_start; HValue* typed_array_start;
if (is_zero_byte_offset) { if (is_zero_byte_offset) {
...@@ -9923,9 +9887,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferGetByteLength( ...@@ -9923,9 +9887,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferGetByteLength(
CHECK_ALIVE(VisitForValue(expr->arguments()->at(0))); CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
HValue* buffer = Pop(); HValue* buffer = Pop();
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
buffer, buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength());
static_cast<HValue*>(NULL),
HObjectAccess::ForJSArrayBufferByteLength());
return ast_context()->ReturnInstruction(result, expr->id()); return ast_context()->ReturnInstruction(result, expr->id());
} }
...@@ -9936,9 +9898,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteLength( ...@@ -9936,9 +9898,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteLength(
CHECK_ALIVE(VisitForValue(expr->arguments()->at(0))); CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
HValue* buffer = Pop(); HValue* buffer = Pop();
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
buffer, buffer, nullptr, HObjectAccess::ForJSArrayBufferViewByteLength());
static_cast<HValue*>(NULL),
HObjectAccess::ForJSArrayBufferViewByteLength());
return ast_context()->ReturnInstruction(result, expr->id()); return ast_context()->ReturnInstruction(result, expr->id());
} }
...@@ -9949,9 +9909,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteOffset( ...@@ -9949,9 +9909,7 @@ void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteOffset(
CHECK_ALIVE(VisitForValue(expr->arguments()->at(0))); CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
HValue* buffer = Pop(); HValue* buffer = Pop();
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
buffer, buffer, nullptr, HObjectAccess::ForJSArrayBufferViewByteOffset());
static_cast<HValue*>(NULL),
HObjectAccess::ForJSArrayBufferViewByteOffset());
return ast_context()->ReturnInstruction(result, expr->id()); return ast_context()->ReturnInstruction(result, expr->id());
} }
...@@ -9962,9 +9920,7 @@ void HOptimizedGraphBuilder::GenerateTypedArrayGetLength( ...@@ -9962,9 +9920,7 @@ void HOptimizedGraphBuilder::GenerateTypedArrayGetLength(
CHECK_ALIVE(VisitForValue(expr->arguments()->at(0))); CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
HValue* buffer = Pop(); HValue* buffer = Pop();
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
buffer, buffer, nullptr, HObjectAccess::ForJSTypedArrayLength());
static_cast<HValue*>(NULL),
HObjectAccess::ForJSTypedArrayLength());
return ast_context()->ReturnInstruction(result, expr->id()); return ast_context()->ReturnInstruction(result, expr->id());
} }
...@@ -11371,10 +11327,8 @@ void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray( ...@@ -11371,10 +11327,8 @@ void HOptimizedGraphBuilder::BuildEmitFixedDoubleArray(
int elements_length = elements->length(); int elements_length = elements->length();
for (int i = 0; i < elements_length; i++) { for (int i = 0; i < elements_length; i++) {
HValue* key_constant = Add<HConstant>(i); HValue* key_constant = Add<HConstant>(i);
HInstruction* value_instruction = HInstruction* value_instruction = Add<HLoadKeyed>(
Add<HLoadKeyed>(boilerplate_elements, key_constant, boilerplate_elements, key_constant, nullptr, kind, ALLOW_RETURN_HOLE);
static_cast<HValue*>(NULL), kind,
ALLOW_RETURN_HOLE);
HInstruction* store = Add<HStoreKeyed>(object_elements, key_constant, HInstruction* store = Add<HStoreKeyed>(object_elements, key_constant,
value_instruction, kind); value_instruction, kind);
store->SetFlag(HValue::kAllowUndefinedAsNaN); store->SetFlag(HValue::kAllowUndefinedAsNaN);
...@@ -11403,9 +11357,9 @@ void HOptimizedGraphBuilder::BuildEmitFixedArray( ...@@ -11403,9 +11357,9 @@ void HOptimizedGraphBuilder::BuildEmitFixedArray(
} else { } else {
ElementsKind copy_kind = ElementsKind copy_kind =
kind == FAST_HOLEY_SMI_ELEMENTS ? FAST_HOLEY_ELEMENTS : kind; kind == FAST_HOLEY_SMI_ELEMENTS ? FAST_HOLEY_ELEMENTS : kind;
HInstruction* value_instruction = Add<HLoadKeyed>( HInstruction* value_instruction =
boilerplate_elements, key_constant, static_cast<HValue*>(NULL), Add<HLoadKeyed>(boilerplate_elements, key_constant, nullptr,
copy_kind, ALLOW_RETURN_HOLE); copy_kind, ALLOW_RETURN_HOLE);
Add<HStoreKeyed>(object_elements, key_constant, value_instruction, Add<HStoreKeyed>(object_elements, key_constant, value_instruction,
copy_kind); copy_kind);
} }
...@@ -11656,8 +11610,8 @@ void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) { ...@@ -11656,8 +11610,8 @@ void HOptimizedGraphBuilder::GenerateIsJSProxy(CallRuntime* call) {
HValue* smicheck = if_proxy.IfNot<HIsSmiAndBranch>(value); HValue* smicheck = if_proxy.IfNot<HIsSmiAndBranch>(value);
if_proxy.And(); if_proxy.And();
HValue* map = Add<HLoadNamedField>(value, smicheck, HObjectAccess::ForMap()); HValue* map = Add<HLoadNamedField>(value, smicheck, HObjectAccess::ForMap());
HValue* instance_type = Add<HLoadNamedField>( HValue* instance_type =
map, static_cast<HValue*>(NULL), HObjectAccess::ForMapInstanceType()); Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
if_proxy.If<HCompareNumericAndBranch>( if_proxy.If<HCompareNumericAndBranch>(
instance_type, Add<HConstant>(FIRST_JS_PROXY_TYPE), Token::GTE); instance_type, Add<HConstant>(FIRST_JS_PROXY_TYPE), Token::GTE);
if_proxy.And(); if_proxy.And();
...@@ -12134,8 +12088,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableHashToEntry( ...@@ -12134,8 +12088,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableHashToEntry(
HValue* entry_index = AddUncasted<HAdd>( HValue* entry_index = AddUncasted<HAdd>(
bucket, Add<HConstant>(CollectionType::kHashTableStartIndex)); bucket, Add<HConstant>(CollectionType::kHashTableStartIndex));
entry_index->ClearFlag(HValue::kCanOverflow); entry_index->ClearFlag(HValue::kCanOverflow);
HValue* entry = Add<HLoadKeyed>(table, entry_index, HValue* entry = Add<HLoadKeyed>(table, entry_index, nullptr, FAST_ELEMENTS);
static_cast<HValue*>(NULL), FAST_ELEMENTS);
entry->set_type(HType::Smi()); entry->set_type(HType::Smi());
return entry; return entry;
} }
...@@ -12161,7 +12114,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table, ...@@ -12161,7 +12114,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table,
HValue* key, HValue* key,
HValue* hash) { HValue* hash) {
HValue* num_buckets = Add<HLoadNamedField>( HValue* num_buckets = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfBuckets<CollectionType>()); HObjectAccess::ForOrderedHashTableNumberOfBuckets<CollectionType>());
HValue* entry = BuildOrderedHashTableHashToEntry<CollectionType>(table, hash, HValue* entry = BuildOrderedHashTableHashToEntry<CollectionType>(table, hash,
...@@ -12185,8 +12138,8 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table, ...@@ -12185,8 +12138,8 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table,
HValue* key_index = HValue* key_index =
BuildOrderedHashTableEntryToIndex<CollectionType>(entry, num_buckets); BuildOrderedHashTableEntryToIndex<CollectionType>(entry, num_buckets);
HValue* candidate_key = Add<HLoadKeyed>( HValue* candidate_key =
table, key_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); Add<HLoadKeyed>(table, key_index, nullptr, FAST_ELEMENTS);
{ {
IfBuilder if_keys_equal(this); IfBuilder if_keys_equal(this);
...@@ -12202,8 +12155,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table, ...@@ -12202,8 +12155,7 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableFindEntry(HValue* table,
HValue* chain_index = AddUncasted<HAdd>( HValue* chain_index = AddUncasted<HAdd>(
key_index, Add<HConstant>(CollectionType::kChainOffset)); key_index, Add<HConstant>(CollectionType::kChainOffset));
chain_index->ClearFlag(HValue::kCanOverflow); chain_index->ClearFlag(HValue::kCanOverflow);
entry = Add<HLoadKeyed>(table, chain_index, static_cast<HValue*>(NULL), entry = Add<HLoadKeyed>(table, chain_index, nullptr, FAST_ELEMENTS);
FAST_ELEMENTS);
entry->set_type(HType::Smi()); entry->set_type(HType::Smi());
Push(entry); Push(entry);
...@@ -12229,9 +12181,8 @@ void HOptimizedGraphBuilder::GenerateMapGet(CallRuntime* call) { ...@@ -12229,9 +12181,8 @@ void HOptimizedGraphBuilder::GenerateMapGet(CallRuntime* call) {
IfBuilder string_checker(this, &continuation); IfBuilder string_checker(this, &continuation);
string_checker.Then(); string_checker.Then();
{ {
HValue* table = HValue* table = Add<HLoadNamedField>(
Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), receiver, nullptr, HObjectAccess::ForJSCollectionTable());
HObjectAccess::ForJSCollectionTable());
HValue* key_index = HValue* key_index =
BuildOrderedHashTableFindEntry<OrderedHashMap>(table, key, hash); BuildOrderedHashTableFindEntry<OrderedHashMap>(table, key, hash);
IfBuilder if_found(this); IfBuilder if_found(this);
...@@ -12242,8 +12193,7 @@ void HOptimizedGraphBuilder::GenerateMapGet(CallRuntime* call) { ...@@ -12242,8 +12193,7 @@ void HOptimizedGraphBuilder::GenerateMapGet(CallRuntime* call) {
HValue* value_index = AddUncasted<HAdd>( HValue* value_index = AddUncasted<HAdd>(
key_index, Add<HConstant>(OrderedHashMap::kValueOffset)); key_index, Add<HConstant>(OrderedHashMap::kValueOffset));
value_index->ClearFlag(HValue::kCanOverflow); value_index->ClearFlag(HValue::kCanOverflow);
Push(Add<HLoadKeyed>(table, value_index, static_cast<HValue*>(NULL), Push(Add<HLoadKeyed>(table, value_index, nullptr, FAST_ELEMENTS));
FAST_ELEMENTS));
} }
if_found.Else(); if_found.Else();
Push(graph()->GetConstantUndefined()); Push(graph()->GetConstantUndefined());
...@@ -12266,7 +12216,7 @@ HValue* HOptimizedGraphBuilder::BuildStringHashLoadIfIsStringAndHashComputed( ...@@ -12266,7 +12216,7 @@ HValue* HOptimizedGraphBuilder::BuildStringHashLoadIfIsStringAndHashComputed(
IfBuilder string_checker(this); IfBuilder string_checker(this);
string_checker.If<HIsStringAndBranch>(object); string_checker.If<HIsStringAndBranch>(object);
string_checker.And(); string_checker.And();
HValue* hash = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), HValue* hash = Add<HLoadNamedField>(object, nullptr,
HObjectAccess::ForStringHashField()); HObjectAccess::ForStringHashField());
HValue* hash_not_computed_mask = Add<HConstant>(String::kHashNotComputedMask); HValue* hash_not_computed_mask = Add<HConstant>(String::kHashNotComputedMask);
HValue* hash_computed_test = HValue* hash_computed_test =
...@@ -12299,9 +12249,8 @@ void HOptimizedGraphBuilder::BuildJSCollectionHas( ...@@ -12299,9 +12249,8 @@ void HOptimizedGraphBuilder::BuildJSCollectionHas(
IfBuilder string_checker(this, &continuation); IfBuilder string_checker(this, &continuation);
string_checker.Then(); string_checker.Then();
{ {
HValue* table = HValue* table = Add<HLoadNamedField>(
Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), receiver, nullptr, HObjectAccess::ForJSCollectionTable());
HObjectAccess::ForJSCollectionTable());
HValue* key_index = HValue* key_index =
BuildOrderedHashTableFindEntry<CollectionType>(table, key, hash); BuildOrderedHashTableFindEntry<CollectionType>(table, key, hash);
{ {
...@@ -12342,18 +12291,17 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableAddEntry( ...@@ -12342,18 +12291,17 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableAddEntry(
HValue* table, HValue* key, HValue* hash, HValue* table, HValue* key, HValue* hash,
HIfContinuation* join_continuation) { HIfContinuation* join_continuation) {
HValue* num_buckets = Add<HLoadNamedField>( HValue* num_buckets = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfBuckets<CollectionType>()); HObjectAccess::ForOrderedHashTableNumberOfBuckets<CollectionType>());
HValue* capacity = AddUncasted<HMul>( HValue* capacity = AddUncasted<HMul>(
num_buckets, Add<HConstant>(CollectionType::kLoadFactor)); num_buckets, Add<HConstant>(CollectionType::kLoadFactor));
capacity->ClearFlag(HValue::kCanOverflow); capacity->ClearFlag(HValue::kCanOverflow);
HValue* num_elements = Add<HLoadNamedField>( HValue* num_elements = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfElements<CollectionType>()); HObjectAccess::ForOrderedHashTableNumberOfElements<CollectionType>());
HValue* num_deleted = Add<HLoadNamedField>( HValue* num_deleted = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr, HObjectAccess::ForOrderedHashTableNumberOfDeletedElements<
HObjectAccess::ForOrderedHashTableNumberOfDeletedElements< CollectionType>());
CollectionType>());
HValue* used = AddUncasted<HAdd>(num_elements, num_deleted); HValue* used = AddUncasted<HAdd>(num_elements, num_deleted);
used->ClearFlag(HValue::kCanOverflow); used->ClearFlag(HValue::kCanOverflow);
IfBuilder if_space_available(this); IfBuilder if_space_available(this);
...@@ -12367,8 +12315,8 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableAddEntry( ...@@ -12367,8 +12315,8 @@ HValue* HOptimizedGraphBuilder::BuildOrderedHashTableAddEntry(
HValue* bucket_index = AddUncasted<HAdd>( HValue* bucket_index = AddUncasted<HAdd>(
bucket, Add<HConstant>(CollectionType::kHashTableStartIndex)); bucket, Add<HConstant>(CollectionType::kHashTableStartIndex));
bucket_index->ClearFlag(HValue::kCanOverflow); bucket_index->ClearFlag(HValue::kCanOverflow);
HValue* chain_entry = Add<HLoadKeyed>( HValue* chain_entry =
table, bucket_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); Add<HLoadKeyed>(table, bucket_index, nullptr, FAST_ELEMENTS);
chain_entry->set_type(HType::Smi()); chain_entry->set_type(HType::Smi());
HValue* chain_index = AddUncasted<HAdd>( HValue* chain_index = AddUncasted<HAdd>(
...@@ -12410,7 +12358,7 @@ void HOptimizedGraphBuilder::GenerateMapSet(CallRuntime* call) { ...@@ -12410,7 +12358,7 @@ void HOptimizedGraphBuilder::GenerateMapSet(CallRuntime* call) {
IfBuilder string_checker(this, &got_string_hash); IfBuilder string_checker(this, &got_string_hash);
string_checker.Then(); string_checker.Then();
{ {
HValue* table = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* table = Add<HLoadNamedField>(receiver, nullptr,
HObjectAccess::ForJSCollectionTable()); HObjectAccess::ForJSCollectionTable());
HValue* key_index = HValue* key_index =
BuildOrderedHashTableFindEntry<OrderedHashMap>(table, key, hash); BuildOrderedHashTableFindEntry<OrderedHashMap>(table, key, hash);
...@@ -12477,7 +12425,7 @@ void HOptimizedGraphBuilder::GenerateSetAdd(CallRuntime* call) { ...@@ -12477,7 +12425,7 @@ void HOptimizedGraphBuilder::GenerateSetAdd(CallRuntime* call) {
IfBuilder string_checker(this, &got_string_hash); IfBuilder string_checker(this, &got_string_hash);
string_checker.Then(); string_checker.Then();
{ {
HValue* table = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* table = Add<HLoadNamedField>(receiver, nullptr,
HObjectAccess::ForJSCollectionTable()); HObjectAccess::ForJSCollectionTable());
HValue* key_index = HValue* key_index =
BuildOrderedHashTableFindEntry<OrderedHashSet>(table, key, hash); BuildOrderedHashTableFindEntry<OrderedHashSet>(table, key, hash);
...@@ -12526,7 +12474,7 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete( ...@@ -12526,7 +12474,7 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete(
IfBuilder string_checker(this, &got_string_hash); IfBuilder string_checker(this, &got_string_hash);
string_checker.Then(); string_checker.Then();
{ {
HValue* table = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* table = Add<HLoadNamedField>(receiver, nullptr,
HObjectAccess::ForJSCollectionTable()); HObjectAccess::ForJSCollectionTable());
HValue* key_index = HValue* key_index =
BuildOrderedHashTableFindEntry<CollectionType>(table, key, hash); BuildOrderedHashTableFindEntry<CollectionType>(table, key, hash);
...@@ -12539,16 +12487,14 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete( ...@@ -12539,16 +12487,14 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete(
// If we're removing an element, we might need to shrink. // If we're removing an element, we might need to shrink.
// If we do need to shrink, we'll be bailing out to the runtime. // If we do need to shrink, we'll be bailing out to the runtime.
HValue* num_elements = Add<HLoadNamedField>( HValue* num_elements = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr, HObjectAccess::ForOrderedHashTableNumberOfElements<
HObjectAccess::ForOrderedHashTableNumberOfElements< CollectionType>());
CollectionType>());
num_elements = AddUncasted<HSub>(num_elements, graph()->GetConstant1()); num_elements = AddUncasted<HSub>(num_elements, graph()->GetConstant1());
num_elements->ClearFlag(HValue::kCanOverflow); num_elements->ClearFlag(HValue::kCanOverflow);
HValue* num_buckets = Add<HLoadNamedField>( HValue* num_buckets = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr, HObjectAccess::ForOrderedHashTableNumberOfBuckets<
HObjectAccess::ForOrderedHashTableNumberOfBuckets< CollectionType>());
CollectionType>());
// threshold is capacity >> 2; we simplify this to num_buckets >> 1 // threshold is capacity >> 2; we simplify this to num_buckets >> 1
// since kLoadFactor is 2. // since kLoadFactor is 2.
STATIC_ASSERT(CollectionType::kLoadFactor == 2); STATIC_ASSERT(CollectionType::kLoadFactor == 2);
...@@ -12574,7 +12520,7 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete( ...@@ -12574,7 +12520,7 @@ void HOptimizedGraphBuilder::BuildJSCollectionDelete(
STATIC_ASSERT(CollectionType::kChainOffset <= 2); STATIC_ASSERT(CollectionType::kChainOffset <= 2);
HValue* num_deleted = Add<HLoadNamedField>( HValue* num_deleted = Add<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfDeletedElements< HObjectAccess::ForOrderedHashTableNumberOfDeletedElements<
CollectionType>()); CollectionType>());
num_deleted = AddUncasted<HAdd>(num_deleted, graph()->GetConstant1()); num_deleted = AddUncasted<HAdd>(num_deleted, graph()->GetConstant1());
...@@ -12630,10 +12576,10 @@ void HOptimizedGraphBuilder::GenerateSetGetSize(CallRuntime* call) { ...@@ -12630,10 +12576,10 @@ void HOptimizedGraphBuilder::GenerateSetGetSize(CallRuntime* call) {
DCHECK(call->arguments()->length() == 1); DCHECK(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* receiver = Pop(); HValue* receiver = Pop();
HValue* table = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* table = Add<HLoadNamedField>(receiver, nullptr,
HObjectAccess::ForJSCollectionTable()); HObjectAccess::ForJSCollectionTable());
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfElements<OrderedHashSet>()); HObjectAccess::ForOrderedHashTableNumberOfElements<OrderedHashSet>());
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12643,10 +12589,10 @@ void HOptimizedGraphBuilder::GenerateMapGetSize(CallRuntime* call) { ...@@ -12643,10 +12589,10 @@ void HOptimizedGraphBuilder::GenerateMapGetSize(CallRuntime* call) {
DCHECK(call->arguments()->length() == 1); DCHECK(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* receiver = Pop(); HValue* receiver = Pop();
HValue* table = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), HValue* table = Add<HLoadNamedField>(receiver, nullptr,
HObjectAccess::ForJSCollectionTable()); HObjectAccess::ForJSCollectionTable());
HInstruction* result = New<HLoadNamedField>( HInstruction* result = New<HLoadNamedField>(
table, static_cast<HValue*>(NULL), table, nullptr,
HObjectAccess::ForOrderedHashTableNumberOfElements<OrderedHashMap>()); HObjectAccess::ForOrderedHashTableNumberOfElements<OrderedHashMap>());
return ast_context()->ReturnInstruction(result, call->id()); return ast_context()->ReturnInstruction(result, call->id());
} }
...@@ -12733,9 +12679,8 @@ void HOptimizedGraphBuilder::GenerateMapInitialize(CallRuntime* call) { ...@@ -12733,9 +12679,8 @@ void HOptimizedGraphBuilder::GenerateMapInitialize(CallRuntime* call) {
template <typename CollectionType> template <typename CollectionType>
void HOptimizedGraphBuilder::BuildOrderedHashTableClear(HValue* receiver) { void HOptimizedGraphBuilder::BuildOrderedHashTableClear(HValue* receiver) {
HValue* old_table = HValue* old_table = Add<HLoadNamedField>(
Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL), receiver, nullptr, HObjectAccess::ForJSCollectionTable());
HObjectAccess::ForJSCollectionTable());
HValue* new_table = BuildAllocateOrderedHashTable<CollectionType>(); HValue* new_table = BuildAllocateOrderedHashTable<CollectionType>();
Add<HStoreNamedField>( Add<HStoreNamedField>(
old_table, HObjectAccess::ForOrderedHashTableNextTable<CollectionType>(), old_table, HObjectAccess::ForOrderedHashTableNextTable<CollectionType>(),
...@@ -12807,8 +12752,8 @@ void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { ...@@ -12807,8 +12752,8 @@ void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) {
DCHECK(call->arguments()->length() == 0); DCHECK(call->arguments()->length() == 0);
HValue* ref = HValue* ref =
Add<HConstant>(ExternalReference::debug_is_active_address(isolate())); Add<HConstant>(ExternalReference::debug_is_active_address(isolate()));
HValue* value = Add<HLoadNamedField>( HValue* value =
ref, static_cast<HValue*>(NULL), HObjectAccess::ForExternalUInteger8()); Add<HLoadNamedField>(ref, nullptr, HObjectAccess::ForExternalUInteger8());
return ast_context()->ReturnValue(value); return ast_context()->ReturnValue(value);
} }
...@@ -12820,21 +12765,20 @@ void HOptimizedGraphBuilder::GenerateGetPrototype(CallRuntime* call) { ...@@ -12820,21 +12765,20 @@ void HOptimizedGraphBuilder::GenerateGetPrototype(CallRuntime* call) {
NoObservableSideEffectsScope no_effects(this); NoObservableSideEffectsScope no_effects(this);
HValue* map = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap());
HObjectAccess::ForMap()); HValue* bit_field =
HValue* bit_field = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField());
HObjectAccess::ForMapBitField());
HValue* is_access_check_needed_mask = HValue* is_access_check_needed_mask =
Add<HConstant>(1 << Map::kIsAccessCheckNeeded); Add<HConstant>(1 << Map::kIsAccessCheckNeeded);
HValue* is_access_check_needed_test = AddUncasted<HBitwise>( HValue* is_access_check_needed_test = AddUncasted<HBitwise>(
Token::BIT_AND, bit_field, is_access_check_needed_mask); Token::BIT_AND, bit_field, is_access_check_needed_mask);
HValue* proto = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), HValue* proto =
HObjectAccess::ForPrototype()); Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForPrototype());
HValue* proto_map = Add<HLoadNamedField>(proto, static_cast<HValue*>(NULL), HValue* proto_map =
HObjectAccess::ForMap()); Add<HLoadNamedField>(proto, nullptr, HObjectAccess::ForMap());
HValue* proto_bit_field = Add<HLoadNamedField>( HValue* proto_bit_field =
proto_map, static_cast<HValue*>(NULL), HObjectAccess::ForMapBitField()); Add<HLoadNamedField>(proto_map, nullptr, HObjectAccess::ForMapBitField());
HValue* is_hidden_prototype_mask = HValue* is_hidden_prototype_mask =
Add<HConstant>(1 << Map::kIsHiddenPrototype); Add<HConstant>(1 << Map::kIsHiddenPrototype);
HValue* is_hidden_prototype_test = AddUncasted<HBitwise>( HValue* is_hidden_prototype_test = AddUncasted<HBitwise>(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment