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

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: 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 4b9c97c5d526e3149cca91c50c10cbf58b27e30a..df35c2ab138bb1ca351e33eaec0a75b2e1602f8d 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -493,6 +493,18 @@ Node* AstGraphBuilder::GetFunctionContext() {
}
+Node* AstGraphBuilder::GetIncomingNewTarget() {
+ if (!incoming_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());
+ incoming_new_target_.set(node);
+ }
+ return incoming_new_target_.get();
+}
+
+
bool AstGraphBuilder::CreateGraph(bool stack_check) {
Scope* scope = info()->scope();
DCHECK(graph() != NULL);
@@ -3216,11 +3228,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 = GetIncomingNewTarget();
// Assign the object to the {new.target} variable. This should never lazy
// deopt, so it is fine to send invalid bailout id.

Powered by Google App Engine
This is Rietveld 408576698