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

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: Use BitField utility instead of C-language bitfield for portion and offset in HObjectAccess. 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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 6e837ddb956c09c0fb56bd687185d7d75f176c25..ec20e5ebe1565dd88fe3ab0158c23913f470e55c 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -358,7 +358,6 @@ Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
Zone* zone = this->zone();
- Factory* factory = isolate()->factory();
HValue* undefined = graph()->GetConstantUndefined();
HInstruction* boilerplate =
@@ -387,20 +386,13 @@ 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);
+ AddStore(object, access, AddLoad(boilerplate, access));
}
checker.ElseDeopt();
@@ -430,11 +422,11 @@ Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
template<>
HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
- Representation representation = casted_stub()->representation();
- HInstruction* load = AddInstruction(DoBuildLoadNamedField(
- GetParameter(0), casted_stub()->is_inobject(),
- representation, casted_stub()->offset()));
- return load;
+ HObjectAccess access = casted_stub()->is_inobject() ?
+ HObjectAccess::ForJSObjectOffset(casted_stub()->offset()) :
+ HObjectAccess::ForBackingStoreOffset(casted_stub()->offset());
+ return AddInstruction(BuildLoadNamedField(GetParameter(0), access,
+ casted_stub()->representation()));
}
@@ -445,11 +437,11 @@ Handle<Code> LoadFieldStub::GenerateCode() {
template<>
HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() {
- Representation representation = casted_stub()->representation();
- HInstruction* load = AddInstruction(DoBuildLoadNamedField(
- GetParameter(0), casted_stub()->is_inobject(),
- representation, casted_stub()->offset()));
- return load;
+ HObjectAccess access = casted_stub()->is_inobject() ?
+ HObjectAccess::ForJSObjectOffset(casted_stub()->offset()) :
+ HObjectAccess::ForBackingStoreOffset(casted_stub()->offset());
+ return AddInstruction(BuildLoadNamedField(GetParameter(0), access,
+ casted_stub()->representation()));
}
@@ -487,8 +479,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);
@@ -514,20 +506,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698