From 854e9b99fb8d7d990b241217f100474ee022832f Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Wed, 10 Jul 2013 13:24:51 +0000 Subject: [PATCH] Insert HTrapAllocationMemento only when required for TransitionElementsKindStub. R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/18292018 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15594 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/code-stubs-hydrogen.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index fad8cfba2b..d8eaae0190 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -528,12 +528,18 @@ Handle KeyedStoreFastElementStub::GenerateCode() { template <> HValue* CodeStubGraphBuilder::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(js_array); + if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { + Add(js_array); + } HInstruction* array_length = AddLoad(js_array, HObjectAccess::ForArrayLength()); @@ -550,9 +556,7 @@ HValue* CodeStubGraphBuilder::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();