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