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

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

Issue 1412223015: [turbofan] Fix receiver binding for inlined callees. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.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 ad17c2c781e8a74106bf3ef85f2c86e65fdb7494..1714b459124d9a96f8dfe8ff9ddf56ab37dd6573 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2312,8 +2312,9 @@ void AstGraphBuilder::VisitCall(Call* expr) {
// Prepare the callee and the receiver to the function call. This depends on
// the semantics of the underlying call type.
CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS;
- Node* receiver_value = NULL;
- Node* callee_value = NULL;
+ ConvertReceiverMode receiver_hint = ConvertReceiverMode::kAny;
+ Node* receiver_value = nullptr;
+ Node* callee_value = nullptr;
bool possibly_eval = false;
switch (call_type) {
case Call::GLOBAL_CALL: {
@@ -2323,6 +2324,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
callee_value =
BuildVariableLoad(proxy->var(), expr->expression()->id(), states,
pair, OutputFrameStateCombine::Push());
+ receiver_hint = ConvertReceiverMode::kNullOrUndefined;
receiver_value = jsgraph()->UndefinedConstant();
break;
}
@@ -2362,14 +2364,16 @@ void AstGraphBuilder::VisitCall(Call* expr) {
states.AddToNode(callee_value, property->LoadId(),
OutputFrameStateCombine::Push());
}
- receiver_value = environment()->Pop();
// Note that a PROPERTY_CALL requires the receiver to be wrapped into an
- // object for sloppy callees. This could also be modeled explicitly
- // here,
- // thereby obsoleting the need for a flag to the call operator.
+ // object for sloppy callees. However the receiver is guaranteed not to
+ // be null or undefined at this point.
+ receiver_hint = ConvertReceiverMode::kNotNullOrUndefined;
+ receiver_value = environment()->Pop();
flags = CALL_AS_METHOD;
} else {
+ // TODO(mstarzinger): Cleanup this special handling for super access,
+ // the stack layout seems to be completely out of sync here, fix this!
VisitForValue(property->obj()->AsSuperPropertyReference()->this_var());
VisitForValue(
property->obj()->AsSuperPropertyReference()->home_object());
@@ -2416,6 +2420,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
case Call::OTHER_CALL:
VisitForValue(callee);
callee_value = environment()->Pop();
+ receiver_hint = ConvertReceiverMode::kNullOrUndefined;
receiver_value = jsgraph()->UndefinedConstant();
break;
}
@@ -2439,7 +2444,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Node* source = environment()->Peek(arg_count - 1);
// Create node to ask for help resolving potential eval call. This will
- // provide a fully resolved callee and the corresponding receiver.
+ // provide a fully resolved callee to patch into the environment.
Node* function = GetFunctionClosure();
Node* language = jsgraph()->Constant(language_mode());
Node* position = jsgraph()->Constant(current_scope()->start_position());
@@ -2456,8 +2461,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
// Create node to perform the function call.
VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot());
- const Operator* call = javascript()->CallFunction(args->length() + 2, flags,
- language_mode(), feedback);
+ const Operator* call = javascript()->CallFunction(
+ args->length() + 2, flags, language_mode(), feedback, receiver_hint);
Node* value = ProcessArguments(call, args->length() + 2);
environment()->Push(callee_value);
PrepareFrameState(value, expr->ReturnId(), OutputFrameStateCombine::Push());
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698