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

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

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: slim down, improve tests 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_X87 7 #if V8_TARGET_ARCH_X87
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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 __ mov(load_name, isolate()->factory()->next_string()); 2155 __ mov(load_name, isolate()->factory()->next_string());
2156 __ push(load_name); // "next" 2156 __ push(load_name); // "next"
2157 __ push(Operand(esp, 2 * kPointerSize)); // iter 2157 __ push(Operand(esp, 2 * kPointerSize)); // iter
2158 __ push(eax); // received 2158 __ push(eax); // received
2159 2159
2160 // result = receiver[f](arg); 2160 // result = receiver[f](arg);
2161 __ bind(&l_call); 2161 __ bind(&l_call);
2162 __ mov(load_receiver, Operand(esp, kPointerSize)); 2162 __ mov(load_receiver, Operand(esp, kPointerSize));
2163 __ mov(LoadDescriptor::SlotRegister(), 2163 __ mov(LoadDescriptor::SlotRegister(),
2164 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2164 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2165 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2165 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2166 CallIC(ic, TypeFeedbackId::None()); 2166 CallIC(ic, TypeFeedbackId::None());
2167 __ mov(edi, eax); 2167 __ mov(edi, eax);
2168 __ mov(Operand(esp, 2 * kPointerSize), edi); 2168 __ mov(Operand(esp, 2 * kPointerSize), edi);
2169 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2169 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2170 __ CallStub(&stub); 2170 __ CallStub(&stub);
2171 2171
2172 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2172 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2173 __ Drop(1); // The function is still on the stack; drop it. 2173 __ Drop(1); // The function is still on the stack; drop it.
2174 2174
2175 // if (!result.done) goto l_try; 2175 // if (!result.done) goto l_try;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 2324
2325 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2325 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2326 SetSourcePosition(prop->position()); 2326 SetSourcePosition(prop->position());
2327 Literal* key = prop->key()->AsLiteral(); 2327 Literal* key = prop->key()->AsLiteral();
2328 DCHECK(!key->value()->IsSmi()); 2328 DCHECK(!key->value()->IsSmi());
2329 DCHECK(!prop->IsSuperAccess()); 2329 DCHECK(!prop->IsSuperAccess());
2330 2330
2331 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); 2331 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value()));
2332 __ mov(LoadDescriptor::SlotRegister(), 2332 __ mov(LoadDescriptor::SlotRegister(),
2333 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2333 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2334 CallLoadIC(NOT_CONTEXTUAL); 2334 CallLoadIC(NOT_CONTEXTUAL, language_mode());
2335 } 2335 }
2336 2336
2337 2337
2338 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2338 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2339 // Stack: receiver, home_object. 2339 // Stack: receiver, home_object.
2340 SetSourcePosition(prop->position()); 2340 SetSourcePosition(prop->position());
2341 Literal* key = prop->key()->AsLiteral(); 2341 Literal* key = prop->key()->AsLiteral();
2342 DCHECK(!key->value()->IsSmi()); 2342 DCHECK(!key->value()->IsSmi());
2343 DCHECK(prop->IsSuperAccess()); 2343 DCHECK(prop->IsSuperAccess());
2344 2344
2345 __ push(Immediate(key->value())); 2345 __ push(Immediate(key->value()));
2346 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2346 __ push(Immediate(Smi::FromInt(language_mode())));
2347 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2347 } 2348 }
2348 2349
2349 2350
2350 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2351 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2351 SetSourcePosition(prop->position()); 2352 SetSourcePosition(prop->position());
2352 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2353 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2353 __ mov(LoadDescriptor::SlotRegister(), 2354 __ mov(LoadDescriptor::SlotRegister(),
2354 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2355 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2355 CallIC(ic); 2356 CallIC(ic);
2356 } 2357 }
2357 2358
2358 2359
2359 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2360 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2360 // Stack: receiver, home_object, key. 2361 // Stack: receiver, home_object, key.
2362 __ push(Immediate(Smi::FromInt(language_mode())));
2361 SetSourcePosition(prop->position()); 2363 SetSourcePosition(prop->position());
2362 2364
2363 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2365 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2364 } 2366 }
2365 2367
2366 2368
2367 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2369 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2368 Token::Value op, 2370 Token::Value op,
2369 Expression* left, 2371 Expression* left,
2370 Expression* right) { 2372 Expression* right) {
2371 // Do combined smi check of the operands. Left operand is on the 2373 // Do combined smi check of the operands. Left operand is on the
2372 // stack. Right operand is in eax. 2374 // stack. Right operand is in eax.
2373 Label smi_case, done, stub_call; 2375 Label smi_case, done, stub_call;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 Literal* key = prop->key()->AsLiteral(); 2876 Literal* key = prop->key()->AsLiteral();
2875 DCHECK(!key->value()->IsSmi()); 2877 DCHECK(!key->value()->IsSmi());
2876 // Load the function from the receiver. 2878 // Load the function from the receiver.
2877 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2879 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2878 VisitForStackValue(super_ref->home_object_var()); 2880 VisitForStackValue(super_ref->home_object_var());
2879 VisitForAccumulatorValue(super_ref->this_var()); 2881 VisitForAccumulatorValue(super_ref->this_var());
2880 __ push(eax); 2882 __ push(eax);
2881 __ push(eax); 2883 __ push(eax);
2882 __ push(Operand(esp, kPointerSize * 2)); 2884 __ push(Operand(esp, kPointerSize * 2));
2883 __ push(Immediate(key->value())); 2885 __ push(Immediate(key->value()));
2886 __ push(Immediate(Smi::FromInt(language_mode())));
2884 // Stack here: 2887 // Stack here:
2885 // - home_object 2888 // - home_object
2886 // - this (receiver) 2889 // - this (receiver)
2887 // - this (receiver) <-- LoadFromSuper will pop here and below. 2890 // - this (receiver) <-- LoadFromSuper will pop here and below.
2888 // - home_object 2891 // - home_object
2889 // - key 2892 // - key
2890 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2893 // - language_mode
2894 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2891 2895
2892 // Replace home_object with target function. 2896 // Replace home_object with target function.
2893 __ mov(Operand(esp, kPointerSize), eax); 2897 __ mov(Operand(esp, kPointerSize), eax);
2894 2898
2895 // Stack here: 2899 // Stack here:
2896 // - target function 2900 // - target function
2897 // - this (receiver) 2901 // - this (receiver)
2898 EmitCall(expr, CallICState::METHOD); 2902 EmitCall(expr, CallICState::METHOD);
2899 } 2903 }
2900 2904
(...skipping 29 matching lines...) Expand all
2930 2934
2931 SetSourcePosition(prop->position()); 2935 SetSourcePosition(prop->position());
2932 // Load the function from the receiver. 2936 // Load the function from the receiver.
2933 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2937 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2934 VisitForStackValue(super_ref->home_object_var()); 2938 VisitForStackValue(super_ref->home_object_var());
2935 VisitForAccumulatorValue(super_ref->this_var()); 2939 VisitForAccumulatorValue(super_ref->this_var());
2936 __ push(eax); 2940 __ push(eax);
2937 __ push(eax); 2941 __ push(eax);
2938 __ push(Operand(esp, kPointerSize * 2)); 2942 __ push(Operand(esp, kPointerSize * 2));
2939 VisitForStackValue(prop->key()); 2943 VisitForStackValue(prop->key());
2944 __ push(Immediate(Smi::FromInt(language_mode())));
2940 // Stack here: 2945 // Stack here:
2941 // - home_object 2946 // - home_object
2942 // - this (receiver) 2947 // - this (receiver)
2943 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 2948 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2944 // - home_object 2949 // - home_object
2945 // - key 2950 // - key
2946 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2951 // - language_mode
2952 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2947 2953
2948 // Replace home_object with target function. 2954 // Replace home_object with target function.
2949 __ mov(Operand(esp, kPointerSize), eax); 2955 __ mov(Operand(esp, kPointerSize), eax);
2950 2956
2951 // Stack here: 2957 // Stack here:
2952 // - target function 2958 // - target function
2953 // - this (receiver) 2959 // - this (receiver)
2954 EmitCall(expr, CallICState::METHOD); 2960 EmitCall(expr, CallICState::METHOD);
2955 } 2961 }
2956 2962
(...skipping 2480 matching lines...) Expand 10 before | Expand all | Expand 10 after
5437 Assembler::target_address_at(call_target_address, 5443 Assembler::target_address_at(call_target_address,
5438 unoptimized_code)); 5444 unoptimized_code));
5439 return OSR_AFTER_STACK_CHECK; 5445 return OSR_AFTER_STACK_CHECK;
5440 } 5446 }
5441 5447
5442 5448
5443 } // namespace internal 5449 } // namespace internal
5444 } // namespace v8 5450 } // namespace v8
5445 5451
5446 #endif // V8_TARGET_ARCH_X87 5452 #endif // V8_TARGET_ARCH_X87
OLDNEW
« src/lookup.h ('K') | « src/x87/code-stubs-x87.cc ('k') | src/x87/lithium-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698