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

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

Issue 2394783002: [turbofan] Properly specialize JSCreateIterResultObject map. (Closed)
Patch Set: Fix typo. Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/compiler/js-create-lowering.h ('k') | src/compiler/pipeline.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/compiler/js-create-lowering.h" 5 #include "src/compiler/js-create-lowering.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined); 715 a.Store(AccessBuilder::ForJSFunctionNextFunctionLink(), undefined);
716 RelaxControls(node); 716 RelaxControls(node);
717 a.FinishAndChange(node); 717 a.FinishAndChange(node);
718 return Changed(node); 718 return Changed(node);
719 } 719 }
720 720
721 Reduction JSCreateLowering::ReduceJSCreateIterResultObject(Node* node) { 721 Reduction JSCreateLowering::ReduceJSCreateIterResultObject(Node* node) {
722 DCHECK_EQ(IrOpcode::kJSCreateIterResultObject, node->opcode()); 722 DCHECK_EQ(IrOpcode::kJSCreateIterResultObject, node->opcode());
723 Node* value = NodeProperties::GetValueInput(node, 0); 723 Node* value = NodeProperties::GetValueInput(node, 0);
724 Node* done = NodeProperties::GetValueInput(node, 1); 724 Node* done = NodeProperties::GetValueInput(node, 1);
725 Node* context = NodeProperties::GetContextInput(node);
726 Node* effect = NodeProperties::GetEffectInput(node); 725 Node* effect = NodeProperties::GetEffectInput(node);
727 726
728 // Load the JSIteratorResult map for the {context}. 727 Node* iterator_result_map;
729 Node* native_context = effect = graph()->NewNode( 728 Handle<Context> native_context;
730 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 729 if (GetSpecializationNativeContext(node).ToHandle(&native_context)) {
731 context, context, effect); 730 // Specialize to the constant JSIteratorResult map to enable map check
732 Node* iterator_result_map = effect = graph()->NewNode( 731 // elimination to eliminate subsequent checks in case of inlining.
733 javascript()->LoadContext(0, Context::ITERATOR_RESULT_MAP_INDEX, true), 732 iterator_result_map = jsgraph()->HeapConstant(
734 native_context, native_context, effect); 733 handle(native_context->iterator_result_map(), isolate()));
734 } else {
735 // Load the JSIteratorResult map for the {context}.
736 Node* context = NodeProperties::GetContextInput(node);
737 Node* native_context = effect = graph()->NewNode(
738 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
739 context, context, effect);
740 iterator_result_map = effect = graph()->NewNode(
741 javascript()->LoadContext(0, Context::ITERATOR_RESULT_MAP_INDEX, true),
742 native_context, native_context, effect);
743 }
735 744
736 // Emit code to allocate the JSIteratorResult instance. 745 // Emit code to allocate the JSIteratorResult instance.
737 AllocationBuilder a(jsgraph(), effect, graph()->start()); 746 AllocationBuilder a(jsgraph(), effect, graph()->start());
738 a.Allocate(JSIteratorResult::kSize); 747 a.Allocate(JSIteratorResult::kSize);
739 a.Store(AccessBuilder::ForMap(), iterator_result_map); 748 a.Store(AccessBuilder::ForMap(), iterator_result_map);
740 a.Store(AccessBuilder::ForJSObjectProperties(), 749 a.Store(AccessBuilder::ForJSObjectProperties(),
741 jsgraph()->EmptyFixedArrayConstant()); 750 jsgraph()->EmptyFixedArrayConstant());
742 a.Store(AccessBuilder::ForJSObjectElements(), 751 a.Store(AccessBuilder::ForJSObjectElements(),
743 jsgraph()->EmptyFixedArrayConstant()); 752 jsgraph()->EmptyFixedArrayConstant());
744 a.Store(AccessBuilder::ForJSIteratorResultValue(), value); 753 a.Store(AccessBuilder::ForJSIteratorResultValue(), value);
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 return literals_array_; 1273 return literals_array_;
1265 } 1274 }
1266 break; 1275 break;
1267 } 1276 }
1268 default: 1277 default:
1269 break; 1278 break;
1270 } 1279 }
1271 return MaybeHandle<LiteralsArray>(); 1280 return MaybeHandle<LiteralsArray>();
1272 } 1281 }
1273 1282
1283 MaybeHandle<Context> JSCreateLowering::GetSpecializationNativeContext(
1284 Node* node) {
1285 Node* const context = NodeProperties::GetContextInput(node);
1286 return NodeProperties::GetSpecializationNativeContext(context,
1287 native_context_);
1288 }
1289
1274 Factory* JSCreateLowering::factory() const { return isolate()->factory(); } 1290 Factory* JSCreateLowering::factory() const { return isolate()->factory(); }
1275 1291
1276 Graph* JSCreateLowering::graph() const { return jsgraph()->graph(); } 1292 Graph* JSCreateLowering::graph() const { return jsgraph()->graph(); }
1277 1293
1278 Isolate* JSCreateLowering::isolate() const { return jsgraph()->isolate(); } 1294 Isolate* JSCreateLowering::isolate() const { return jsgraph()->isolate(); }
1279 1295
1280 JSOperatorBuilder* JSCreateLowering::javascript() const { 1296 JSOperatorBuilder* JSCreateLowering::javascript() const {
1281 return jsgraph()->javascript(); 1297 return jsgraph()->javascript();
1282 } 1298 }
1283 1299
1284 CommonOperatorBuilder* JSCreateLowering::common() const { 1300 CommonOperatorBuilder* JSCreateLowering::common() const {
1285 return jsgraph()->common(); 1301 return jsgraph()->common();
1286 } 1302 }
1287 1303
1288 SimplifiedOperatorBuilder* JSCreateLowering::simplified() const { 1304 SimplifiedOperatorBuilder* JSCreateLowering::simplified() const {
1289 return jsgraph()->simplified(); 1305 return jsgraph()->simplified();
1290 } 1306 }
1291 1307
1292 MachineOperatorBuilder* JSCreateLowering::machine() const { 1308 MachineOperatorBuilder* JSCreateLowering::machine() const {
1293 return jsgraph()->machine(); 1309 return jsgraph()->machine();
1294 } 1310 }
1295 1311
1296 } // namespace compiler 1312 } // namespace compiler
1297 } // namespace internal 1313 } // namespace internal
1298 } // namespace v8 1314 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-create-lowering.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698