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
This commit is contained in:
bmeurer@chromium.org 2013-07-10 13:24:51 +00:00
parent cc877e4836
commit 854e9b99fb

View File

@ -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();