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

Unified Diff: src/compiler/js-create-lowering.cc

Issue 2484003002: [builtins] implement JSBuiltinReducer for ArrayIteratorNext() (Closed)
Patch Set: fix tests when ignition is used Created 4 years, 1 month 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 | « src/compiler/js-create-lowering.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-create-lowering.cc
diff --git a/src/compiler/js-create-lowering.cc b/src/compiler/js-create-lowering.cc
index 23ae27b36818c3ddde5c28c551e9f55b5ad478d2..102e5a9b97461326294810c6d9556122c54cf4fd 100644
--- a/src/compiler/js-create-lowering.cc
+++ b/src/compiler/js-create-lowering.cc
@@ -210,6 +210,8 @@ Reduction JSCreateLowering::Reduce(Node* node) {
return ReduceJSCreateClosure(node);
case IrOpcode::kJSCreateIterResultObject:
return ReduceJSCreateIterResultObject(node);
+ case IrOpcode::kJSCreateKeyValueArray:
+ return ReduceJSCreateKeyValueArray(node);
case IrOpcode::kJSCreateLiteralArray:
case IrOpcode::kJSCreateLiteralObject:
return ReduceJSCreateLiteral(node);
@@ -721,6 +723,36 @@ Reduction JSCreateLowering::ReduceJSCreateIterResultObject(Node* node) {
return Changed(node);
}
+Reduction JSCreateLowering::ReduceJSCreateKeyValueArray(Node* node) {
+ DCHECK_EQ(IrOpcode::kJSCreateKeyValueArray, node->opcode());
+ Node* key = NodeProperties::GetValueInput(node, 0);
+ Node* value = NodeProperties::GetValueInput(node, 1);
+ Node* effect = NodeProperties::GetEffectInput(node);
+
+ Node* array_map = jsgraph()->HeapConstant(
+ handle(native_context()->js_array_fast_elements_map_index()));
+ Node* properties = jsgraph()->EmptyFixedArrayConstant();
+ Node* length = jsgraph()->Constant(2);
+
+ AllocationBuilder aa(jsgraph(), effect, graph()->start());
+ aa.AllocateArray(2, factory()->fixed_array_map());
+ aa.Store(AccessBuilder::ForFixedArrayElement(FAST_ELEMENTS),
+ jsgraph()->Constant(0), key);
+ aa.Store(AccessBuilder::ForFixedArrayElement(FAST_ELEMENTS),
+ jsgraph()->Constant(1), value);
+ Node* elements = aa.Finish();
+
+ AllocationBuilder a(jsgraph(), elements, graph()->start());
+ a.Allocate(JSArray::kSize);
+ a.Store(AccessBuilder::ForMap(), array_map);
+ a.Store(AccessBuilder::ForJSObjectProperties(), properties);
+ a.Store(AccessBuilder::ForJSObjectElements(), elements);
+ a.Store(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS), length);
+ STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize);
+ a.FinishAndChange(node);
+ return Changed(node);
+}
+
Reduction JSCreateLowering::ReduceJSCreateLiteral(Node* node) {
DCHECK(node->opcode() == IrOpcode::kJSCreateLiteralArray ||
node->opcode() == IrOpcode::kJSCreateLiteralObject);
« no previous file with comments | « src/compiler/js-create-lowering.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698