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

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 __ Branch(&uninitialized_this, eq, a3, Operand(at)); 2440 __ Branch(&uninitialized_this, eq, a3, Operand(at));
2441 __ li(a0, Operand(var->name())); 2441 __ li(a0, Operand(var->name()));
2442 __ Push(a0); 2442 __ Push(a0);
2443 __ CallRuntime(Runtime::kThrowReferenceError); 2443 __ CallRuntime(Runtime::kThrowReferenceError);
2444 __ bind(&uninitialized_this); 2444 __ bind(&uninitialized_this);
2445 EmitStoreToStackLocalOrContextSlot(var, location); 2445 EmitStoreToStackLocalOrContextSlot(var, location);
2446 2446
2447 } else if (!var->is_const_mode() || 2447 } else if (!var->is_const_mode() ||
2448 (var->mode() == CONST && op == Token::INIT)) { 2448 (var->mode() == CONST && op == Token::INIT)) {
2449 if (var->IsLookupSlot()) { 2449 if (var->IsLookupSlot()) {
2450 // Assignment to var. 2450 __ Push(var->name());
2451 __ li(a4, Operand(var->name())); 2451 __ Push(v0);
2452 __ li(a3, Operand(Smi::FromInt(language_mode()))); 2452 __ CallRuntime(is_strict(language_mode())
2453 // jssp[0] : language mode.
2454 // jssp[8] : name.
2455 // jssp[16] : context.
2456 // jssp[24] : value.
2457 __ Push(v0, cp, a4, a3);
2458 __ CallRuntime(Runtime::kStoreLookupSlot);
2459 } else { 2453 } else {
2460 // Assignment to var or initializing assignment to let/const in harmony 2454 // Assignment to var or initializing assignment to let/const in harmony
2461 // mode. 2455 // mode.
2462 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2456 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2463 MemOperand location = VarOperand(var, a1); 2457 MemOperand location = VarOperand(var, a1);
2464 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2458 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2465 // Check for an uninitialized let binding. 2459 // Check for an uninitialized let binding.
2466 __ ld(a2, location); 2460 __ ld(a2, location);
2467 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2461 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2468 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4)); 2462 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4));
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 Label slow, done; 2791 Label slow, done;
2798 2792
2799 SetExpressionPosition(callee); 2793 SetExpressionPosition(callee);
2800 // Generate code for loading from variables potentially shadowed by 2794 // Generate code for loading from variables potentially shadowed by
2801 // eval-introduced variables. 2795 // eval-introduced variables.
2802 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2796 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2803 2797
2804 __ bind(&slow); 2798 __ bind(&slow);
2805 // Call the runtime to find the function to call (returned in v0) 2799 // Call the runtime to find the function to call (returned in v0)
2806 // and the object holding it (returned in v1). 2800 // and the object holding it (returned in v1).
2807 DCHECK(!context_register().is(a2)); 2801 __ Push(callee->name());
2808 __ li(a2, Operand(callee->name())); 2802 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2809 __ Push(context_register(), a2);
2810 __ CallRuntime(Runtime::kLoadLookupSlot);
2811 __ Push(v0, v1); // Function, receiver. 2803 __ Push(v0, v1); // Function, receiver.
2812 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2804 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2813 2805
2814 // If fast case code has been generated, emit code to push the 2806 // If fast case code has been generated, emit code to push the
2815 // function and receiver and have the slow path jump around this 2807 // function and receiver and have the slow path jump around this
2816 // code. 2808 // code.
2817 if (done.is_linked()) { 2809 if (done.is_linked()) {
2818 Label call; 2810 Label call;
2819 __ Branch(&call); 2811 __ Branch(&call);
2820 __ bind(&done); 2812 __ bind(&done);
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 reinterpret_cast<uint64_t>( 4649 reinterpret_cast<uint64_t>(
4658 isolate->builtins()->OsrAfterStackCheck()->entry())); 4650 isolate->builtins()->OsrAfterStackCheck()->entry()));
4659 return OSR_AFTER_STACK_CHECK; 4651 return OSR_AFTER_STACK_CHECK;
4660 } 4652 }
4661 4653
4662 4654
4663 } // namespace internal 4655 } // namespace internal
4664 } // namespace v8 4656 } // namespace v8
4665 4657
4666 #endif // V8_TARGET_ARCH_MIPS64 4658 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698