Commit d6458eb9 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Add dependency operand to HLoadNamedField.

R=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18897 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 34560472
...@@ -351,7 +351,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { ...@@ -351,7 +351,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset); AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); HInstruction* boilerplate = Add<HLoadNamedField>(
allocation_site, static_cast<HValue*>(NULL), access);
HValue* push_value; HValue* push_value;
if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
HValue* elements = AddLoadElements(boilerplate); HValue* elements = AddLoadElements(boilerplate);
...@@ -421,7 +422,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -421,7 +422,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
AllocationSite::kTransitionInfoOffset); AllocationSite::kTransitionInfoOffset);
HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); HInstruction* boilerplate = Add<HLoadNamedField>(
allocation_site, static_cast<HValue*>(NULL), access);
int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize;
int object_size = size; int object_size = size;
...@@ -430,9 +432,11 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -430,9 +432,11 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
} }
HValue* boilerplate_map = Add<HLoadNamedField>( HValue* boilerplate_map = Add<HLoadNamedField>(
boilerplate, HObjectAccess::ForMap()); boilerplate, static_cast<HValue*>(NULL),
HObjectAccess::ForMap());
HValue* boilerplate_size = Add<HLoadNamedField>( HValue* boilerplate_size = Add<HLoadNamedField>(
boilerplate_map, HObjectAccess::ForMapInstanceSize()); boilerplate_map, static_cast<HValue*>(NULL),
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);
...@@ -445,9 +449,10 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { ...@@ -445,9 +449,10 @@ 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::ForJSObjectOffset(i); HObjectAccess access = HObjectAccess::ForJSObjectOffset(i);
Add<HStoreNamedField>(object, access, Add<HStoreNamedField>(
Add<HLoadNamedField>(boilerplate, access), object, access, Add<HLoadNamedField>(
INITIALIZING_STORE); boilerplate, static_cast<HValue*>(NULL), access),
INITIALIZING_STORE);
} }
ASSERT(FLAG_allocation_site_pretenuring || (size == object_size)); ASSERT(FLAG_allocation_site_pretenuring || (size == object_size));
...@@ -521,8 +526,9 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { ...@@ -521,8 +526,9 @@ 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>(site_list, HValue* site = Add<HLoadNamedField>(
HObjectAccess::ForAllocationSiteList()); site_list, static_cast<HValue*>(NULL),
HObjectAccess::ForAllocationSiteList());
store = Add<HStoreNamedField>(object, store = Add<HStoreNamedField>(object,
HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
site, INITIALIZING_STORE); site, INITIALIZING_STORE);
...@@ -1069,7 +1075,8 @@ HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { ...@@ -1069,7 +1075,8 @@ 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>(cell, access); HValue* cell_contents = Add<HLoadNamedField>(
cell, static_cast<HValue*>(NULL), access);
if (stub->is_constant()) { if (stub->is_constant()) {
IfBuilder builder(this); IfBuilder builder(this);
...@@ -1147,7 +1154,8 @@ void CodeStubGraphBuilderBase::BuildInstallOptimizedCode( ...@@ -1147,7 +1154,8 @@ void CodeStubGraphBuilderBase::BuildInstallOptimizedCode(
Add<HStoreCodeEntry>(js_function, code_object); Add<HStoreCodeEntry>(js_function, code_object);
// 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>(native_context, HValue* optimized_functions_list = Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL),
HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST));
Add<HStoreNamedField>(js_function, Add<HStoreNamedField>(js_function,
HObjectAccess::ForNextFunctionLinkPointer(), HObjectAccess::ForNextFunctionLinkPointer(),
...@@ -1166,8 +1174,8 @@ void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function, ...@@ -1166,8 +1174,8 @@ void CodeStubGraphBuilderBase::BuildInstallCode(HValue* js_function,
HObjectAccess::ForNextFunctionLinkPointer(), HObjectAccess::ForNextFunctionLinkPointer(),
graph()->GetConstantUndefined(), graph()->GetConstantUndefined(),
INITIALIZING_STORE); INITIALIZING_STORE);
HValue* code_object = Add<HLoadNamedField>(shared_info, HValue* code_object = Add<HLoadNamedField>(
HObjectAccess::ForCodeOffset()); shared_info, static_cast<HValue*>(NULL), HObjectAccess::ForCodeOffset());
Add<HStoreCodeEntry>(js_function, code_object); Add<HStoreCodeEntry>(js_function, code_object);
} }
...@@ -1178,7 +1186,8 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1178,7 +1186,8 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
HValue* native_context) { HValue* native_context) {
Counters* counters = isolate()->counters(); Counters* counters = isolate()->counters();
IfBuilder is_optimized(this); IfBuilder is_optimized(this);
HInstruction* optimized_map = Add<HLoadNamedField>(shared_info, HInstruction* optimized_map = Add<HLoadNamedField>(
shared_info, static_cast<HValue*>(NULL),
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);
...@@ -1193,9 +1202,11 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1193,9 +1202,11 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
// (native context, optimized code, literals). // (native context, optimized code, literals).
// Map must never be empty, so check the first elements. // Map must never be empty, so check the first elements.
Label install_optimized; Label install_optimized;
HValue* first_context_slot = Add<HLoadNamedField>(optimized_map, HValue* first_context_slot = Add<HLoadNamedField>(
optimized_map, static_cast<HValue*>(NULL),
HObjectAccess::ForFirstContextSlot()); HObjectAccess::ForFirstContextSlot());
HValue* first_osr_ast_slot = Add<HLoadNamedField>(optimized_map, HValue* first_osr_ast_slot = Add<HLoadNamedField>(
optimized_map, static_cast<HValue*>(NULL),
HObjectAccess::ForFirstOsrAstIdSlot()); HObjectAccess::ForFirstOsrAstIdSlot());
HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt());
IfBuilder already_in(this); IfBuilder already_in(this);
...@@ -1205,8 +1216,9 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1205,8 +1216,9 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
osr_ast_id_none); osr_ast_id_none);
already_in.Then(); already_in.Then();
{ {
HValue* code_object = Add<HLoadNamedField>(optimized_map, HValue* code_object = Add<HLoadNamedField>(
HObjectAccess::ForFirstCodeSlot()); optimized_map, static_cast<HValue*>(NULL),
HObjectAccess::ForFirstCodeSlot());
BuildInstallOptimizedCode(js_function, native_context, code_object); BuildInstallOptimizedCode(js_function, native_context, code_object);
} }
already_in.Else(); already_in.Else();
...@@ -1217,7 +1229,8 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap( ...@@ -1217,7 +1229,8 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
context(), context(),
LoopBuilder::kPostDecrement, LoopBuilder::kPostDecrement,
shared_function_entry_length); shared_function_entry_length);
HValue* array_length = Add<HLoadNamedField>(optimized_map, HValue* array_length = Add<HLoadNamedField>(
optimized_map, static_cast<HValue*>(NULL),
HObjectAccess::ForFixedArrayLength()); HObjectAccess::ForFixedArrayLength());
HValue* slot_iterator = loop_builder.BeginBody(array_length, HValue* slot_iterator = loop_builder.BeginBody(array_length,
graph()->GetConstant0(), graph()->GetConstant0(),
...@@ -1300,7 +1313,8 @@ HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { ...@@ -1300,7 +1313,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 = Add<HLoadNamedField>(native_context, HInstruction* map_slot_value = Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL),
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,
INITIALIZING_STORE); INITIALIZING_STORE);
...@@ -1370,7 +1384,8 @@ HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() { ...@@ -1370,7 +1384,8 @@ 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(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); context(), static_cast<HValue*>(NULL),
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
Add<HStoreNamedField>(function_context, Add<HStoreNamedField>(function_context,
HObjectAccess::ForContextSlot( HObjectAccess::ForContextSlot(
Context::GLOBAL_OBJECT_INDEX), Context::GLOBAL_OBJECT_INDEX),
......
...@@ -3049,6 +3049,11 @@ void HParameter::PrintDataTo(StringStream* stream) { ...@@ -3049,6 +3049,11 @@ void HParameter::PrintDataTo(StringStream* stream) {
void HLoadNamedField::PrintDataTo(StringStream* stream) { void HLoadNamedField::PrintDataTo(StringStream* stream) {
object()->PrintNameTo(stream); object()->PrintNameTo(stream);
access_.PrintTo(stream); access_.PrintTo(stream);
if (HasDependency()) {
stream->Add(" ");
dependency()->PrintNameTo(stream);
}
} }
......
...@@ -6048,12 +6048,17 @@ class HObjectAccess V8_FINAL { ...@@ -6048,12 +6048,17 @@ class HObjectAccess V8_FINAL {
}; };
class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> { class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
public: public:
DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*,
HObjectAccess);
HValue* object() { return OperandAt(0); } HValue* object() { return OperandAt(0); }
bool HasTypeCheck() { return object()->IsCheckMaps(); } HValue* dependency() {
ASSERT(HasDependency());
return OperandAt(1);
}
bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
HObjectAccess access() const { return access_; } HObjectAccess access() const { return access_; }
Representation field_representation() const { Representation field_representation() const {
return access_.representation(); return access_.representation();
...@@ -6082,9 +6087,12 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> { ...@@ -6082,9 +6087,12 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> {
} }
private: private:
HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { HLoadNamedField(HValue* object,
HValue* dependency,
HObjectAccess access) : access_(access) {
ASSERT(object != NULL); ASSERT(object != NULL);
SetOperandAt(0, object); SetOperandAt(0, object);
SetOperandAt(1, dependency != NULL ? dependency : object);
Representation representation = access.representation(); Representation representation = access.representation();
if (representation.IsInteger8() || if (representation.IsInteger8() ||
......
This diff is collapsed.
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