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

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

Issue 1694343002: X87: [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
« no previous file with comments | « no previous file | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 context()->Plug(var); 1339 context()->Plug(var);
1340 break; 1340 break;
1341 } 1341 }
1342 1342
1343 case VariableLocation::LOOKUP: { 1343 case VariableLocation::LOOKUP: {
1344 Comment cmnt(masm_, "[ Lookup variable"); 1344 Comment cmnt(masm_, "[ Lookup variable");
1345 Label done, slow; 1345 Label done, slow;
1346 // Generate code for loading from variables potentially shadowed 1346 // Generate code for loading from variables potentially shadowed
1347 // by eval-introduced variables. 1347 // by eval-introduced variables.
1348 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done); 1348 EmitDynamicLookupFastCase(proxy, typeof_mode, &slow, &done);
1349 __ Push(var->name()); 1349 __ bind(&slow);
1350 __ push(Immediate(var->name()));
1350 Runtime::FunctionId function_id = 1351 Runtime::FunctionId function_id =
1351 typeof_mode == NOT_INSIDE_TYPEOF 1352 typeof_mode == NOT_INSIDE_TYPEOF
1352 ? Runtime::kLoadLookupSlot 1353 ? Runtime::kLoadLookupSlot
1353 : Runtime::kLoadLookupSlotInsideTypeof; 1354 : Runtime::kLoadLookupSlotInsideTypeof;
1354 __ CallRuntime(function_id); 1355 __ CallRuntime(function_id);
1355 __ bind(&done); 1356 __ bind(&done);
1356 context()->Plug(eax); 1357 context()->Plug(eax);
1357 break; 1358 break;
1358 } 1359 }
1359 } 1360 }
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 __ j(equal, &uninitialized_this); 2333 __ j(equal, &uninitialized_this);
2333 __ push(Immediate(var->name())); 2334 __ push(Immediate(var->name()));
2334 __ CallRuntime(Runtime::kThrowReferenceError); 2335 __ CallRuntime(Runtime::kThrowReferenceError);
2335 __ bind(&uninitialized_this); 2336 __ bind(&uninitialized_this);
2336 EmitStoreToStackLocalOrContextSlot(var, location); 2337 EmitStoreToStackLocalOrContextSlot(var, location);
2337 2338
2338 } else if (!var->is_const_mode() || 2339 } else if (!var->is_const_mode() ||
2339 (var->mode() == CONST && op == Token::INIT)) { 2340 (var->mode() == CONST && op == Token::INIT)) {
2340 if (var->IsLookupSlot()) { 2341 if (var->IsLookupSlot()) {
2341 // Assignment to var. 2342 // Assignment to var.
2342 __ Push(var->name()); 2343 __ Push(Immediate(var->name()));
2343 __ Push(eax); 2344 __ Push(eax);
2344 __ CallRuntime(is_strict(language_mode()) 2345 __ CallRuntime(is_strict(language_mode())
2345 ? Runtime::kStoreLookupSlot_Strict 2346 ? Runtime::kStoreLookupSlot_Strict
2346 : Runtime::kStoreLookupSlot_Sloppy); 2347 : Runtime::kStoreLookupSlot_Sloppy);
2347 } else { 2348 } else {
2348 // Assignment to var or initializing assignment to let/const in harmony 2349 // Assignment to var or initializing assignment to let/const in harmony
2349 // mode. 2350 // mode.
2350 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2351 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2351 MemOperand location = VarOperand(var, ecx); 2352 MemOperand location = VarOperand(var, ecx);
2352 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2353 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4490 Assembler::target_address_at(call_target_address, 4491 Assembler::target_address_at(call_target_address,
4491 unoptimized_code)); 4492 unoptimized_code));
4492 return OSR_AFTER_STACK_CHECK; 4493 return OSR_AFTER_STACK_CHECK;
4493 } 4494 }
4494 4495
4495 4496
4496 } // namespace internal 4497 } // namespace internal
4497 } // namespace v8 4498 } // namespace v8
4498 4499
4499 #endif // V8_TARGET_ARCH_X87 4500 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698