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

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

Issue 19367003: Reland "Turn ElementsTransitionAndStore stub into a HydrogenCodeStub". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test case. Created 7 years, 5 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/code-stubs.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 9ea87abb54641383d35fc7df8d2b7fe1f1a01af9..25715cb1c5f1d09cb4bdafdb59994047c33c8e98 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -528,44 +528,15 @@ Handle<Code> KeyedStoreFastElementStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
- TransitionElementsKindStub* stub = casted_stub();
- ElementsKind from_kind = stub->from_kind();
- ElementsKind to_kind = stub->to_kind();
-
- HValue* js_array = GetParameter(0);
- HValue* map = GetParameter(1);
-
info()->MarkAsSavesCallerDoubles();
- if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
- Add<HTrapAllocationMemento>(js_array);
- }
-
- HInstruction* elements = AddLoadElements(js_array);
-
- HInstruction* empty_fixed_array = Add<HConstant>(
- isolate()->factory()->empty_fixed_array(), Representation::Tagged());
-
- IfBuilder if_builder(this);
-
- if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array);
-
- if_builder.Then();
-
- HInstruction* elements_length = AddLoadFixedArrayLength(elements);
-
- HInstruction* array_length = AddLoad(
- js_array, HObjectAccess::ForArrayLength(), NULL, Representation::Smi());
- array_length->set_type(HType::Smi());
-
- BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
- array_length, elements_length);
-
- if_builder.End();
-
- AddStore(js_array, HObjectAccess::ForMap(), map);
+ BuildTransitionElementsKind(GetParameter(0),
+ GetParameter(1),
+ casted_stub()->from_kind(),
+ casted_stub()->to_kind(),
+ true);
- return js_array;
+ return GetParameter(0);
}
@@ -910,4 +881,39 @@ Handle<Code> StoreGlobalStub::GenerateCode() {
}
+template<>
+HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
+ HValue* value = GetParameter(0);
+ HValue* map = GetParameter(1);
+ HValue* key = GetParameter(2);
+ HValue* object = GetParameter(3);
+
+ if (FLAG_trace_elements_transitions) {
+ // Tracing elements transitions is the job of the runtime.
+ current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
+ set_current_block(NULL);
+ } else {
+ info()->MarkAsSavesCallerDoubles();
+
+ BuildTransitionElementsKind(object, map,
+ casted_stub()->from_kind(),
+ casted_stub()->to_kind(),
+ casted_stub()->is_jsarray());
+
+ BuildUncheckedMonomorphicElementAccess(object, key, value, NULL,
+ casted_stub()->is_jsarray(),
+ casted_stub()->to_kind(),
+ true, ALLOW_RETURN_HOLE,
+ casted_stub()->store_mode());
+ }
+
+ return value;
+}
+
+
+Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
+ return DoGenerateCode(this);
+}
+
+
} } // namespace v8::internal
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698