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

Side by Side Diff: src/ppc/full-codegen-ppc.cc

Issue 1209703002: PPC: Fix "Fix receiver when calling eval() bound by with scope" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and reapply 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 unified diff | Download patch
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | no next file » | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 if (callee->var()->IsLookupSlot()) { 3141 if (callee->var()->IsLookupSlot()) {
3142 Label slow, done; 3142 Label slow, done;
3143 SetSourcePosition(callee->position()); 3143 SetSourcePosition(callee->position());
3144 { 3144 {
3145 PreservePositionScope scope(masm()->positions_recorder()); 3145 PreservePositionScope scope(masm()->positions_recorder());
3146 // Generate code for loading from variables potentially shadowed by 3146 // Generate code for loading from variables potentially shadowed by
3147 // eval-introduced variables. 3147 // eval-introduced variables.
3148 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 3148 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
3149 } 3149 }
3150 __ bind(&slow); 3150 __ bind(&slow);
3151 // Call the runtime to find the function to call (returned in rax) and 3151 // Call the runtime to find the function to call (returned in r3) and
3152 // the object holding it (returned in rdx). 3152 // the object holding it (returned in r4).
3153 __ Push(context_register()); 3153 DCHECK(!context_register().is(r5));
3154 __ Push(callee->name()); 3154 __ mov(r5, Operand(callee->name()));
3155 __ Push(context_register(), r5);
3155 __ CallRuntime(Runtime::kLoadLookupSlot, 2); 3156 __ CallRuntime(Runtime::kLoadLookupSlot, 2);
3156 __ Push(rax); // Function. 3157 __ Push(r3, r4); // Function, receiver.
3157 __ Push(rdx); // Receiver.
3158 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 3158 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
3159 3159
3160 // If fast case code has been generated, emit code to push the function 3160 // If fast case code has been generated, emit code to push the function
3161 // and receiver and have the slow path jump around this code. 3161 // and receiver and have the slow path jump around this code.
3162 if (done.is_linked()) { 3162 if (done.is_linked()) {
3163 Label call; 3163 Label call;
3164 __ jmp(&call, Label::kNear); 3164 __ b(&call);
3165 __ bind(&done); 3165 __ bind(&done);
3166 // Push function. 3166 // Push function.
3167 __ Push(rax); 3167 __ push(r3);
3168 // Pass undefined as the receiver, which is the WithBaseObject of a 3168 // Pass undefined as the receiver, which is the WithBaseObject of a
3169 // non-object environment record. If the callee is sloppy, it will patch 3169 // non-object environment record. If the callee is sloppy, it will patch
3170 // it up to be the global receiver. 3170 // it up to be the global receiver.
3171 __ PushRoot(Heap::kUndefinedValueRootIndex); 3171 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
3172 __ push(r4);
3172 __ bind(&call); 3173 __ bind(&call);
3173 } 3174 }
3174 } else { 3175 } else {
3175 VisitForStackValue(callee); 3176 VisitForStackValue(callee);
3176 // refEnv.WithBaseObject() 3177 // refEnv.WithBaseObject()
3177 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); 3178 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
3178 __ push(r5); 3179 __ push(r5); // Reserved receiver slot.
3179 } 3180 }
3180 } 3181 }
3181 3182
3182 3183
3183 void FullCodeGenerator::VisitCall(Call* expr) { 3184 void FullCodeGenerator::VisitCall(Call* expr) {
3184 #ifdef DEBUG 3185 #ifdef DEBUG
3185 // We want to verify that RecordJSReturnSite gets called on all paths 3186 // We want to verify that RecordJSReturnSite gets called on all paths
3186 // through this function. Avoid early returns. 3187 // through this function. Avoid early returns.
3187 expr->return_is_recorded_ = false; 3188 expr->return_is_recorded_ = false;
3188 #endif 3189 #endif
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 Split(eq, if_true, if_false, fall_through); 3790 Split(eq, if_true, if_false, fall_through);
3790 3791
3791 context()->Plug(if_true, if_false); 3792 context()->Plug(if_true, if_false);
3792 } 3793 }
3793 3794
3794 3795
3795 void FullCodeGenerator::EmitArguments(CallRuntime* expr) { 3796 void FullCodeGenerator::EmitArguments(CallRuntime* expr) {
3796 ZoneList<Expression*>* args = expr->arguments(); 3797 ZoneList<Expression*>* args = expr->arguments();
3797 DCHECK(args->length() == 1); 3798 DCHECK(args->length() == 1);
3798 3799
3799 // ArgumentsAccessStub expects the key in edx and the formal 3800 // ArgumentsAccessStub expects the key in r4 and the formal
3800 // parameter count in r3. 3801 // parameter count in r3.
3801 VisitForAccumulatorValue(args->at(0)); 3802 VisitForAccumulatorValue(args->at(0));
3802 __ mr(r4, r3); 3803 __ mr(r4, r3);
3803 __ LoadSmiLiteral(r3, Smi::FromInt(info_->scope()->num_parameters())); 3804 __ LoadSmiLiteral(r3, Smi::FromInt(info_->scope()->num_parameters()));
3804 ArgumentsAccessStub stub(isolate(), ArgumentsAccessStub::READ_ELEMENT); 3805 ArgumentsAccessStub stub(isolate(), ArgumentsAccessStub::READ_ELEMENT);
3805 __ CallStub(&stub); 3806 __ CallStub(&stub);
3806 context()->Plug(r3); 3807 context()->Plug(r3);
3807 } 3808 }
3808 3809
3809 3810
(...skipping 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
5573 return ON_STACK_REPLACEMENT; 5574 return ON_STACK_REPLACEMENT;
5574 } 5575 }
5575 5576
5576 DCHECK(interrupt_address == 5577 DCHECK(interrupt_address ==
5577 isolate->builtins()->OsrAfterStackCheck()->entry()); 5578 isolate->builtins()->OsrAfterStackCheck()->entry());
5578 return OSR_AFTER_STACK_CHECK; 5579 return OSR_AFTER_STACK_CHECK;
5579 } 5580 }
5580 } // namespace internal 5581 } // namespace internal
5581 } // namespace v8 5582 } // namespace v8
5582 #endif // V8_TARGET_ARCH_PPC 5583 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/builtins-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698