Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 51734da2f16a754110d4acb04f6192e2aeb10664..fad8cfba2b9912a7600b4958d9955d2800ad482f 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -528,45 +528,32 @@ Handle<Code> KeyedStoreFastElementStub::GenerateCode() { |
template <> |
HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { |
- Zone* zone = this->zone(); |
- |
HValue* js_array = GetParameter(0); |
HValue* map = GetParameter(1); |
info()->MarkAsSavesCallerDoubles(); |
- AddInstruction(new(zone) HTrapAllocationMemento(js_array)); |
+ Add<HTrapAllocationMemento>(js_array); |
HInstruction* array_length = |
AddLoad(js_array, HObjectAccess::ForArrayLength()); |
array_length->set_type(HType::Smi()); |
- ElementsKind to_kind = casted_stub()->to_kind(); |
- BuildNewSpaceArrayCheck(array_length, to_kind); |
- |
IfBuilder if_builder(this); |
- if_builder.If<HCompareNumericAndBranch>(array_length, |
- graph()->GetConstant0(), |
- Token::EQ); |
+ if_builder.IfNot<HCompareNumericAndBranch>(array_length, |
+ graph()->GetConstant0(), |
+ Token::EQ); |
if_builder.Then(); |
- // Nothing to do, just change the map. |
- |
- if_builder.Else(); |
- |
HInstruction* elements = AddLoadElements(js_array); |
HInstruction* elements_length = AddLoadFixedArrayLength(elements); |
- HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( |
- context(), to_kind, elements_length); |
- |
- BuildCopyElements(context(), elements, |
- casted_stub()->from_kind(), new_elements, |
- to_kind, array_length, elements_length); |
- |
- AddStore(js_array, HObjectAccess::ForElementsPointer(), new_elements); |
+ BuildGrowElementsCapacity(js_array, elements, |
+ casted_stub()->from_kind(), |
+ casted_stub()->to_kind(), |
+ array_length, elements_length); |
if_builder.End(); |