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

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: Move all construction of HObjectAccess into static methods, hiding Portion. Created 7 years, 8 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 04b9a46fc71a967d5608f980d050c92628fc6326..a732e0212a8850abf740d08e46ca2e511456f0a2 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 =
@@ -376,13 +375,9 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
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::ForInobjectOffset(zone, i);
+ HInstruction* value = AddLoad(boilerplate, access);
+ AddStore(object, access, value);
}
checker.ElseDeopt();
@@ -437,9 +432,9 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
AddInstruction(new(zone) HTrapAllocationMemento(js_array));
- HInstruction* array_length =
- AddInstruction(HLoadNamedField::NewArrayLength(
- zone, js_array, js_array, HType::Smi()));
+ HInstruction* array_length = AddLoad(js_array,
+ HObjectAccess::ForArrayLength());
+ array_length->set_type(HType::Smi());
ElementsKind to_kind = casted_stub()->to_kind();
BuildNewSpaceArrayCheck(array_length, to_kind);
@@ -466,20 +461,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;
}

Powered by Google App Engine
This is Rietveld 408576698