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

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: 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
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 break; 1425 break;
1426 } 1426 }
1427 1427
1428 case VariableLocation::LOOKUP: { 1428 case VariableLocation::LOOKUP: {
1429 Comment cmnt(masm_, "[ Lookup variable"); 1429 Comment cmnt(masm_, "[ Lookup variable");
1430 Label done, slow; 1430 Label done, slow;
1431 // Generate code for loading from variables potentially shadowed 1431 // Generate code for loading from variables potentially shadowed
1432 // by eval-introduced variables. 1432 // by eval-introduced variables.
1433 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); 1433 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done);
1434 __ bind(&slow); 1434 __ bind(&slow);
1435 __ li(a1, Operand(var->name())); 1435 __ Push(var->name());
1436 __ Push(cp, a1); // Context and name.
1437 Runtime::FunctionId function_id = 1436 Runtime::FunctionId function_id =
1438 typeof_mode == NOT_INSIDE_TYPEOF 1437 typeof_mode == NOT_INSIDE_TYPEOF
1439 ? Runtime::kLoadLookupSlot 1438 ? Runtime::kLoadLookupSlot
1440 : Runtime::kLoadLookupSlotNoReferenceError; 1439 : Runtime::kLoadLookupSlotInsideTypeof;
1441 __ CallRuntime(function_id); 1440 __ CallRuntime(function_id);
1442 __ bind(&done); 1441 __ bind(&done);
1443 context()->Plug(v0); 1442 context()->Plug(v0);
1444 } 1443 }
1445 } 1444 }
1446 } 1445 }
1447 1446
1448 1447
1449 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1448 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
1450 Comment cmnt(masm_, "[ RegExpLiteral"); 1449 Comment cmnt(masm_, "[ RegExpLiteral");
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 __ Branch(&uninitialized_this, eq, a3, Operand(at)); 2439 __ Branch(&uninitialized_this, eq, a3, Operand(at));
2441 __ li(a0, Operand(var->name())); 2440 __ li(a0, Operand(var->name()));
2442 __ Push(a0); 2441 __ Push(a0);
2443 __ CallRuntime(Runtime::kThrowReferenceError); 2442 __ CallRuntime(Runtime::kThrowReferenceError);
2444 __ bind(&uninitialized_this); 2443 __ bind(&uninitialized_this);
2445 EmitStoreToStackLocalOrContextSlot(var, location); 2444 EmitStoreToStackLocalOrContextSlot(var, location);
2446 2445
2447 } else if (!var->is_const_mode() || 2446 } else if (!var->is_const_mode() ||
2448 (var->mode() == CONST && op == Token::INIT)) { 2447 (var->mode() == CONST && op == Token::INIT)) {
2449 if (var->IsLookupSlot()) { 2448 if (var->IsLookupSlot()) {
2450 // Assignment to var. 2449 __ Push(var->name());
2451 __ li(a4, Operand(var->name())); 2450 __ Push(v0);
2452 __ li(a3, Operand(Smi::FromInt(language_mode()))); 2451 __ CallRuntime(is_strict(language_mode())
2453 // jssp[0] : language mode. 2452 ? Runtime::kStoreLookupSlot_Strict
2454 // jssp[8] : name. 2453 : Runtime::kStoreLookupSlot_Sloppy);
2455 // jssp[16] : context.
2456 // jssp[24] : value.
2457 __ Push(v0, cp, a4, a3);
2458 __ CallRuntime(Runtime::kStoreLookupSlot);
2459 } else { 2454 } else {
2460 // Assignment to var or initializing assignment to let/const in harmony 2455 // Assignment to var or initializing assignment to let/const in harmony
2461 // mode. 2456 // mode.
2462 DCHECK((var->IsStackAllocated() || var->IsContextSlot())); 2457 DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
2463 MemOperand location = VarOperand(var, a1); 2458 MemOperand location = VarOperand(var, a1);
2464 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2459 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2465 // Check for an uninitialized let binding. 2460 // Check for an uninitialized let binding.
2466 __ ld(a2, location); 2461 __ ld(a2, location);
2467 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2462 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2468 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4)); 2463 __ Check(eq, kLetBindingReInitialization, a2, Operand(a4));
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 Label slow, done; 2792 Label slow, done;
2798 2793
2799 SetExpressionPosition(callee); 2794 SetExpressionPosition(callee);
2800 // Generate code for loading from variables potentially shadowed by 2795 // Generate code for loading from variables potentially shadowed by
2801 // eval-introduced variables. 2796 // eval-introduced variables.
2802 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2797 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2803 2798
2804 __ bind(&slow); 2799 __ bind(&slow);
2805 // Call the runtime to find the function to call (returned in v0) 2800 // Call the runtime to find the function to call (returned in v0)
2806 // and the object holding it (returned in v1). 2801 // and the object holding it (returned in v1).
2807 DCHECK(!context_register().is(a2)); 2802 __ Push(callee->name());
2808 __ li(a2, Operand(callee->name())); 2803 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2809 __ Push(context_register(), a2);
2810 __ CallRuntime(Runtime::kLoadLookupSlot);
2811 __ Push(v0, v1); // Function, receiver. 2804 __ Push(v0, v1); // Function, receiver.
2812 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2805 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2813 2806
2814 // If fast case code has been generated, emit code to push the 2807 // If fast case code has been generated, emit code to push the
2815 // function and receiver and have the slow path jump around this 2808 // function and receiver and have the slow path jump around this
2816 // code. 2809 // code.
2817 if (done.is_linked()) { 2810 if (done.is_linked()) {
2818 Label call; 2811 Label call;
2819 __ Branch(&call); 2812 __ Branch(&call);
2820 __ bind(&done); 2813 __ bind(&done);
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); 3928 __ CallRuntime(Runtime::kDeleteProperty_Sloppy);
3936 context()->Plug(v0); 3929 context()->Plug(v0);
3937 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 3930 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
3938 // Result of deleting non-global, non-dynamic variables is false. 3931 // Result of deleting non-global, non-dynamic variables is false.
3939 // The subexpression does not have side effects. 3932 // The subexpression does not have side effects.
3940 context()->Plug(is_this); 3933 context()->Plug(is_this);
3941 } else { 3934 } else {
3942 // Non-global variable. Call the runtime to try to delete from the 3935 // Non-global variable. Call the runtime to try to delete from the
3943 // context where the variable was introduced. 3936 // context where the variable was introduced.
3944 DCHECK(!context_register().is(a2)); 3937 DCHECK(!context_register().is(a2));
3945 __ li(a2, Operand(var->name())); 3938 __ Push(var->name());
3946 __ Push(context_register(), a2);
3947 __ CallRuntime(Runtime::kDeleteLookupSlot); 3939 __ CallRuntime(Runtime::kDeleteLookupSlot);
3948 context()->Plug(v0); 3940 context()->Plug(v0);
3949 } 3941 }
3950 } else { 3942 } else {
3951 // Result of deleting non-property, non-variable reference is true. 3943 // Result of deleting non-property, non-variable reference is true.
3952 // The subexpression may have side effects. 3944 // The subexpression may have side effects.
3953 VisitForEffect(expr->expression()); 3945 VisitForEffect(expr->expression());
3954 context()->Plug(true); 3946 context()->Plug(true);
3955 } 3947 }
3956 break; 3948 break;
(...skipping 700 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
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698