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

Side by Side Diff: src/full-codegen/arm64/full-codegen-arm64.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/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
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 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 break; 1415 break;
1416 } 1416 }
1417 1417
1418 case VariableLocation::LOOKUP: { 1418 case VariableLocation::LOOKUP: {
1419 Label done, slow; 1419 Label done, slow;
1420 // Generate code for loading from variables potentially shadowed by 1420 // Generate code for loading from variables potentially shadowed by
1421 // eval-introduced variables. 1421 // eval-introduced variables.
1422 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); 1422 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done);
1423 __ Bind(&slow); 1423 __ Bind(&slow);
1424 Comment cmnt(masm_, "Lookup variable"); 1424 Comment cmnt(masm_, "Lookup variable");
1425 __ Mov(x1, Operand(var->name())); 1425 __ Push(var->name());
1426 __ Push(cp, x1); // Context and name.
1427 Runtime::FunctionId function_id = 1426 Runtime::FunctionId function_id =
1428 typeof_mode == NOT_INSIDE_TYPEOF 1427 typeof_mode == NOT_INSIDE_TYPEOF
1429 ? Runtime::kLoadLookupSlot 1428 ? Runtime::kLoadLookupSlot
1430 : Runtime::kLoadLookupSlotNoReferenceError; 1429 : Runtime::kLoadLookupSlotInsideTypeof;
1431 __ CallRuntime(function_id); 1430 __ CallRuntime(function_id);
1432 __ Bind(&done); 1431 __ Bind(&done);
1433 context()->Plug(x0); 1432 context()->Plug(x0);
1434 break; 1433 break;
1435 } 1434 }
1436 } 1435 }
1437 } 1436 }
1438 1437
1439 1438
1440 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1439 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 __ Mov(x0, Operand(var->name())); 2242 __ Mov(x0, Operand(var->name()));
2244 __ Push(x0); 2243 __ Push(x0);
2245 __ CallRuntime(Runtime::kThrowReferenceError); 2244 __ CallRuntime(Runtime::kThrowReferenceError);
2246 __ bind(&uninitialized_this); 2245 __ bind(&uninitialized_this);
2247 EmitStoreToStackLocalOrContextSlot(var, location); 2246 EmitStoreToStackLocalOrContextSlot(var, location);
2248 2247
2249 } else if (!var->is_const_mode() || 2248 } else if (!var->is_const_mode() ||
2250 (var->mode() == CONST && op == Token::INIT)) { 2249 (var->mode() == CONST && op == Token::INIT)) {
2251 if (var->IsLookupSlot()) { 2250 if (var->IsLookupSlot()) {
2252 // Assignment to var. 2251 // Assignment to var.
2253 __ Mov(x11, Operand(var->name())); 2252 __ Push(var->name());
2254 __ Mov(x10, Smi::FromInt(language_mode())); 2253 __ Push(x0);
2255 // jssp[0] : mode. 2254 __ CallRuntime(is_strict(language_mode())
2256 // jssp[8] : name. 2255 ? Runtime::kStoreLookupSlot_Strict
2257 // jssp[16] : context. 2256 : Runtime::kStoreLookupSlot_Sloppy);
2258 // jssp[24] : value.
2259 __ Push(x0, cp, x11, x10);
2260 __ CallRuntime(Runtime::kStoreLookupSlot);
2261 } else { 2257 } else {
2262 // Assignment to var or initializing assignment to let/const in harmony 2258 // Assignment to var or initializing assignment to let/const in harmony
2263 // mode. 2259 // mode.
2264 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2260 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2265 MemOperand location = VarOperand(var, x1); 2261 MemOperand location = VarOperand(var, x1);
2266 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { 2262 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
2267 __ Ldr(x10, location); 2263 __ Ldr(x10, location);
2268 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex); 2264 __ CompareRoot(x10, Heap::kTheHoleValueRootIndex);
2269 __ Check(eq, kLetBindingReInitialization); 2265 __ Check(eq, kLetBindingReInitialization);
2270 } 2266 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 if (callee->var()->IsLookupSlot()) { 2604 if (callee->var()->IsLookupSlot()) {
2609 Label slow, done; 2605 Label slow, done;
2610 SetExpressionPosition(callee); 2606 SetExpressionPosition(callee);
2611 // Generate code for loading from variables potentially shadowed 2607 // Generate code for loading from variables potentially shadowed
2612 // by eval-introduced variables. 2608 // by eval-introduced variables.
2613 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2609 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2614 2610
2615 __ Bind(&slow); 2611 __ Bind(&slow);
2616 // Call the runtime to find the function to call (returned in x0) 2612 // Call the runtime to find the function to call (returned in x0)
2617 // and the object holding it (returned in x1). 2613 // and the object holding it (returned in x1).
2618 __ Mov(x10, Operand(callee->name())); 2614 __ Push(callee->name());
2619 __ Push(context_register(), x10); 2615 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2620 __ CallRuntime(Runtime::kLoadLookupSlot);
2621 __ Push(x0, x1); // Receiver, function. 2616 __ Push(x0, x1); // Receiver, function.
2622 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2617 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2623 2618
2624 // If fast case code has been generated, emit code to push the 2619 // If fast case code has been generated, emit code to push the
2625 // function and receiver and have the slow path jump around this 2620 // function and receiver and have the slow path jump around this
2626 // code. 2621 // code.
2627 if (done.is_linked()) { 2622 if (done.is_linked()) {
2628 Label call; 2623 Label call;
2629 __ B(&call); 2624 __ B(&call);
2630 __ Bind(&done); 2625 __ Bind(&done);
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
3729 __ Push(x12, x11); 3724 __ Push(x12, x11);
3730 __ CallRuntime(Runtime::kDeleteProperty_Sloppy); 3725 __ CallRuntime(Runtime::kDeleteProperty_Sloppy);
3731 context()->Plug(x0); 3726 context()->Plug(x0);
3732 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 3727 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
3733 // Result of deleting non-global, non-dynamic variables is false. 3728 // Result of deleting non-global, non-dynamic variables is false.
3734 // The subexpression does not have side effects. 3729 // The subexpression does not have side effects.
3735 context()->Plug(is_this); 3730 context()->Plug(is_this);
3736 } else { 3731 } else {
3737 // Non-global variable. Call the runtime to try to delete from the 3732 // Non-global variable. Call the runtime to try to delete from the
3738 // context where the variable was introduced. 3733 // context where the variable was introduced.
3739 __ Mov(x2, Operand(var->name())); 3734 __ Push(var->name());
3740 __ Push(context_register(), x2);
3741 __ CallRuntime(Runtime::kDeleteLookupSlot); 3735 __ CallRuntime(Runtime::kDeleteLookupSlot);
3742 context()->Plug(x0); 3736 context()->Plug(x0);
3743 } 3737 }
3744 } else { 3738 } else {
3745 // Result of deleting non-property, non-variable reference is true. 3739 // Result of deleting non-property, non-variable reference is true.
3746 // The subexpression may have side effects. 3740 // The subexpression may have side effects.
3747 VisitForEffect(expr->expression()); 3741 VisitForEffect(expr->expression());
3748 context()->Plug(true); 3742 context()->Plug(true);
3749 } 3743 }
3750 break; 3744 break;
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 } 4676 }
4683 4677
4684 return INTERRUPT; 4678 return INTERRUPT;
4685 } 4679 }
4686 4680
4687 4681
4688 } // namespace internal 4682 } // namespace internal
4689 } // namespace v8 4683 } // namespace v8
4690 4684
4691 #endif // V8_TARGET_ARCH_ARM64 4685 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698