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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 1531753002: [turbofan] Add support for CreateIterResultObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 node->InsertInput(graph()->zone(), 0, stub_code); 1730 node->InsertInput(graph()->zone(), 0, stub_code);
1731 node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared)); 1731 node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared));
1732 NodeProperties::ChangeOp(node, new_op); 1732 NodeProperties::ChangeOp(node, new_op);
1733 return Changed(node); 1733 return Changed(node);
1734 } 1734 }
1735 1735
1736 return NoChange(); 1736 return NoChange();
1737 } 1737 }
1738 1738
1739 1739
1740 Reduction JSTypedLowering::ReduceJSCreateIterResultObject(Node* node) {
1741 DCHECK_EQ(IrOpcode::kJSCreateIterResultObject, node->opcode());
1742 Node* value = NodeProperties::GetValueInput(node, 0);
1743 Node* done = NodeProperties::GetValueInput(node, 1);
1744 Node* context = NodeProperties::GetContextInput(node);
1745 Node* effect = NodeProperties::GetEffectInput(node);
1746
1747 // Load the JSIteratorResult map for the {context}.
1748 Node* native_context = effect = graph()->NewNode(
1749 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1750 context, context, effect);
1751 Node* iterator_result_map = effect = graph()->NewNode(
1752 javascript()->LoadContext(0, Context::ITERATOR_RESULT_MAP_INDEX, true),
1753 native_context, native_context, effect);
1754
1755 // Emit code to allocate the JSIteratorResult instance.
1756 AllocationBuilder a(jsgraph(), effect, graph()->start());
1757 a.Allocate(JSIteratorResult::kSize);
1758 a.Store(AccessBuilder::ForMap(), iterator_result_map);
1759 a.Store(AccessBuilder::ForJSObjectProperties(),
1760 jsgraph()->EmptyFixedArrayConstant());
1761 a.Store(AccessBuilder::ForJSObjectElements(),
1762 jsgraph()->EmptyFixedArrayConstant());
1763 a.Store(AccessBuilder::ForJSIteratorResultValue(), value);
1764 a.Store(AccessBuilder::ForJSIteratorResultDone(), done);
1765 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
1766 a.FinishAndChange(node);
1767 return Changed(node);
1768 }
1769
1770
1740 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { 1771 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) {
1741 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode()); 1772 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode());
1742 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); 1773 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
1743 Handle<FixedArray> const constants = Handle<FixedArray>::cast(p.constant()); 1774 Handle<FixedArray> const constants = Handle<FixedArray>::cast(p.constant());
1744 int const length = constants->length(); 1775 int const length = constants->length();
1745 int const flags = p.flags(); 1776 int const flags = p.flags();
1746 1777
1747 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the 1778 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the
1748 // initial length limit for arrays with "fast" elements kind. 1779 // initial length limit for arrays with "fast" elements kind.
1749 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub. 1780 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub.
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 case IrOpcode::kJSConvertReceiver: 2539 case IrOpcode::kJSConvertReceiver:
2509 return ReduceJSConvertReceiver(node); 2540 return ReduceJSConvertReceiver(node);
2510 case IrOpcode::kJSCreate: 2541 case IrOpcode::kJSCreate:
2511 return ReduceJSCreate(node); 2542 return ReduceJSCreate(node);
2512 case IrOpcode::kJSCreateArguments: 2543 case IrOpcode::kJSCreateArguments:
2513 return ReduceJSCreateArguments(node); 2544 return ReduceJSCreateArguments(node);
2514 case IrOpcode::kJSCreateArray: 2545 case IrOpcode::kJSCreateArray:
2515 return ReduceJSCreateArray(node); 2546 return ReduceJSCreateArray(node);
2516 case IrOpcode::kJSCreateClosure: 2547 case IrOpcode::kJSCreateClosure:
2517 return ReduceJSCreateClosure(node); 2548 return ReduceJSCreateClosure(node);
2549 case IrOpcode::kJSCreateIterResultObject:
2550 return ReduceJSCreateIterResultObject(node);
2518 case IrOpcode::kJSCreateLiteralArray: 2551 case IrOpcode::kJSCreateLiteralArray:
2519 return ReduceJSCreateLiteralArray(node); 2552 return ReduceJSCreateLiteralArray(node);
2520 case IrOpcode::kJSCreateLiteralObject: 2553 case IrOpcode::kJSCreateLiteralObject:
2521 return ReduceJSCreateLiteralObject(node); 2554 return ReduceJSCreateLiteralObject(node);
2522 case IrOpcode::kJSCreateFunctionContext: 2555 case IrOpcode::kJSCreateFunctionContext:
2523 return ReduceJSCreateFunctionContext(node); 2556 return ReduceJSCreateFunctionContext(node);
2524 case IrOpcode::kJSCreateWithContext: 2557 case IrOpcode::kJSCreateWithContext:
2525 return ReduceJSCreateWithContext(node); 2558 return ReduceJSCreateWithContext(node);
2526 case IrOpcode::kJSCreateCatchContext: 2559 case IrOpcode::kJSCreateCatchContext:
2527 return ReduceJSCreateCatchContext(node); 2560 return ReduceJSCreateCatchContext(node);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 } 2720 }
2688 2721
2689 2722
2690 CompilationDependencies* JSTypedLowering::dependencies() const { 2723 CompilationDependencies* JSTypedLowering::dependencies() const {
2691 return dependencies_; 2724 return dependencies_;
2692 } 2725 }
2693 2726
2694 } // namespace compiler 2727 } // namespace compiler
2695 } // namespace internal 2728 } // namespace internal
2696 } // namespace v8 2729 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698