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

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

Issue 1108563002: Detect simple tail calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed index type Created 5 years, 7 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/instruction-selector.cc ('k') | src/compiler/linkage.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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 // TODO(titzer): total hack to share function context constants. 485 // TODO(titzer): total hack to share function context constants.
486 // Remove this when the JSGraph canonicalizes heap constants. 486 // Remove this when the JSGraph canonicalizes heap constants.
487 Node* context = node->InputAt(index); 487 Node* context = node->InputAt(index);
488 HeapObjectMatcher<Context> context_const(context); 488 HeapObjectMatcher<Context> context_const(context);
489 if (!context_const.HasValue() || 489 if (!context_const.HasValue() ||
490 *(context_const.Value().handle()) != function->context()) { 490 *(context_const.Value().handle()) != function->context()) {
491 context = jsgraph()->HeapConstant(Handle<Context>(function->context())); 491 context = jsgraph()->HeapConstant(Handle<Context>(function->context()));
492 } 492 }
493 node->ReplaceInput(index, context); 493 node->ReplaceInput(index, context);
494 CallDescriptor* desc = Linkage::GetJSCallDescriptor( 494 CallDescriptor::Flags flags = FlagsForNode(node);
495 zone(), false, 1 + arg_count, FlagsForNode(node)); 495 if (is_strict(p.language_mode())) flags |= CallDescriptor::kSupportsTailCalls;
496 CallDescriptor* desc =
497 Linkage::GetJSCallDescriptor(zone(), false, 1 + arg_count, flags);
496 node->set_op(common()->Call(desc)); 498 node->set_op(common()->Call(desc));
497 return true; 499 return true;
498 } 500 }
499 501
500 502
501 void JSGenericLowering::LowerJSCallFunction(Node* node) { 503 void JSGenericLowering::LowerJSCallFunction(Node* node) {
502 // Fast case: call function directly. 504 // Fast case: call function directly.
503 if (TryLowerDirectJSCall(node)) return; 505 if (TryLowerDirectJSCall(node)) return;
504 506
505 // General case: CallFunctionStub. 507 // General case: CallFunctionStub.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 572 }
571 573
572 574
573 MachineOperatorBuilder* JSGenericLowering::machine() const { 575 MachineOperatorBuilder* JSGenericLowering::machine() const {
574 return jsgraph()->machine(); 576 return jsgraph()->machine();
575 } 577 }
576 578
577 } // namespace compiler 579 } // namespace compiler
578 } // namespace internal 580 } // namespace internal
579 } // namespace v8 581 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/linkage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698