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

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

Issue 1683103002: [compiler] Sanitize entry points to LookupSlot access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 5 #if V8_TARGET_ARCH_ARM
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 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 __ mov(r0, Operand(var->name())); 2447 __ mov(r0, Operand(var->name()));
2448 __ Push(r0); 2448 __ Push(r0);
2449 __ CallRuntime(Runtime::kThrowReferenceError); 2449 __ CallRuntime(Runtime::kThrowReferenceError);
2450 __ bind(&uninitialized_this); 2450 __ bind(&uninitialized_this);
2451 EmitStoreToStackLocalOrContextSlot(var, location); 2451 EmitStoreToStackLocalOrContextSlot(var, location);
2452 2452
2453 } else if (!var->is_const_mode() || 2453 } else if (!var->is_const_mode() ||
2454 (var->mode() == CONST && op == Token::INIT)) { 2454 (var->mode() == CONST && op == Token::INIT)) {
2455 if (var->IsLookupSlot()) { 2455 if (var->IsLookupSlot()) {
2456 // Assignment to var. 2456 // Assignment to var.
2457 __ push(r0); // Value. 2457 __ Push(var->name());
2458 __ mov(r1, Operand(var->name())); 2458 __ Push(r0);
2459 __ mov(r0, Operand(Smi::FromInt(language_mode()))); 2459 __ CallRuntime(is_strict(language_mode())
2460 __ Push(cp, r1, r0); // Context, name, language mode. 2460 ? Runtime::kStoreLookupSlot_Strict
2461 __ CallRuntime(Runtime::kStoreLookupSlot); 2461 : Runtime::kStoreLookupSlot_Sloppy);
2462 } else { 2462 } else {
2463 // Assignment to var or initializing assignment to let/const in harmony 2463 // Assignment to var or initializing assignment to let/const in harmony
2464 // mode. 2464 // mode.
2465 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2465 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2466 MemOperand location = VarOperand(var, r1); 2466 MemOperand location = VarOperand(var, r1);
2467 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2467 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2468 // Check for an uninitialized let binding. 2468 // Check for an uninitialized let binding.
2469 __ ldr(r2, location); 2469 __ ldr(r2, location);
2470 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex); 2470 __ CompareRoot(r2, Heap::kTheHoleValueRootIndex);
2471 __ Check(eq, kLetBindingReInitialization); 2471 __ Check(eq, kLetBindingReInitialization);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2800 if (callee->var()->IsLookupSlot()) { 2800 if (callee->var()->IsLookupSlot()) {
2801 Label slow, done; 2801 Label slow, done;
2802 SetExpressionPosition(callee); 2802 SetExpressionPosition(callee);
2803 // Generate code for loading from variables potentially shadowed 2803 // Generate code for loading from variables potentially shadowed
2804 // by eval-introduced variables. 2804 // by eval-introduced variables.
2805 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2805 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2806 2806
2807 __ bind(&slow); 2807 __ bind(&slow);
2808 // Call the runtime to find the function to call (returned in r0) 2808 // Call the runtime to find the function to call (returned in r0)
2809 // and the object holding it (returned in edx). 2809 // and the object holding it (returned in edx).
2810 DCHECK(!context_register().is(r2)); 2810 __ Push(callee->name());
2811 __ mov(r2, Operand(callee->name())); 2811 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2812 __ Push(context_register(), r2);
2813 __ CallRuntime(Runtime::kLoadLookupSlot);
2814 __ Push(r0, r1); // Function, receiver. 2812 __ Push(r0, r1); // Function, receiver.
2815 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2813 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2816 2814
2817 // If fast case code has been generated, emit code to push the 2815 // If fast case code has been generated, emit code to push the
2818 // function and receiver and have the slow path jump around this 2816 // function and receiver and have the slow path jump around this
2819 // code. 2817 // code.
2820 if (done.is_linked()) { 2818 if (done.is_linked()) {
2821 Label call; 2819 Label call;
2822 __ b(&call); 2820 __ b(&call);
2823 __ bind(&done); 2821 __ bind(&done);
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
4702 DCHECK(interrupt_address == 4700 DCHECK(interrupt_address ==
4703 isolate->builtins()->OsrAfterStackCheck()->entry()); 4701 isolate->builtins()->OsrAfterStackCheck()->entry());
4704 return OSR_AFTER_STACK_CHECK; 4702 return OSR_AFTER_STACK_CHECK;
4705 } 4703 }
4706 4704
4707 4705
4708 } // namespace internal 4706 } // namespace internal
4709 } // namespace v8 4707 } // namespace v8
4710 4708
4711 #endif // V8_TARGET_ARCH_ARM 4709 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698