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

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

Issue 1185343005: Revert of Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-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 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_IA32 7 #if V8_TARGET_ARCH_IA32
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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 __ mov(load_name, isolate()->factory()->next_string()); 2159 __ mov(load_name, isolate()->factory()->next_string());
2160 __ push(load_name); // "next" 2160 __ push(load_name); // "next"
2161 __ push(Operand(esp, 2 * kPointerSize)); // iter 2161 __ push(Operand(esp, 2 * kPointerSize)); // iter
2162 __ push(eax); // received 2162 __ push(eax); // received
2163 2163
2164 // result = receiver[f](arg); 2164 // result = receiver[f](arg);
2165 __ bind(&l_call); 2165 __ bind(&l_call);
2166 __ mov(load_receiver, Operand(esp, kPointerSize)); 2166 __ mov(load_receiver, Operand(esp, kPointerSize));
2167 __ mov(LoadDescriptor::SlotRegister(), 2167 __ mov(LoadDescriptor::SlotRegister(),
2168 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2168 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2169 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2169 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2170 CallIC(ic, TypeFeedbackId::None()); 2170 CallIC(ic, TypeFeedbackId::None());
2171 __ mov(edi, eax); 2171 __ mov(edi, eax);
2172 __ mov(Operand(esp, 2 * kPointerSize), edi); 2172 __ mov(Operand(esp, 2 * kPointerSize), edi);
2173 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2173 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2174 __ CallStub(&stub); 2174 __ CallStub(&stub);
2175 2175
2176 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2176 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2177 __ Drop(1); // The function is still on the stack; drop it. 2177 __ Drop(1); // The function is still on the stack; drop it.
2178 2178
2179 // if (!result.done) goto l_try; 2179 // if (!result.done) goto l_try;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 2328
2329 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2329 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2330 SetSourcePosition(prop->position()); 2330 SetSourcePosition(prop->position());
2331 Literal* key = prop->key()->AsLiteral(); 2331 Literal* key = prop->key()->AsLiteral();
2332 DCHECK(!key->value()->IsSmi()); 2332 DCHECK(!key->value()->IsSmi());
2333 DCHECK(!prop->IsSuperAccess()); 2333 DCHECK(!prop->IsSuperAccess());
2334 2334
2335 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); 2335 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value()));
2336 __ mov(LoadDescriptor::SlotRegister(), 2336 __ mov(LoadDescriptor::SlotRegister(),
2337 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2337 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2338 CallLoadIC(NOT_CONTEXTUAL); 2338 CallLoadIC(NOT_CONTEXTUAL, language_mode());
2339 } 2339 }
2340 2340
2341 2341
2342 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2342 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2343 // Stack: receiver, home_object. 2343 // Stack: receiver, home_object.
2344 SetSourcePosition(prop->position()); 2344 SetSourcePosition(prop->position());
2345 Literal* key = prop->key()->AsLiteral(); 2345 Literal* key = prop->key()->AsLiteral();
2346 DCHECK(!key->value()->IsSmi()); 2346 DCHECK(!key->value()->IsSmi());
2347 DCHECK(prop->IsSuperAccess()); 2347 DCHECK(prop->IsSuperAccess());
2348 2348
2349 __ push(Immediate(key->value())); 2349 __ push(Immediate(key->value()));
2350 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2350 __ push(Immediate(Smi::FromInt(language_mode())));
2351 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2351 } 2352 }
2352 2353
2353 2354
2354 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2355 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2355 SetSourcePosition(prop->position()); 2356 SetSourcePosition(prop->position());
2356 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2357 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2357 __ mov(LoadDescriptor::SlotRegister(), 2358 __ mov(LoadDescriptor::SlotRegister(),
2358 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2359 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2359 CallIC(ic); 2360 CallIC(ic);
2360 } 2361 }
2361 2362
2362 2363
2363 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2364 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2364 // Stack: receiver, home_object, key. 2365 // Stack: receiver, home_object, key.
2366 __ push(Immediate(Smi::FromInt(language_mode())));
2365 SetSourcePosition(prop->position()); 2367 SetSourcePosition(prop->position());
2366 2368
2367 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2369 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2368 } 2370 }
2369 2371
2370 2372
2371 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2373 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2372 Token::Value op, 2374 Token::Value op,
2373 Expression* left, 2375 Expression* left,
2374 Expression* right) { 2376 Expression* right) {
2375 // Do combined smi check of the operands. Left operand is on the 2377 // Do combined smi check of the operands. Left operand is on the
2376 // stack. Right operand is in eax. 2378 // stack. Right operand is in eax.
2377 Label smi_case, done, stub_call; 2379 Label smi_case, done, stub_call;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 Literal* key = prop->key()->AsLiteral(); 2889 Literal* key = prop->key()->AsLiteral();
2888 DCHECK(!key->value()->IsSmi()); 2890 DCHECK(!key->value()->IsSmi());
2889 // Load the function from the receiver. 2891 // Load the function from the receiver.
2890 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2892 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2891 VisitForStackValue(super_ref->home_object()); 2893 VisitForStackValue(super_ref->home_object());
2892 VisitForAccumulatorValue(super_ref->this_var()); 2894 VisitForAccumulatorValue(super_ref->this_var());
2893 __ push(eax); 2895 __ push(eax);
2894 __ push(eax); 2896 __ push(eax);
2895 __ push(Operand(esp, kPointerSize * 2)); 2897 __ push(Operand(esp, kPointerSize * 2));
2896 __ push(Immediate(key->value())); 2898 __ push(Immediate(key->value()));
2899 __ push(Immediate(Smi::FromInt(language_mode())));
2897 // Stack here: 2900 // Stack here:
2898 // - home_object 2901 // - home_object
2899 // - this (receiver) 2902 // - this (receiver)
2900 // - this (receiver) <-- LoadFromSuper will pop here and below. 2903 // - this (receiver) <-- LoadFromSuper will pop here and below.
2901 // - home_object 2904 // - home_object
2902 // - key 2905 // - key
2903 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2906 // - language_mode
2907 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2904 2908
2905 // Replace home_object with target function. 2909 // Replace home_object with target function.
2906 __ mov(Operand(esp, kPointerSize), eax); 2910 __ mov(Operand(esp, kPointerSize), eax);
2907 2911
2908 // Stack here: 2912 // Stack here:
2909 // - target function 2913 // - target function
2910 // - this (receiver) 2914 // - this (receiver)
2911 EmitCall(expr, CallICState::METHOD); 2915 EmitCall(expr, CallICState::METHOD);
2912 } 2916 }
2913 2917
(...skipping 29 matching lines...) Expand all
2943 2947
2944 SetSourcePosition(prop->position()); 2948 SetSourcePosition(prop->position());
2945 // Load the function from the receiver. 2949 // Load the function from the receiver.
2946 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2950 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2947 VisitForStackValue(super_ref->home_object()); 2951 VisitForStackValue(super_ref->home_object());
2948 VisitForAccumulatorValue(super_ref->this_var()); 2952 VisitForAccumulatorValue(super_ref->this_var());
2949 __ push(eax); 2953 __ push(eax);
2950 __ push(eax); 2954 __ push(eax);
2951 __ push(Operand(esp, kPointerSize * 2)); 2955 __ push(Operand(esp, kPointerSize * 2));
2952 VisitForStackValue(prop->key()); 2956 VisitForStackValue(prop->key());
2957 __ push(Immediate(Smi::FromInt(language_mode())));
2953 // Stack here: 2958 // Stack here:
2954 // - home_object 2959 // - home_object
2955 // - this (receiver) 2960 // - this (receiver)
2956 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 2961 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2957 // - home_object 2962 // - home_object
2958 // - key 2963 // - key
2959 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2964 // - language_mode
2965 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2960 2966
2961 // Replace home_object with target function. 2967 // Replace home_object with target function.
2962 __ mov(Operand(esp, kPointerSize), eax); 2968 __ mov(Operand(esp, kPointerSize), eax);
2963 2969
2964 // Stack here: 2970 // Stack here:
2965 // - target function 2971 // - target function
2966 // - this (receiver) 2972 // - this (receiver)
2967 EmitCall(expr, CallICState::METHOD); 2973 EmitCall(expr, CallICState::METHOD);
2968 } 2974 }
2969 2975
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after
5482 Assembler::target_address_at(call_target_address, 5488 Assembler::target_address_at(call_target_address,
5483 unoptimized_code)); 5489 unoptimized_code));
5484 return OSR_AFTER_STACK_CHECK; 5490 return OSR_AFTER_STACK_CHECK;
5485 } 5491 }
5486 5492
5487 5493
5488 } // namespace internal 5494 } // namespace internal
5489 } // namespace v8 5495 } // namespace v8
5490 5496
5491 #endif // V8_TARGET_ARCH_IA32 5497 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698