Revision: 15589
Author: [email protected]
Date: Wed Jul 10 05:19:02 2013
Log: Use BuildGrowElementsCapacity for the TransitionElementsKind stub.
[email protected], [email protected]
Review URL: https://codereview.chromium.org/18876004
http://code.google.com/p/v8/source/detail?r=15589
Modified:
/branches/bleeding_edge/src/code-stubs-hydrogen.cc
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Mon Jul 8 08:00:12
2013
+++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Wed Jul 10 05:19:02
2013
@@ -528,45 +528,32 @@
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();
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Wed Jul 10 05:02:18 2013
+++ /branches/bleeding_edge/src/hydrogen.cc Wed Jul 10 05:19:02 2013
@@ -1159,7 +1159,7 @@
BuildNewElementsCapacity(context, current_capacity);
HValue* new_elements = BuildGrowElementsCapacity(object, elements,
- kind, length,
+ kind, kind, length,
new_capacity);
environment()->Push(new_elements);
@@ -1203,7 +1203,7 @@
HValue* capacity = AddLoadFixedArrayLength(elements);
- HValue* new_elements = BuildGrowElementsCapacity(object, elements,
+ HValue* new_elements = BuildGrowElementsCapacity(object, elements, kind,
kind, length, capacity);
environment()->Push(new_elements);
@@ -1475,17 +1475,18 @@
HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object,
HValue* elements,
ElementsKind kind,
+ ElementsKind new_kind,
HValue* length,
HValue* new_capacity) {
HValue* context = environment()->LookupContext();
- BuildNewSpaceArrayCheck(new_capacity, kind);
+ BuildNewSpaceArrayCheck(new_capacity, new_kind);
HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
- context, kind, new_capacity);
+ context, new_kind, new_capacity);
BuildCopyElements(context, elements, kind,
- new_elements, kind,
+ new_elements, new_kind,
length, new_capacity);
AddStore(object, HObjectAccess::ForElementsPointer(), new_elements);
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Wed Jul 10 05:02:18 2013
+++ /branches/bleeding_edge/src/hydrogen.h Wed Jul 10 05:19:02 2013
@@ -1378,6 +1378,7 @@
HValue* BuildGrowElementsCapacity(HValue* object,
HValue* elements,
ElementsKind kind,
+ ElementsKind new_kind,
HValue* length,
HValue* new_capacity);
--
--
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.