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

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

Issue 1683103002: [compiler] Sanitize entry points to LookupSlot access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Ross comment. 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_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 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 __ j(equal, &uninitialized_this); 2342 __ j(equal, &uninitialized_this);
2343 __ push(Immediate(var->name())); 2343 __ push(Immediate(var->name()));
2344 __ CallRuntime(Runtime::kThrowReferenceError); 2344 __ CallRuntime(Runtime::kThrowReferenceError);
2345 __ bind(&uninitialized_this); 2345 __ bind(&uninitialized_this);
2346 EmitStoreToStackLocalOrContextSlot(var, location); 2346 EmitStoreToStackLocalOrContextSlot(var, location);
2347 2347
2348 } else if (!var->is_const_mode() || 2348 } else if (!var->is_const_mode() ||
2349 (var->mode() == CONST && op == Token::INIT)) { 2349 (var->mode() == CONST && op == Token::INIT)) {
2350 if (var->IsLookupSlot()) { 2350 if (var->IsLookupSlot()) {
2351 // Assignment to var. 2351 // Assignment to var.
2352 __ push(eax); // Value. 2352 __ Push(var->name());
2353 __ push(esi); // Context. 2353 __ Push(eax);
2354 __ push(Immediate(var->name())); 2354 __ CallRuntime(is_strict(language_mode())
2355 __ push(Immediate(Smi::FromInt(language_mode()))); 2355 ? Runtime::kStoreLookupSlot_Strict
2356 __ CallRuntime(Runtime::kStoreLookupSlot); 2356 : Runtime::kStoreLookupSlot_Sloppy);
2357 } else { 2357 } else {
2358 // Assignment to var or initializing assignment to let/const in harmony 2358 // Assignment to var or initializing assignment to let/const in harmony
2359 // mode. 2359 // mode.
2360 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2360 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2361 MemOperand location = VarOperand(var, ecx); 2361 MemOperand location = VarOperand(var, ecx);
2362 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { 2362 if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) {
2363 // Check for an uninitialized let binding. 2363 // Check for an uninitialized let binding.
2364 __ mov(edx, location); 2364 __ mov(edx, location);
2365 __ cmp(edx, isolate()->factory()->the_hole_value()); 2365 __ cmp(edx, isolate()->factory()->the_hole_value());
2366 __ Check(equal, kLetBindingReInitialization); 2366 __ Check(equal, kLetBindingReInitialization);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 if (callee->var()->IsLookupSlot()) { 2686 if (callee->var()->IsLookupSlot()) {
2687 Label slow, done; 2687 Label slow, done;
2688 SetExpressionPosition(callee); 2688 SetExpressionPosition(callee);
2689 // Generate code for loading from variables potentially shadowed by 2689 // Generate code for loading from variables potentially shadowed by
2690 // eval-introduced variables. 2690 // eval-introduced variables.
2691 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); 2691 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done);
2692 2692
2693 __ bind(&slow); 2693 __ bind(&slow);
2694 // Call the runtime to find the function to call (returned in eax) and 2694 // Call the runtime to find the function to call (returned in eax) and
2695 // the object holding it (returned in edx). 2695 // the object holding it (returned in edx).
2696 __ push(context_register()); 2696 __ Push(callee->name());
2697 __ push(Immediate(callee->name())); 2697 __ CallRuntime(Runtime::kLoadLookupSlotForCall);
2698 __ CallRuntime(Runtime::kLoadLookupSlot); 2698 __ Push(eax); // Function.
2699 __ push(eax); // Function. 2699 __ Push(edx); // Receiver.
2700 __ push(edx); // Receiver.
2701 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); 2700 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS);
2702 2701
2703 // If fast case code has been generated, emit code to push the function 2702 // If fast case code has been generated, emit code to push the function
2704 // and receiver and have the slow path jump around this code. 2703 // and receiver and have the slow path jump around this code.
2705 if (done.is_linked()) { 2704 if (done.is_linked()) {
2706 Label call; 2705 Label call;
2707 __ jmp(&call, Label::kNear); 2706 __ jmp(&call, Label::kNear);
2708 __ bind(&done); 2707 __ bind(&done);
2709 // Push function. 2708 // Push function.
2710 __ push(eax); 2709 __ push(eax);
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 Assembler::target_address_at(call_target_address, 4563 Assembler::target_address_at(call_target_address,
4565 unoptimized_code)); 4564 unoptimized_code));
4566 return OSR_AFTER_STACK_CHECK; 4565 return OSR_AFTER_STACK_CHECK;
4567 } 4566 }
4568 4567
4569 4568
4570 } // namespace internal 4569 } // namespace internal
4571 } // namespace v8 4570 } // namespace v8
4572 4571
4573 #endif // V8_TARGET_ARCH_X87 4572 #endif // V8_TARGET_ARCH_X87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698