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

Side by Side Diff: src/compiler/js-inlining.cc

Issue 2858933004: [turbofan] Lower monomorphic loads during graph building.
Patch Set: Prune headers Created 3 years, 6 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-inlining.h ('k') | src/compiler/js-type-hint-lowering.h » ('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/compiler/js-inlining.h" 5 #include "src/compiler/js-inlining.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/compiler/all-nodes.h" 10 #include "src/compiler/all-nodes.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); 367 Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value());
368 368
369 // Disallow cross native-context inlining for now. This means that all parts 369 // Disallow cross native-context inlining for now. This means that all parts
370 // of the resulting code will operate on the same global object. This also 370 // of the resulting code will operate on the same global object. This also
371 // prevents cross context leaks, where we could inline functions from a 371 // prevents cross context leaks, where we could inline functions from a
372 // different context and hold on to that context (and closure) from the code 372 // different context and hold on to that context (and closure) from the code
373 // object. 373 // object.
374 // TODO(turbofan): We might want to revisit this restriction later when we 374 // TODO(turbofan): We might want to revisit this restriction later when we
375 // have a need for this, and we know how to model different native contexts 375 // have a need for this, and we know how to model different native contexts
376 // in the same graph in a compositional way. 376 // in the same graph in a compositional way.
377 if (function->context()->native_context() != 377 if (function->context()->native_context() != *native_context()) {
378 info_->context()->native_context()) {
379 return false; 378 return false;
380 } 379 }
381 380
382 shared_info_out = handle(function->shared()); 381 shared_info_out = handle(function->shared());
383 return true; 382 return true;
384 } 383 }
385 384
386 // This reducer can also handle calls where the target is statically known to 385 // This reducer can also handle calls where the target is statically known to
387 // be the result of a closure instantiation operation, as follows: 386 // be the result of a closure instantiation operation, as follows:
388 // - JSCall(JSCreateClosure[shared](context), receiver, args...) 387 // - JSCall(JSCreateClosure[shared](context), receiver, args...)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 446
448 // Must succeed. 447 // Must succeed.
449 UNREACHABLE(); 448 UNREACHABLE();
450 } 449 }
451 450
452 Reduction JSInliner::Reduce(Node* node) { 451 Reduction JSInliner::Reduce(Node* node) {
453 if (!IrOpcode::IsInlineeOpcode(node->opcode())) return NoChange(); 452 if (!IrOpcode::IsInlineeOpcode(node->opcode())) return NoChange();
454 return ReduceJSCall(node); 453 return ReduceJSCall(node);
455 } 454 }
456 455
456 Handle<Context> JSInliner::native_context() const {
457 return handle(info_->context()->native_context());
458 }
459
457 Reduction JSInliner::ReduceJSCall(Node* node) { 460 Reduction JSInliner::ReduceJSCall(Node* node) {
458 DCHECK(IrOpcode::IsInlineeOpcode(node->opcode())); 461 DCHECK(IrOpcode::IsInlineeOpcode(node->opcode()));
459 Handle<SharedFunctionInfo> shared_info; 462 Handle<SharedFunctionInfo> shared_info;
460 JSCallAccessor call(node); 463 JSCallAccessor call(node);
461 464
462 // Determine the call target. 465 // Determine the call target.
463 if (!DetermineCallTarget(node, shared_info)) return NoChange(); 466 if (!DetermineCallTarget(node, shared_info)) return NoChange();
464 467
465 // Inlining is only supported in the bytecode pipeline. 468 // Inlining is only supported in the bytecode pipeline.
466 if (!info_->is_optimizing_from_bytecode()) { 469 if (!info_->is_optimizing_from_bytecode()) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 Node* end; 577 Node* end;
575 { 578 {
576 // Run the BytecodeGraphBuilder to create the subgraph. 579 // Run the BytecodeGraphBuilder to create the subgraph.
577 Graph::SubgraphScope scope(graph()); 580 Graph::SubgraphScope scope(graph());
578 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags; 581 JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags;
579 if (info_->is_bailout_on_uninitialized()) { 582 if (info_->is_bailout_on_uninitialized()) {
580 flags |= JSTypeHintLowering::kBailoutOnUninitialized; 583 flags |= JSTypeHintLowering::kBailoutOnUninitialized;
581 } 584 }
582 BytecodeGraphBuilder graph_builder( 585 BytecodeGraphBuilder graph_builder(
583 parse_info.zone(), shared_info, feedback_vector, BailoutId::None(), 586 parse_info.zone(), shared_info, feedback_vector, BailoutId::None(),
584 jsgraph(), call.frequency(), source_positions_, inlining_id, flags); 587 jsgraph(), call.frequency(), source_positions_, native_context(),
588 info_->dependencies(), inlining_id, flags);
585 graph_builder.CreateGraph(false); 589 graph_builder.CreateGraph(false);
586 590
587 // Extract the inlinee start/end nodes. 591 // Extract the inlinee start/end nodes.
588 start = graph()->start(); 592 start = graph()->start();
589 end = graph()->end(); 593 end = graph()->end();
590 } 594 }
591 595
592 // If we are inlining into a surrounding exception handler, we collect all 596 // If we are inlining into a surrounding exception handler, we collect all
593 // potentially throwing nodes within the inlinee that are not handled locally 597 // potentially throwing nodes within the inlinee that are not handled locally
594 // by the inlinee itself. They are later wired into the surrounding handler. 598 // by the inlinee itself. They are later wired into the surrounding handler.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 794
791 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } 795 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); }
792 796
793 SimplifiedOperatorBuilder* JSInliner::simplified() const { 797 SimplifiedOperatorBuilder* JSInliner::simplified() const {
794 return jsgraph()->simplified(); 798 return jsgraph()->simplified();
795 } 799 }
796 800
797 } // namespace compiler 801 } // namespace compiler
798 } // namespace internal 802 } // namespace internal
799 } // namespace v8 803 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.h ('k') | src/compiler/js-type-hint-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698