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

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

Issue 1683103002: [compiler] Sanitize entry points to LookupSlot access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Fixes. Comments. 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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 break; 1423 break;
1424 } 1424 }
1425 1425
1426 case VariableLocation::LOOKUP: { 1426 case VariableLocation::LOOKUP: {
1427 Comment cmnt(masm_, "[ Lookup variable"); 1427 Comment cmnt(masm_, "[ Lookup variable");
1428 Label done, slow; 1428 Label done, slow;
1429 // Generate code for loading from variables potentially shadowed 1429 // Generate code for loading from variables potentially shadowed
1430 // by eval-introduced variables. 1430 // by eval-introduced variables.
1431 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); 1431 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done);
1432 __ bind(&slow); 1432 __ bind(&slow);
1433 __ li(a1, Operand(var->name())); 1433 __ Push(var->name());
1434 __ Push(cp, a1); // Context and name.
1435 Runtime::FunctionId function_id = 1434 Runtime::FunctionId function_id =
1436 typeof_mode == NOT_INSIDE_TYPEOF 1435 typeof_mode == NOT_INSIDE_TYPEOF
1437 ? Runtime::kLoadLookupSlot 1436 ? Runtime::kLoadLookupSlot
1438 : Runtime::kLoadLookupSlotNoReferenceError; 1437 : Runtime::kLoadLookupSlotInsideTypeof;
1439 __ CallRuntime(function_id); 1438 __ CallRuntime(function_id);
1440 __ bind(&done); 1439 __ bind(&done);
1441 context()->Plug(v0); 1440 context()->Plug(v0);
1442 } 1441 }
1443 } 1442 }
1444 } 1443 }
1445 1444
1446 1445
1447 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1446 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
1448 Comment cmnt(masm_, "[ RegExpLiteral"); 1447 Comment cmnt(masm_, "[ RegExpLiteral");
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 __ li(a0, Operand(var->name())); 2433 __ li(a0, Operand(var->name()));
2435 __ Push(a0); 2434 __ Push(a0);
2436 __ CallRuntime(Runtime::kThrowReferenceError); 2435 __ CallRuntime(Runtime::kThrowReferenceError);
2437 __ bind(&uninitialized_this); 2436 __ bind(&uninitialized_this);
2438 EmitStoreToStackLocalOrContextSlot(var, location); 2437 EmitStoreToStackLocalOrContextSlot(var, location);
2439 2438
2440 } else if (!var->is_const_mode() || 2439 } else if (!var->is_const_mode() ||
2441 (var->mode() == CONST && op == Token::INIT)) { 2440 (var->mode() == CONST && op == Token::INIT)) {
2442 if (var->IsLookupSlot()) { 2441 if (var->IsLookupSlot()) {
2443 // Assignment to var. 2442 // Assignment to var.
2444 __ li(a1, Operand(var->name())); 2443 __ Push(var->name());
2445 __ li(a0, Operand(Smi::FromInt(language_mode()))); 2444 __ Push(v0);
2446 __ Push(v0, cp, a1, a0); // Value, context, name, language mode. 2445 __ CallRuntime(is_strict(language_mode())
2447 __ CallRuntime(Runtime::kStoreLookupSlot); 2446 ? Runtime::kStoreLookupSlot_Strict
2447 : Runtime::kStoreLookupSlot_Sloppy);
2448 } else { 2448 } else {
2449 // Assignment to var or initializing assignment to let/const in harmony 2449 // Assignment to var or initializing assignment to let/const in harmony
2450 // mode. 2450 // mode.
2451 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2451 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2452 MemOperand location = VarOperand(var, a1); 2452 MemOperand location = VarOperand(var, a1);
2453 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2453 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2454 // Check for an uninitialized let binding. 2454 // Check for an uninitialized let binding.
2455 __ lw(a2, location); 2455 __ lw(a2, location);
2456 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 2456 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
2457 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0)); 2457 __ Check(eq, kLetBindingReInitialization, a2, Operand(t0));
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2787 Label slow, done; 2787 Label slow, done;
2788 2788
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 v0) 2795 // Call the runtime to find the function to call (returned in v0)
2796 // and the object holding it (returned in v1). 2796 // and the object holding it (returned in v1).
2797 DCHECK(!context_register().is(a2)); 2797 __ Push(callee->name());
2798 __ li(a2, Operand(callee->name())); 2798 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2799 __ Push(context_register(), a2);
2800 __ CallRuntime(Runtime::kLoadLookupSlot);
2801 __ Push(v0, v1); // Function, receiver. 2799 __ Push(v0, v1); // 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 2802 // If fast case code has been generated, emit code to push the
2805 // function and receiver and have the slow path jump around this 2803 // function and receiver and have the slow path jump around this
2806 // code. 2804 // code.
2807 if (done.is_linked()) { 2805 if (done.is_linked()) {
2808 Label call; 2806 Label call;
2809 __ Branch(&call); 2807 __ Branch(&call);
2810 __ bind(&done); 2808 __ bind(&done);
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3922 __ Push(a2, a1); 3920 __ Push(a2, a1);
3923 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); 3921 __ CallRuntime(Runtime::kDeleteProperty_Sloppy);
3924 context()->Plug(v0); 3922 context()->Plug(v0);
3925 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 3923 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
3926 // Result of deleting non-global, non-dynamic variables is false. 3924 // Result of deleting non-global, non-dynamic variables is false.
3927 // The subexpression does not have side effects. 3925 // The subexpression does not have side effects.
3928 context()->Plug(is_this); 3926 context()->Plug(is_this);
3929 } else { 3927 } else {
3930 // Non-global variable. Call the runtime to try to delete from the 3928 // Non-global variable. Call the runtime to try to delete from the
3931 // context where the variable was introduced. 3929 // context where the variable was introduced.
3932 DCHECK(!context_register().is(a2)); 3930 __ Push(var->name());
3933 __ li(a2, Operand(var->name()));
3934 __ Push(context_register(), a2);
3935 __ CallRuntime(Runtime::kDeleteLookupSlot); 3931 __ CallRuntime(Runtime::kDeleteLookupSlot);
3936 context()->Plug(v0); 3932 context()->Plug(v0);
3937 } 3933 }
3938 } else { 3934 } else {
3939 // Result of deleting non-property, non-variable reference is true. 3935 // Result of deleting non-property, non-variable reference is true.
3940 // The subexpression may have side effects. 3936 // The subexpression may have side effects.
3941 VisitForEffect(expr->expression()); 3937 VisitForEffect(expr->expression());
3942 context()->Plug(true); 3938 context()->Plug(true);
3943 } 3939 }
3944 break; 3940 break;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4638 reinterpret_cast<uint32_t>( 4634 reinterpret_cast<uint32_t>(
4639 isolate->builtins()->OsrAfterStackCheck()->entry())); 4635 isolate->builtins()->OsrAfterStackCheck()->entry()));
4640 return OSR_AFTER_STACK_CHECK; 4636 return OSR_AFTER_STACK_CHECK;
4641 } 4637 }
4642 4638
4643 4639
4644 } // namespace internal 4640 } // namespace internal
4645 } // namespace v8 4641 } // namespace v8
4646 4642
4647 #endif // V8_TARGET_ARCH_MIPS 4643 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698