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

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

Issue 2272393002: Version 5.4.500.1 (cherry-pick) (Closed)
Patch Set: Created 4 years, 3 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') | test/mjsunit/regress/regress-crbug-640369.js » ('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-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
11 #include "src/compiler/ast-graph-builder.h" 11 #include "src/compiler/ast-graph-builder.h"
12 #include "src/compiler/ast-loop-assignment-analyzer.h" 12 #include "src/compiler/ast-loop-assignment-analyzer.h"
13 #include "src/compiler/common-operator.h" 13 #include "src/compiler/common-operator.h"
14 #include "src/compiler/graph-reducer.h" 14 #include "src/compiler/graph-reducer.h"
15 #include "src/compiler/js-operator.h" 15 #include "src/compiler/js-operator.h"
16 #include "src/compiler/node-matchers.h" 16 #include "src/compiler/node-matchers.h"
17 #include "src/compiler/node-properties.h" 17 #include "src/compiler/node-properties.h"
18 #include "src/compiler/operator-properties.h" 18 #include "src/compiler/operator-properties.h"
19 #include "src/compiler/simplified-operator.h"
19 #include "src/compiler/type-hint-analyzer.h" 20 #include "src/compiler/type-hint-analyzer.h"
20 #include "src/isolate-inl.h" 21 #include "src/isolate-inl.h"
21 #include "src/parsing/parse-info.h" 22 #include "src/parsing/parse-info.h"
22 #include "src/parsing/rewriter.h" 23 #include "src/parsing/rewriter.h"
23 24
24 namespace v8 { 25 namespace v8 {
25 namespace internal { 26 namespace internal {
26 namespace compiler { 27 namespace compiler {
27 28
28 #define TRACE(...) \ 29 #define TRACE(...) \
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (NeedsImplicitReceiver(shared_info)) { 429 if (NeedsImplicitReceiver(shared_info)) {
429 Node* frame_state_before = NodeProperties::FindFrameStateBefore(node); 430 Node* frame_state_before = NodeProperties::FindFrameStateBefore(node);
430 Node* effect = NodeProperties::GetEffectInput(node); 431 Node* effect = NodeProperties::GetEffectInput(node);
431 Node* context = NodeProperties::GetContextInput(node); 432 Node* context = NodeProperties::GetContextInput(node);
432 Node* create = graph()->NewNode(javascript()->Create(), call.target(), 433 Node* create = graph()->NewNode(javascript()->Create(), call.target(),
433 call.new_target(), context, 434 call.new_target(), context,
434 frame_state_before, effect); 435 frame_state_before, effect);
435 NodeProperties::ReplaceEffectInput(node, create); 436 NodeProperties::ReplaceEffectInput(node, create);
436 // Insert a check of the return value to determine whether the return 437 // Insert a check of the return value to determine whether the return
437 // value or the implicit receiver should be selected as a result of the 438 // value or the implicit receiver should be selected as a result of the
438 // call. The check is wired into the successful control completion. 439 // call.
439 Node* success = graph()->NewNode(common()->IfSuccess(), node); 440 Node* check = graph()->NewNode(simplified()->ObjectIsReceiver(), node);
440 Node* check = graph()->NewNode(
441 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), node,
442 context, node, success);
443 Node* select = 441 Node* select =
444 graph()->NewNode(common()->Select(MachineRepresentation::kTagged), 442 graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
445 check, node, create); 443 check, node, create);
446 NodeProperties::ReplaceUses(node, select, check, check, node); 444 NodeProperties::ReplaceUses(node, select, node, node, node);
447 // Fix-up inputs that have been mangled by the {ReplaceUses} call above. 445 // Fix-up inputs that have been mangled by the {ReplaceUses} call above.
448 NodeProperties::ReplaceValueInput(select, node, 1); // Fix-up input. 446 NodeProperties::ReplaceValueInput(select, node, 1); // Fix-up input.
449 NodeProperties::ReplaceValueInput(check, node, 0); // Fix-up input. 447 NodeProperties::ReplaceValueInput(check, node, 0); // Fix-up input.
450 NodeProperties::ReplaceEffectInput(check, node); // Fix-up input.
451 NodeProperties::ReplaceControlInput(success, node); // Fix-up input.
452 receiver = create; // The implicit receiver. 448 receiver = create; // The implicit receiver.
453 } 449 }
454 450
455 // Swizzle the inputs of the {JSCallConstruct} node to look like inputs to a 451 // Swizzle the inputs of the {JSCallConstruct} node to look like inputs to a
456 // normal {JSCallFunction} node so that the rest of the inlining machinery 452 // normal {JSCallFunction} node so that the rest of the inlining machinery
457 // behaves as if we were dealing with a regular function invocation. 453 // behaves as if we were dealing with a regular function invocation.
458 new_target = call.new_target(); // Retrieve new target value input. 454 new_target = call.new_target(); // Retrieve new target value input.
459 node->RemoveInput(call.formal_arguments() + 1); // Drop new target. 455 node->RemoveInput(call.formal_arguments() + 1); // Drop new target.
460 node->InsertInput(graph()->zone(), 1, receiver); 456 node->InsertInput(graph()->zone(), 1, receiver);
461 457
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 } 516 }
521 517
522 Graph* JSInliner::graph() const { return jsgraph()->graph(); } 518 Graph* JSInliner::graph() const { return jsgraph()->graph(); }
523 519
524 JSOperatorBuilder* JSInliner::javascript() const { 520 JSOperatorBuilder* JSInliner::javascript() const {
525 return jsgraph()->javascript(); 521 return jsgraph()->javascript();
526 } 522 }
527 523
528 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); } 524 CommonOperatorBuilder* JSInliner::common() const { return jsgraph()->common(); }
529 525
526 SimplifiedOperatorBuilder* JSInliner::simplified() const {
527 return jsgraph()->simplified();
528 }
529
530 } // namespace compiler 530 } // namespace compiler
531 } // namespace internal 531 } // namespace internal
532 } // namespace v8 532 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.h ('k') | test/mjsunit/regress/regress-crbug-640369.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698