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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 14284010: Introduce HObjectAccess, which is used by LoadNamedField and StoreNamedField to denote what parts (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Split apart ForOffset into ForJSObjectOffset, ForJSArrayOffset, and ForFixedArrayOffset Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index dbe41cbf5482719be369f92f136f23b094db44a0..a88b221458ac05aba01a9f30e7f31dc748e01553 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -340,7 +340,6 @@ Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
Zone* zone = this->zone();
- Factory* factory = isolate()->factory();
HValue* undefined = graph()->GetConstantUndefined();
HInstruction* boilerplate =
@@ -369,20 +368,14 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
flags = static_cast<HAllocate::Flags>(
flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE);
}
- HInstruction* object =
- AddInstruction(new(zone) HAllocate(context(),
- size_in_bytes,
- HType::JSObject(),
- flags));
+
+ HInstruction* object = AddInstruction(new(zone)
+ HAllocate(context(), size_in_bytes, HType::JSObject(), flags));
for (int i = 0; i < size; i += kPointerSize) {
- HInstruction* value =
- AddInstruction(new(zone) HLoadNamedField(
- boilerplate, true, Representation::Tagged(), i));
- AddInstruction(new(zone) HStoreNamedField(object,
- factory->empty_string(),
- value, true,
- Representation::Tagged(), i));
+ HObjectAccess access = HObjectAccess::ForJSObjectOffset(i);
+ HInstruction* value = AddLoad(boilerplate, access);
+ AddStore(object, access, value);
}
checker.ElseDeopt();
@@ -412,11 +405,11 @@ Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
template<>
HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
- Representation representation = casted_stub()->representation();
- HInstruction* load = AddInstruction(new(zone()) HLoadNamedField(
- GetParameter(0), casted_stub()->is_inobject(),
- representation, casted_stub()->offset()));
- return load;
+ HObjectAccess access = casted_stub()->is_inobject() ?
+ HObjectAccess::ForJSObjectOffset(casted_stub()->offset()) :
+ HObjectAccess::For(false, casted_stub()->offset());
+ return AddLoad(GetParameter(0), access, NULL,
+ casted_stub()->representation());
}
@@ -427,11 +420,11 @@ Handle<Code> LoadFieldStub::GenerateCode() {
template<>
HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() {
- Representation representation = casted_stub()->representation();
- HInstruction* load = AddInstruction(new(zone()) HLoadNamedField(
- GetParameter(0), casted_stub()->is_inobject(),
- representation, casted_stub()->offset()));
- return load;
+ HObjectAccess access = casted_stub()->is_inobject() ?
+ HObjectAccess::ForJSObjectOffset(casted_stub()->offset()) :
+ HObjectAccess::For(false, casted_stub()->offset());
+ return AddLoad(GetParameter(0), access, NULL,
+ casted_stub()->representation());
}
@@ -468,8 +461,8 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
AddInstruction(new(zone) HTrapAllocationMemento(js_array));
HInstruction* array_length =
- AddInstruction(HLoadNamedField::NewArrayLength(
- zone, js_array, js_array, HType::Smi()));
+ AddLoad(js_array, HObjectAccess::ForArrayLength());
+ array_length->set_type(HType::Smi());
ElementsKind to_kind = casted_stub()->to_kind();
BuildNewSpaceArrayCheck(array_length, to_kind);
@@ -495,20 +488,12 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
casted_stub()->from_kind(), new_elements,
to_kind, array_length, elements_length);
- Factory* factory = isolate()->factory();
-
- AddInstruction(new(zone) HStoreNamedField(js_array,
- factory->elements_field_string(),
- new_elements, true,
- Representation::Tagged(),
- JSArray::kElementsOffset));
+ AddStore(js_array, HObjectAccess::ForElementsPointer(), new_elements);
if_builder.End();
- AddInstruction(new(zone) HStoreNamedField(js_array, factory->length_string(),
- map, true,
- Representation::Tagged(),
- JSArray::kMapOffset));
+ AddStore(js_array, HObjectAccess::ForMap(), map);
+
return js_array;
}
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698