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

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

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 port Created 5 years, 6 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" 2238 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
2239 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter 2239 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter
2240 __ Push(load_name, r3, r0); // "next", iter, received 2240 __ Push(load_name, r3, r0); // "next", iter, received
2241 2241
2242 // result = receiver[f](arg); 2242 // result = receiver[f](arg);
2243 __ bind(&l_call); 2243 __ bind(&l_call);
2244 __ ldr(load_receiver, MemOperand(sp, kPointerSize)); 2244 __ ldr(load_receiver, MemOperand(sp, kPointerSize));
2245 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize)); 2245 __ ldr(load_name, MemOperand(sp, 2 * kPointerSize));
2246 __ mov(LoadDescriptor::SlotRegister(), 2246 __ mov(LoadDescriptor::SlotRegister(),
2247 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2247 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2248 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2248 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2249 CallIC(ic, TypeFeedbackId::None()); 2249 CallIC(ic, TypeFeedbackId::None());
2250 __ mov(r1, r0); 2250 __ mov(r1, r0);
2251 __ str(r1, MemOperand(sp, 2 * kPointerSize)); 2251 __ str(r1, MemOperand(sp, 2 * kPointerSize));
2252 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2252 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2253 __ CallStub(&stub); 2253 __ CallStub(&stub);
2254 2254
2255 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2255 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2256 __ Drop(1); // The function is still on the stack; drop it. 2256 __ Drop(1); // The function is still on the stack; drop it.
2257 2257
2258 // if (!result.done) goto l_try; 2258 // if (!result.done) goto l_try;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 2419
2420 2420
2421 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2421 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2422 SetSourcePosition(prop->position()); 2422 SetSourcePosition(prop->position());
2423 Literal* key = prop->key()->AsLiteral(); 2423 Literal* key = prop->key()->AsLiteral();
2424 DCHECK(!prop->IsSuperAccess()); 2424 DCHECK(!prop->IsSuperAccess());
2425 2425
2426 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); 2426 __ mov(LoadDescriptor::NameRegister(), Operand(key->value()));
2427 __ mov(LoadDescriptor::SlotRegister(), 2427 __ mov(LoadDescriptor::SlotRegister(),
2428 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2428 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2429 CallLoadIC(NOT_CONTEXTUAL); 2429 CallLoadIC(NOT_CONTEXTUAL, language_mode());
2430 } 2430 }
2431 2431
2432 2432
2433 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2433 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2434 // Stack: receiver, home_object. 2434 // Stack: receiver, home_object.
2435 SetSourcePosition(prop->position()); 2435 SetSourcePosition(prop->position());
2436 Literal* key = prop->key()->AsLiteral(); 2436 Literal* key = prop->key()->AsLiteral();
2437 DCHECK(!key->value()->IsSmi()); 2437 DCHECK(!key->value()->IsSmi());
2438 DCHECK(prop->IsSuperAccess()); 2438 DCHECK(prop->IsSuperAccess());
2439 2439
2440 __ Push(key->value()); 2440 __ Push(key->value());
2441 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2441 __ Push(Smi::FromInt(language_mode()));
2442 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2442 } 2443 }
2443 2444
2444 2445
2445 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2446 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2446 SetSourcePosition(prop->position()); 2447 SetSourcePosition(prop->position());
2447 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2448 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2448 __ mov(LoadDescriptor::SlotRegister(), 2449 __ mov(LoadDescriptor::SlotRegister(),
2449 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2450 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2450 CallIC(ic); 2451 CallIC(ic);
2451 } 2452 }
2452 2453
2453 2454
2454 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2455 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2455 // Stack: receiver, home_object, key. 2456 // Stack: receiver, home_object, key.
2457 __ Push(Smi::FromInt(language_mode()));
2456 SetSourcePosition(prop->position()); 2458 SetSourcePosition(prop->position());
2457 2459
2458 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2460 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2459 } 2461 }
2460 2462
2461 2463
2462 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2464 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2463 Token::Value op, 2465 Token::Value op,
2464 Expression* left_expr, 2466 Expression* left_expr,
2465 Expression* right_expr) { 2467 Expression* right_expr) {
2466 Label done, smi_case, stub_call; 2468 Label done, smi_case, stub_call;
2467 2469
2468 Register scratch1 = r2; 2470 Register scratch1 = r2;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 // Load the function from the receiver. 2996 // Load the function from the receiver.
2995 const Register scratch = r1; 2997 const Register scratch = r1;
2996 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2998 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2997 VisitForStackValue(super_ref->home_object()); 2999 VisitForStackValue(super_ref->home_object());
2998 VisitForAccumulatorValue(super_ref->this_var()); 3000 VisitForAccumulatorValue(super_ref->this_var());
2999 __ Push(r0); 3001 __ Push(r0);
3000 __ Push(r0); 3002 __ Push(r0);
3001 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 3003 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
3002 __ Push(scratch); 3004 __ Push(scratch);
3003 __ Push(key->value()); 3005 __ Push(key->value());
3006 __ Push(Smi::FromInt(language_mode()));
3004 3007
3005 // Stack here: 3008 // Stack here:
3006 // - home_object 3009 // - home_object
3007 // - this (receiver) 3010 // - this (receiver)
3008 // - this (receiver) <-- LoadFromSuper will pop here and below. 3011 // - this (receiver) <-- LoadFromSuper will pop here and below.
3009 // - home_object 3012 // - home_object
3010 // - key 3013 // - key
3011 __ CallRuntime(Runtime::kLoadFromSuper, 3); 3014 // - language_mode
3015 __ CallRuntime(Runtime::kLoadFromSuper, 4);
3012 3016
3013 // Replace home_object with target function. 3017 // Replace home_object with target function.
3014 __ str(r0, MemOperand(sp, kPointerSize)); 3018 __ str(r0, MemOperand(sp, kPointerSize));
3015 3019
3016 // Stack here: 3020 // Stack here:
3017 // - target function 3021 // - target function
3018 // - this (receiver) 3022 // - this (receiver)
3019 EmitCall(expr, CallICState::METHOD); 3023 EmitCall(expr, CallICState::METHOD);
3020 } 3024 }
3021 3025
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 // Load the function from the receiver. 3058 // Load the function from the receiver.
3055 const Register scratch = r1; 3059 const Register scratch = r1;
3056 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 3060 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3057 VisitForStackValue(super_ref->home_object()); 3061 VisitForStackValue(super_ref->home_object());
3058 VisitForAccumulatorValue(super_ref->this_var()); 3062 VisitForAccumulatorValue(super_ref->this_var());
3059 __ Push(r0); 3063 __ Push(r0);
3060 __ Push(r0); 3064 __ Push(r0);
3061 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 3065 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
3062 __ Push(scratch); 3066 __ Push(scratch);
3063 VisitForStackValue(prop->key()); 3067 VisitForStackValue(prop->key());
3068 __ Push(Smi::FromInt(language_mode()));
3064 3069
3065 // Stack here: 3070 // Stack here:
3066 // - home_object 3071 // - home_object
3067 // - this (receiver) 3072 // - this (receiver)
3068 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 3073 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
3069 // - home_object 3074 // - home_object
3070 // - key 3075 // - key
3071 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 3076 // - language_mode
3077 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
3072 3078
3073 // Replace home_object with target function. 3079 // Replace home_object with target function.
3074 __ str(r0, MemOperand(sp, kPointerSize)); 3080 __ str(r0, MemOperand(sp, kPointerSize));
3075 3081
3076 // Stack here: 3082 // Stack here:
3077 // - target function 3083 // - target function
3078 // - this (receiver) 3084 // - this (receiver)
3079 EmitCall(expr, CallICState::METHOD); 3085 EmitCall(expr, CallICState::METHOD);
3080 } 3086 }
3081 3087
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after
5605 DCHECK(interrupt_address == 5611 DCHECK(interrupt_address ==
5606 isolate->builtins()->OsrAfterStackCheck()->entry()); 5612 isolate->builtins()->OsrAfterStackCheck()->entry());
5607 return OSR_AFTER_STACK_CHECK; 5613 return OSR_AFTER_STACK_CHECK;
5608 } 5614 }
5609 5615
5610 5616
5611 } // namespace internal 5617 } // namespace internal
5612 } // namespace v8 5618 } // namespace v8
5613 5619
5614 #endif // V8_TARGET_ARCH_ARM 5620 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698