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

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

Issue 1683103002: [compiler] Sanitize entry points to LookupSlot access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Ross comment. Created 4 years, 10 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
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 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 __ mov(r4, Operand(var->name())); 2443 __ mov(r4, Operand(var->name()));
2444 __ push(r4); 2444 __ push(r4);
2445 __ CallRuntime(Runtime::kThrowReferenceError); 2445 __ CallRuntime(Runtime::kThrowReferenceError);
2446 __ bind(&uninitialized_this); 2446 __ bind(&uninitialized_this);
2447 EmitStoreToStackLocalOrContextSlot(var, location); 2447 EmitStoreToStackLocalOrContextSlot(var, location);
2448 2448
2449 } else if (!var->is_const_mode() || 2449 } else if (!var->is_const_mode() ||
2450 (var->mode() == CONST && op == Token::INIT)) { 2450 (var->mode() == CONST && op == Token::INIT)) {
2451 if (var->IsLookupSlot()) { 2451 if (var->IsLookupSlot()) {
2452 // Assignment to var. 2452 // Assignment to var.
2453 __ push(r3); // Value. 2453 __ Push(var->name());
2454 __ mov(r4, Operand(var->name())); 2454 __ Push(r3);
2455 __ mov(r3, Operand(Smi::FromInt(language_mode()))); 2455 __ CallRuntime(is_strict(language_mode())
2456 __ Push(cp, r4, r3); // Context, name, language mode. 2456 ? Runtime::kStoreLookupSlot_Strict
2457 __ CallRuntime(Runtime::kStoreLookupSlot); 2457 : Runtime::kStoreLookupSlot_Sloppy);
2458 } else { 2458 } else {
2459 // Assignment to var or initializing assignment to let/const in harmony 2459 // Assignment to var or initializing assignment to let/const in harmony
2460 // mode. 2460 // mode.
2461 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2461 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2462 MemOperand location = VarOperand(var, r4); 2462 MemOperand location = VarOperand(var, r4);
2463 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2463 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2464 // Check for an uninitialized let binding. 2464 // Check for an uninitialized let binding.
2465 __ LoadP(r5, location); 2465 __ LoadP(r5, location);
2466 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex); 2466 __ CompareRoot(r5, Heap::kTheHoleValueRootIndex);
2467 __ Check(eq, kLetBindingReInitialization); 2467 __ Check(eq, kLetBindingReInitialization);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2787 if (callee->var()->IsLookupSlot()) { 2787 if (callee->var()->IsLookupSlot()) {
2788 Label slow, done; 2788 Label slow, done;
2789 SetExpressionPosition(callee); 2789 SetExpressionPosition(callee);
2790 // Generate code for loading from variables potentially shadowed by 2790 // Generate code for loading from variables potentially shadowed by
2791 // eval-introduced variables. 2791 // eval-introduced variables.
2792 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2792 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2793 2793
2794 __ bind(&slow); 2794 __ bind(&slow);
2795 // Call the runtime to find the function to call (returned in r3) and 2795 // Call the runtime to find the function to call (returned in r3) and
2796 // the object holding it (returned in r4). 2796 // the object holding it (returned in r4).
2797 DCHECK(!context_register().is(r5)); 2797 __ Push(callee->name());
2798 __ mov(r5, Operand(callee->name())); 2798 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2799 __ Push(context_register(), r5);
2800 __ CallRuntime(Runtime::kLoadLookupSlot);
2801 __ Push(r3, r4); // Function, receiver. 2799 __ Push(r3, r4); // Function, receiver.
2802 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2800 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2803 2801
2804 // If fast case code has been generated, emit code to push the function 2802 // If fast case code has been generated, emit code to push the function
2805 // and receiver and have the slow path jump around this code. 2803 // and receiver and have the slow path jump around this code.
2806 if (done.is_linked()) { 2804 if (done.is_linked()) {
2807 Label call; 2805 Label call;
2808 __ b(&call); 2806 __ b(&call);
2809 __ bind(&done); 2807 __ bind(&done);
2810 // Push function. 2808 // Push function.
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
4623 return ON_STACK_REPLACEMENT; 4621 return ON_STACK_REPLACEMENT;
4624 } 4622 }
4625 4623
4626 DCHECK(interrupt_address == 4624 DCHECK(interrupt_address ==
4627 isolate->builtins()->OsrAfterStackCheck()->entry()); 4625 isolate->builtins()->OsrAfterStackCheck()->entry());
4628 return OSR_AFTER_STACK_CHECK; 4626 return OSR_AFTER_STACK_CHECK;
4629 } 4627 }
4630 } // namespace internal 4628 } // namespace internal
4631 } // namespace v8 4629 } // namespace v8
4632 #endif // V8_TARGET_ARCH_PPC 4630 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698