OLD | NEW |
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 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 __ mov(load_name, isolate()->factory()->next_string()); | 2172 __ mov(load_name, isolate()->factory()->next_string()); |
2173 __ push(load_name); // "next" | 2173 __ push(load_name); // "next" |
2174 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2174 __ push(Operand(esp, 2 * kPointerSize)); // iter |
2175 __ push(eax); // received | 2175 __ push(eax); // received |
2176 | 2176 |
2177 // result = receiver[f](arg); | 2177 // result = receiver[f](arg); |
2178 __ bind(&l_call); | 2178 __ bind(&l_call); |
2179 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2179 __ mov(load_receiver, Operand(esp, kPointerSize)); |
2180 __ mov(LoadDescriptor::SlotRegister(), | 2180 __ mov(LoadDescriptor::SlotRegister(), |
2181 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2181 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2182 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2182 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2183 CallIC(ic, TypeFeedbackId::None()); | 2183 CallIC(ic, TypeFeedbackId::None()); |
2184 __ mov(edi, eax); | 2184 __ mov(edi, eax); |
2185 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2185 __ mov(Operand(esp, 2 * kPointerSize), edi); |
2186 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2186 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2187 __ CallStub(&stub); | 2187 __ CallStub(&stub); |
2188 | 2188 |
2189 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2189 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2190 __ Drop(1); // The function is still on the stack; drop it. | 2190 __ Drop(1); // The function is still on the stack; drop it. |
2191 | 2191 |
2192 // if (!result.done) goto l_try; | 2192 // if (!result.done) goto l_try; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 | 2341 |
2342 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2342 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2343 SetSourcePosition(prop->position()); | 2343 SetSourcePosition(prop->position()); |
2344 Literal* key = prop->key()->AsLiteral(); | 2344 Literal* key = prop->key()->AsLiteral(); |
2345 DCHECK(!key->value()->IsSmi()); | 2345 DCHECK(!key->value()->IsSmi()); |
2346 DCHECK(!prop->IsSuperAccess()); | 2346 DCHECK(!prop->IsSuperAccess()); |
2347 | 2347 |
2348 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); | 2348 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); |
2349 __ mov(LoadDescriptor::SlotRegister(), | 2349 __ mov(LoadDescriptor::SlotRegister(), |
2350 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2350 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2351 CallLoadIC(NOT_CONTEXTUAL); | 2351 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
2352 } | 2352 } |
2353 | 2353 |
2354 | 2354 |
2355 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2355 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2356 // Stack: receiver, home_object. | 2356 // Stack: receiver, home_object. |
2357 SetSourcePosition(prop->position()); | 2357 SetSourcePosition(prop->position()); |
2358 Literal* key = prop->key()->AsLiteral(); | 2358 Literal* key = prop->key()->AsLiteral(); |
2359 DCHECK(!key->value()->IsSmi()); | 2359 DCHECK(!key->value()->IsSmi()); |
2360 DCHECK(prop->IsSuperAccess()); | 2360 DCHECK(prop->IsSuperAccess()); |
2361 | 2361 |
2362 __ push(Immediate(key->value())); | 2362 __ push(Immediate(key->value())); |
2363 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2363 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2364 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2364 } | 2365 } |
2365 | 2366 |
2366 | 2367 |
2367 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2368 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2368 SetSourcePosition(prop->position()); | 2369 SetSourcePosition(prop->position()); |
2369 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2370 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
2370 __ mov(LoadDescriptor::SlotRegister(), | 2371 __ mov(LoadDescriptor::SlotRegister(), |
2371 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2372 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2372 CallIC(ic); | 2373 CallIC(ic); |
2373 } | 2374 } |
2374 | 2375 |
2375 | 2376 |
2376 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2377 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2377 // Stack: receiver, home_object, key. | 2378 // Stack: receiver, home_object, key. |
| 2379 __ push(Immediate(Smi::FromInt(language_mode()))); |
2378 SetSourcePosition(prop->position()); | 2380 SetSourcePosition(prop->position()); |
2379 | 2381 |
2380 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2382 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2381 } | 2383 } |
2382 | 2384 |
2383 | 2385 |
2384 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2386 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2385 Token::Value op, | 2387 Token::Value op, |
2386 Expression* left, | 2388 Expression* left, |
2387 Expression* right) { | 2389 Expression* right) { |
2388 // Do combined smi check of the operands. Left operand is on the | 2390 // Do combined smi check of the operands. Left operand is on the |
2389 // stack. Right operand is in eax. | 2391 // stack. Right operand is in eax. |
2390 Label smi_case, done, stub_call; | 2392 Label smi_case, done, stub_call; |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 Literal* key = prop->key()->AsLiteral(); | 2895 Literal* key = prop->key()->AsLiteral(); |
2894 DCHECK(!key->value()->IsSmi()); | 2896 DCHECK(!key->value()->IsSmi()); |
2895 // Load the function from the receiver. | 2897 // Load the function from the receiver. |
2896 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2898 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2897 VisitForStackValue(super_ref->home_object()); | 2899 VisitForStackValue(super_ref->home_object()); |
2898 VisitForAccumulatorValue(super_ref->this_var()); | 2900 VisitForAccumulatorValue(super_ref->this_var()); |
2899 __ push(eax); | 2901 __ push(eax); |
2900 __ push(eax); | 2902 __ push(eax); |
2901 __ push(Operand(esp, kPointerSize * 2)); | 2903 __ push(Operand(esp, kPointerSize * 2)); |
2902 __ push(Immediate(key->value())); | 2904 __ push(Immediate(key->value())); |
| 2905 __ push(Immediate(Smi::FromInt(language_mode()))); |
2903 // Stack here: | 2906 // Stack here: |
2904 // - home_object | 2907 // - home_object |
2905 // - this (receiver) | 2908 // - this (receiver) |
2906 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2909 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2907 // - home_object | 2910 // - home_object |
2908 // - key | 2911 // - key |
2909 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2912 // - language_mode |
| 2913 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2910 | 2914 |
2911 // Replace home_object with target function. | 2915 // Replace home_object with target function. |
2912 __ mov(Operand(esp, kPointerSize), eax); | 2916 __ mov(Operand(esp, kPointerSize), eax); |
2913 | 2917 |
2914 // Stack here: | 2918 // Stack here: |
2915 // - target function | 2919 // - target function |
2916 // - this (receiver) | 2920 // - this (receiver) |
2917 EmitCall(expr, CallICState::METHOD); | 2921 EmitCall(expr, CallICState::METHOD); |
2918 } | 2922 } |
2919 | 2923 |
(...skipping 29 matching lines...) Expand all Loading... |
2949 | 2953 |
2950 SetSourcePosition(prop->position()); | 2954 SetSourcePosition(prop->position()); |
2951 // Load the function from the receiver. | 2955 // Load the function from the receiver. |
2952 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2956 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2953 VisitForStackValue(super_ref->home_object()); | 2957 VisitForStackValue(super_ref->home_object()); |
2954 VisitForAccumulatorValue(super_ref->this_var()); | 2958 VisitForAccumulatorValue(super_ref->this_var()); |
2955 __ push(eax); | 2959 __ push(eax); |
2956 __ push(eax); | 2960 __ push(eax); |
2957 __ push(Operand(esp, kPointerSize * 2)); | 2961 __ push(Operand(esp, kPointerSize * 2)); |
2958 VisitForStackValue(prop->key()); | 2962 VisitForStackValue(prop->key()); |
| 2963 __ push(Immediate(Smi::FromInt(language_mode()))); |
2959 // Stack here: | 2964 // Stack here: |
2960 // - home_object | 2965 // - home_object |
2961 // - this (receiver) | 2966 // - this (receiver) |
2962 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2967 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2963 // - home_object | 2968 // - home_object |
2964 // - key | 2969 // - key |
2965 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2970 // - language_mode |
| 2971 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2966 | 2972 |
2967 // Replace home_object with target function. | 2973 // Replace home_object with target function. |
2968 __ mov(Operand(esp, kPointerSize), eax); | 2974 __ mov(Operand(esp, kPointerSize), eax); |
2969 | 2975 |
2970 // Stack here: | 2976 // Stack here: |
2971 // - target function | 2977 // - target function |
2972 // - this (receiver) | 2978 // - this (receiver) |
2973 EmitCall(expr, CallICState::METHOD); | 2979 EmitCall(expr, CallICState::METHOD); |
2974 } | 2980 } |
2975 | 2981 |
(...skipping 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5503 Assembler::target_address_at(call_target_address, | 5509 Assembler::target_address_at(call_target_address, |
5504 unoptimized_code)); | 5510 unoptimized_code)); |
5505 return OSR_AFTER_STACK_CHECK; | 5511 return OSR_AFTER_STACK_CHECK; |
5506 } | 5512 } |
5507 | 5513 |
5508 | 5514 |
5509 } // namespace internal | 5515 } // namespace internal |
5510 } // namespace v8 | 5516 } // namespace v8 |
5511 | 5517 |
5512 #endif // V8_TARGET_ARCH_IA32 | 5518 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |