| 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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(), SLOPPY).code(); | 2169 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).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 Loading... |
| 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, language_mode()); | 2338 CallLoadIC(NOT_CONTEXTUAL); |
| 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 __ push(Immediate(Smi::FromInt(language_mode()))); | 2350 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2351 __ CallRuntime(Runtime::kLoadFromSuper, 4); | |
| 2352 } | 2351 } |
| 2353 | 2352 |
| 2354 | 2353 |
| 2355 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2354 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2356 SetSourcePosition(prop->position()); | 2355 SetSourcePosition(prop->position()); |
| 2357 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); | 2356 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2358 __ mov(LoadDescriptor::SlotRegister(), | 2357 __ mov(LoadDescriptor::SlotRegister(), |
| 2359 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2358 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| 2360 CallIC(ic); | 2359 CallIC(ic); |
| 2361 } | 2360 } |
| 2362 | 2361 |
| 2363 | 2362 |
| 2364 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2363 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2365 // Stack: receiver, home_object, key. | 2364 // Stack: receiver, home_object, key. |
| 2366 __ push(Immediate(Smi::FromInt(language_mode()))); | |
| 2367 SetSourcePosition(prop->position()); | 2365 SetSourcePosition(prop->position()); |
| 2368 | 2366 |
| 2369 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 2367 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2370 } | 2368 } |
| 2371 | 2369 |
| 2372 | 2370 |
| 2373 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2371 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2374 Token::Value op, | 2372 Token::Value op, |
| 2375 Expression* left, | 2373 Expression* left, |
| 2376 Expression* right) { | 2374 Expression* right) { |
| 2377 // Do combined smi check of the operands. Left operand is on the | 2375 // Do combined smi check of the operands. Left operand is on the |
| 2378 // stack. Right operand is in eax. | 2376 // stack. Right operand is in eax. |
| 2379 Label smi_case, done, stub_call; | 2377 Label smi_case, done, stub_call; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 Literal* key = prop->key()->AsLiteral(); | 2887 Literal* key = prop->key()->AsLiteral(); |
| 2890 DCHECK(!key->value()->IsSmi()); | 2888 DCHECK(!key->value()->IsSmi()); |
| 2891 // Load the function from the receiver. | 2889 // Load the function from the receiver. |
| 2892 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2890 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2893 VisitForStackValue(super_ref->home_object()); | 2891 VisitForStackValue(super_ref->home_object()); |
| 2894 VisitForAccumulatorValue(super_ref->this_var()); | 2892 VisitForAccumulatorValue(super_ref->this_var()); |
| 2895 __ push(eax); | 2893 __ push(eax); |
| 2896 __ push(eax); | 2894 __ push(eax); |
| 2897 __ push(Operand(esp, kPointerSize * 2)); | 2895 __ push(Operand(esp, kPointerSize * 2)); |
| 2898 __ push(Immediate(key->value())); | 2896 __ push(Immediate(key->value())); |
| 2899 __ push(Immediate(Smi::FromInt(language_mode()))); | |
| 2900 // Stack here: | 2897 // Stack here: |
| 2901 // - home_object | 2898 // - home_object |
| 2902 // - this (receiver) | 2899 // - this (receiver) |
| 2903 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2900 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2904 // - home_object | 2901 // - home_object |
| 2905 // - key | 2902 // - key |
| 2906 // - language_mode | 2903 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2907 __ CallRuntime(Runtime::kLoadFromSuper, 4); | |
| 2908 | 2904 |
| 2909 // Replace home_object with target function. | 2905 // Replace home_object with target function. |
| 2910 __ mov(Operand(esp, kPointerSize), eax); | 2906 __ mov(Operand(esp, kPointerSize), eax); |
| 2911 | 2907 |
| 2912 // Stack here: | 2908 // Stack here: |
| 2913 // - target function | 2909 // - target function |
| 2914 // - this (receiver) | 2910 // - this (receiver) |
| 2915 EmitCall(expr, CallICState::METHOD); | 2911 EmitCall(expr, CallICState::METHOD); |
| 2916 } | 2912 } |
| 2917 | 2913 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2947 | 2943 |
| 2948 SetSourcePosition(prop->position()); | 2944 SetSourcePosition(prop->position()); |
| 2949 // Load the function from the receiver. | 2945 // Load the function from the receiver. |
| 2950 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2946 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2951 VisitForStackValue(super_ref->home_object()); | 2947 VisitForStackValue(super_ref->home_object()); |
| 2952 VisitForAccumulatorValue(super_ref->this_var()); | 2948 VisitForAccumulatorValue(super_ref->this_var()); |
| 2953 __ push(eax); | 2949 __ push(eax); |
| 2954 __ push(eax); | 2950 __ push(eax); |
| 2955 __ push(Operand(esp, kPointerSize * 2)); | 2951 __ push(Operand(esp, kPointerSize * 2)); |
| 2956 VisitForStackValue(prop->key()); | 2952 VisitForStackValue(prop->key()); |
| 2957 __ push(Immediate(Smi::FromInt(language_mode()))); | |
| 2958 // Stack here: | 2953 // Stack here: |
| 2959 // - home_object | 2954 // - home_object |
| 2960 // - this (receiver) | 2955 // - this (receiver) |
| 2961 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2956 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2962 // - home_object | 2957 // - home_object |
| 2963 // - key | 2958 // - key |
| 2964 // - language_mode | 2959 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2965 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | |
| 2966 | 2960 |
| 2967 // Replace home_object with target function. | 2961 // Replace home_object with target function. |
| 2968 __ mov(Operand(esp, kPointerSize), eax); | 2962 __ mov(Operand(esp, kPointerSize), eax); |
| 2969 | 2963 |
| 2970 // Stack here: | 2964 // Stack here: |
| 2971 // - target function | 2965 // - target function |
| 2972 // - this (receiver) | 2966 // - this (receiver) |
| 2973 EmitCall(expr, CallICState::METHOD); | 2967 EmitCall(expr, CallICState::METHOD); |
| 2974 } | 2968 } |
| 2975 | 2969 |
| (...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5488 Assembler::target_address_at(call_target_address, | 5482 Assembler::target_address_at(call_target_address, |
| 5489 unoptimized_code)); | 5483 unoptimized_code)); |
| 5490 return OSR_AFTER_STACK_CHECK; | 5484 return OSR_AFTER_STACK_CHECK; |
| 5491 } | 5485 } |
| 5492 | 5486 |
| 5493 | 5487 |
| 5494 } // namespace internal | 5488 } // namespace internal |
| 5495 } // namespace v8 | 5489 } // namespace v8 |
| 5496 | 5490 |
| 5497 #endif // V8_TARGET_ARCH_IA32 | 5491 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |