Reviewers: mvstanton, Hannes Payer,

Description:
Insert HTrapAllocationMemento only when required for TransitionElementsKindStub.

Please review this at https://codereview.chromium.org/18292018/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/code-stubs-hydrogen.cc


Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index fad8cfba2b9912a7600b4958d9955d2800ad482f..d8eaae019076f0d09111882c53849433b1d7ee73 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -528,12 +528,18 @@ 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();

-  Add<HTrapAllocationMemento>(js_array);
+ if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
+    Add<HTrapAllocationMemento>(js_array);
+  }

   HInstruction* array_length =
       AddLoad(js_array, HObjectAccess::ForArrayLength());
@@ -550,9 +556,7 @@ HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {

   HInstruction* elements_length = AddLoadFixedArrayLength(elements);

-  BuildGrowElementsCapacity(js_array, elements,
-                            casted_stub()->from_kind(),
-                            casted_stub()->to_kind(),
+  BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
                             array_length, elements_length);

   if_builder.End();


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to