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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1137703002: Add a MathFloor stub generated with TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM + co. 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/access-builder.cc ('k') | src/compiler/js-intrinsic-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/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 void AstGraphBuilder::CreateFunctionContext(bool constant_context) { 422 void AstGraphBuilder::CreateFunctionContext(bool constant_context) {
423 function_context_.set(constant_context 423 function_context_.set(constant_context
424 ? jsgraph()->HeapConstant(info()->context()) 424 ? jsgraph()->HeapConstant(info()->context())
425 : NewOuterContextParam()); 425 : NewOuterContextParam());
426 } 426 }
427 427
428 428
429 Node* AstGraphBuilder::NewOuterContextParam() { 429 Node* AstGraphBuilder::NewOuterContextParam() {
430 // Parameter (arity + 1) is special for the outer context of the function 430 // Parameter (arity + 1) is special for the outer context of the function
431 const Operator* op = 431 const Operator* op =
432 common()->Parameter(info()->num_parameters() + 1, "%context"); 432 common()->Parameter(info()->num_parameters_including_this(), "%context");
433 return NewNode(op, graph()->start()); 433 return NewNode(op, graph()->start());
434 } 434 }
435 435
436 436
437 Node* AstGraphBuilder::NewCurrentContextOsrValue() { 437 Node* AstGraphBuilder::NewCurrentContextOsrValue() {
438 // TODO(titzer): use a real OSR value here; a parameter works by accident. 438 // TODO(titzer): use a real OSR value here; a parameter works by accident.
439 // Parameter (arity + 1) is special for the outer context of the function 439 // Parameter (arity + 1) is special for the outer context of the function
440 const Operator* op = 440 const Operator* op = common()->Parameter(
441 common()->Parameter(info()->num_parameters() + 1, "%osr-context"); 441 info()->num_parameters_including_this(), "%osr-context");
442 return NewNode(op, graph()->start()); 442 return NewNode(op, graph()->start());
443 } 443 }
444 444
445 445
446 bool AstGraphBuilder::CreateGraph(bool constant_context, bool stack_check) { 446 bool AstGraphBuilder::CreateGraph(bool constant_context, bool stack_check) {
447 Scope* scope = info()->scope(); 447 Scope* scope = info()->scope();
448 DCHECK(graph() != NULL); 448 DCHECK(graph() != NULL);
449 449
450 // Set up the basic structure of the graph. 450 // Set up the basic structure of the graph.
451 int parameter_count = info()->num_parameters(); 451 int parameter_count = info()->num_parameters();
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 values_(builder_->local_zone()), 608 values_(builder_->local_zone()),
609 contexts_(builder_->local_zone()), 609 contexts_(builder_->local_zone()),
610 control_dependency_(control_dependency), 610 control_dependency_(control_dependency),
611 effect_dependency_(control_dependency), 611 effect_dependency_(control_dependency),
612 parameters_node_(nullptr), 612 parameters_node_(nullptr),
613 locals_node_(nullptr), 613 locals_node_(nullptr),
614 stack_node_(nullptr) { 614 stack_node_(nullptr) {
615 DCHECK_EQ(scope->num_parameters() + 1, parameters_count()); 615 DCHECK_EQ(scope->num_parameters() + 1, parameters_count());
616 616
617 // Bind the receiver variable. 617 // Bind the receiver variable.
618 Node* receiver = builder->graph()->NewNode(common()->Parameter(0, "%this"), 618 int param_num = 0;
619 builder->graph()->start()); 619 if (builder->info()->is_this_defined()) {
620 values()->push_back(receiver); 620 Node* receiver = builder->graph()->NewNode(
621 common()->Parameter(param_num++, "%this"), builder->graph()->start());
622 values()->push_back(receiver);
623 } else {
624 values()->push_back(builder->jsgraph()->UndefinedConstant());
625 }
621 626
622 // Bind all parameter variables. The parameter indices are shifted by 1 627 // Bind all parameter variables. The parameter indices are shifted by 1
623 // (receiver is parameter index -1 but environment index 0). 628 // (receiver is parameter index -1 but environment index 0).
624 for (int i = 0; i < scope->num_parameters(); ++i) { 629 for (int i = 0; i < scope->num_parameters(); ++i) {
625 const char* debug_name = GetDebugParameterName(graph()->zone(), scope, i); 630 const char* debug_name = GetDebugParameterName(graph()->zone(), scope, i);
626 Node* parameter = builder->graph()->NewNode( 631 Node* parameter =
627 common()->Parameter(i + 1, debug_name), builder->graph()->start()); 632 builder->graph()->NewNode(common()->Parameter(param_num++, debug_name),
633 builder->graph()->start());
628 values()->push_back(parameter); 634 values()->push_back(parameter);
629 } 635 }
630 636
631 // Bind all local variables to undefined. 637 // Bind all local variables to undefined.
632 Node* undefined_constant = builder->jsgraph()->UndefinedConstant(); 638 Node* undefined_constant = builder->jsgraph()->UndefinedConstant();
633 values()->insert(values()->end(), locals_count(), undefined_constant); 639 values()->insert(values()->end(), locals_count(), undefined_constant);
634 } 640 }
635 641
636 642
637 AstGraphBuilder::Environment::Environment(AstGraphBuilder::Environment* copy) 643 AstGraphBuilder::Environment::Environment(AstGraphBuilder::Environment* copy)
(...skipping 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 // Phi does not exist yet, introduce one. 3574 // Phi does not exist yet, introduce one.
3569 value = NewPhi(inputs, value, control); 3575 value = NewPhi(inputs, value, control);
3570 value->ReplaceInput(inputs - 1, other); 3576 value->ReplaceInput(inputs - 1, other);
3571 } 3577 }
3572 return value; 3578 return value;
3573 } 3579 }
3574 3580
3575 } // namespace compiler 3581 } // namespace compiler
3576 } // namespace internal 3582 } // namespace internal
3577 } // namespace v8 3583 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/access-builder.cc ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698