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

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

Issue 18876004: Use BuildGrowElementsCapacity for the TransitionElementsKind stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | 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 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();
« no previous file with comments | « no previous file | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698