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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2658853002: [turbofan] Don't try to optimize tail calls to .apply. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | test/mjsunit/regress/regress-crbug-685634.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 NodeProperties::ChangeOp(node, javascript()->ToNumber()); 72 NodeProperties::ChangeOp(node, javascript()->ToNumber());
73 return Changed(node); 73 return Changed(node);
74 } 74 }
75 75
76 76
77 // ES6 section 19.2.3.1 Function.prototype.apply ( thisArg, argArray ) 77 // ES6 section 19.2.3.1 Function.prototype.apply ( thisArg, argArray )
78 Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) { 78 Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
79 DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); 79 DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode());
80 Node* target = NodeProperties::GetValueInput(node, 0); 80 Node* target = NodeProperties::GetValueInput(node, 0);
81 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); 81 CallFunctionParameters const& p = CallFunctionParametersOf(node->op());
82 // Tail calls to Function.prototype.apply are not properly supported
83 // down the pipeline, so we disable this optimization completely for
84 // tail calls (for now).
85 if (p.tail_call_mode() == TailCallMode::kAllow) return NoChange();
82 Handle<JSFunction> apply = 86 Handle<JSFunction> apply =
83 Handle<JSFunction>::cast(HeapObjectMatcher(target).Value()); 87 Handle<JSFunction>::cast(HeapObjectMatcher(target).Value());
84 size_t arity = p.arity(); 88 size_t arity = p.arity();
85 DCHECK_LE(2u, arity); 89 DCHECK_LE(2u, arity);
86 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny; 90 ConvertReceiverMode convert_mode = ConvertReceiverMode::kAny;
87 if (arity == 2) { 91 if (arity == 2) {
88 // Neither thisArg nor argArray was provided. 92 // Neither thisArg nor argArray was provided.
89 convert_mode = ConvertReceiverMode::kNullOrUndefined; 93 convert_mode = ConvertReceiverMode::kNullOrUndefined;
90 node->ReplaceInput(0, node->InputAt(1)); 94 node->ReplaceInput(0, node->InputAt(1));
91 node->ReplaceInput(1, jsgraph()->UndefinedConstant()); 95 node->ReplaceInput(1, jsgraph()->UndefinedConstant());
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 return jsgraph()->javascript(); 703 return jsgraph()->javascript();
700 } 704 }
701 705
702 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { 706 SimplifiedOperatorBuilder* JSCallReducer::simplified() const {
703 return jsgraph()->simplified(); 707 return jsgraph()->simplified();
704 } 708 }
705 709
706 } // namespace compiler 710 } // namespace compiler
707 } // namespace internal 711 } // namespace internal
708 } // namespace v8 712 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-685634.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698