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

Unified Diff: src/ppc/full-codegen-ppc.cc

Issue 1201273004: Revert of Fix receiver when calling eval() bound by with scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 6 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 | « src/mips64/full-codegen-mips64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/full-codegen-ppc.cc
diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc
index 0b061926f63a8ed80243d89bee6b70ddd3e6e8b8..ddb71b58cea2e3b373a0a7d2b3407fb527ef632e 100644
--- a/src/ppc/full-codegen-ppc.cc
+++ b/src/ppc/full-codegen-ppc.cc
@@ -3125,51 +3125,6 @@
}
-// See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls.
-void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
- VariableProxy* callee = expr->expression()->AsVariableProxy();
- if (callee->var()->IsLookupSlot()) {
- Label slow, done;
-
- {
- PreservePositionScope scope(masm()->positions_recorder());
- // Generate code for loading from variables potentially shadowed by
- // eval-introduced variables.
- EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
- }
- __ bind(&slow);
- // Call the runtime to find the function to call (returned in rax) and
- // the object holding it (returned in rdx).
- __ Push(context_register());
- __ Push(callee->name());
- __ CallRuntime(Runtime::kLoadLookupSlot, 2);
- __ Push(rax); // Function.
- __ Push(rdx); // Receiver.
- PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
-
- // If fast case code has been generated, emit code to push the function
- // and receiver and have the slow path jump around this code.
- if (done.is_linked()) {
- Label call;
- __ jmp(&call, Label::kNear);
- __ bind(&done);
- // Push function.
- __ Push(rax);
- // Pass undefined as the receiver, which is the WithBaseObject of a
- // non-object environment record. If the callee is sloppy, it will patch
- // it up to be the global receiver.
- __ PushRoot(Heap::kUndefinedValueRootIndex);
- __ bind(&call);
- }
- } else {
- VisitForStackValue(callee);
- // refEnv.WithBaseObject()
- __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
- __ push(r5);
- }
-}
-
-
void FullCodeGenerator::VisitCall(Call* expr) {
#ifdef DEBUG
// We want to verify that RecordJSReturnSite gets called on all paths
@@ -3190,7 +3145,9 @@
{
PreservePositionScope pos_scope(masm()->positions_recorder());
- PushCalleeAndWithBaseObject(expr);
+ VisitForStackValue(callee);
+ __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
+ __ push(r5); // Reserved receiver slot.
// Push the arguments.
for (int i = 0; i < arg_count; i++) {
@@ -3206,7 +3163,7 @@
// Touch up the stack with the resolved function.
__ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
- PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
+ PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
}
// Record source position for debugger.
@@ -3223,7 +3180,44 @@
} else if (call_type == Call::LOOKUP_SLOT_CALL) {
// Call to a lookup slot (dynamically introduced variable).
- PushCalleeAndWithBaseObject(expr);
+ VariableProxy* proxy = callee->AsVariableProxy();
+ Label slow, done;
+
+ {
+ PreservePositionScope scope(masm()->positions_recorder());
+ // Generate code for loading from variables potentially shadowed
+ // by eval-introduced variables.
+ EmitDynamicLookupFastCase(proxy, NOT_INSIDE_TYPEOF, &slow, &done);
+ }
+
+ __ bind(&slow);
+ // Call the runtime to find the function to call (returned in r3)
+ // and the object holding it (returned in edx).
+ DCHECK(!context_register().is(r5));
+ __ mov(r5, Operand(proxy->name()));
+ __ Push(context_register(), r5);
+ __ CallRuntime(Runtime::kLoadLookupSlot, 2);
+ __ Push(r3, r4); // Function, receiver.
+ PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
+
+ // If fast case code has been generated, emit code to push the
+ // function and receiver and have the slow path jump around this
+ // code.
+ if (done.is_linked()) {
+ Label call;
+ __ b(&call);
+ __ bind(&done);
+ // Push function.
+ __ push(r3);
+ // The receiver is implicitly the global receiver. Indicate this
+ // by passing the hole to the call function stub.
+ __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
+ __ push(r4);
+ __ bind(&call);
+ }
+
+ // The receiver is either the global receiver or an object found
+ // by LoadContextSlot.
EmitCall(expr);
} else if (call_type == Call::PROPERTY_CALL) {
Property* property = callee->AsProperty();
« no previous file with comments | « src/mips64/full-codegen-mips64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698