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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1460503008: [turbofan] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_turbofan-pass-new-target-6
Patch Set: Ported to MIPS64. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 0afd13d3f5722533766ef7b48fb872992b246b48..ba84990a27b006fa042f1b0c9778472d30cad54d 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -493,6 +493,18 @@ Node* AstGraphBuilder::GetFunctionContext() {
}
+Node* AstGraphBuilder::GetNewTarget() {
+ if (!new_target_.is_set()) {
+ int params = info()->num_parameters_including_this();
+ int index = Linkage::GetJSCallNewTargetParamIndex(params);
+ const Operator* op = common()->Parameter(index, "%new.target");
+ Node* node = NewNode(op, graph()->start());
+ new_target_.set(node);
+ }
+ return new_target_.get();
+}
+
+
bool AstGraphBuilder::CreateGraph(bool stack_check) {
Scope* scope = info()->scope();
DCHECK(graph() != NULL);
@@ -3219,11 +3231,8 @@ Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) {
Node* AstGraphBuilder::BuildNewTargetVariable(Variable* new_target_var) {
if (new_target_var == nullptr) return nullptr;
- // Retrieve the new target in case we are called as a constructor.
- const Operator* op = javascript()->CallRuntime(Runtime::kGetNewTarget, 0);
- Node* object = NewNode(op);
- // TODO(4544): Bailout id only needed for JavaScriptFrame::Summarize.
- PrepareFrameState(object, BailoutId::FunctionContext());
+ // Retrieve the new target we were called with.
+ Node* object = GetNewTarget();
// Assign the object to the {new.target} variable. This should never lazy
// deopt, so it is fine to send invalid bailout id.
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698