| 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_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 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 __ mov(load_name, isolate()->factory()->next_string()); | 2150 __ mov(load_name, isolate()->factory()->next_string()); |
| 2151 __ push(load_name); // "next" | 2151 __ push(load_name); // "next" |
| 2152 __ push(Operand(esp, 2 * kPointerSize)); // iter | 2152 __ push(Operand(esp, 2 * kPointerSize)); // iter |
| 2153 __ push(eax); // received | 2153 __ push(eax); // received |
| 2154 | 2154 |
| 2155 // result = receiver[f](arg); | 2155 // result = receiver[f](arg); |
| 2156 __ bind(&l_call); | 2156 __ bind(&l_call); |
| 2157 __ mov(load_receiver, Operand(esp, kPointerSize)); | 2157 __ mov(load_receiver, Operand(esp, kPointerSize)); |
| 2158 __ mov(LoadDescriptor::SlotRegister(), | 2158 __ mov(LoadDescriptor::SlotRegister(), |
| 2159 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2159 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
| 2160 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2160 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
| 2161 CallIC(ic, TypeFeedbackId::None()); | 2161 CallIC(ic, TypeFeedbackId::None()); |
| 2162 __ mov(edi, eax); | 2162 __ mov(edi, eax); |
| 2163 __ mov(Operand(esp, 2 * kPointerSize), edi); | 2163 __ mov(Operand(esp, 2 * kPointerSize), edi); |
| 2164 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2164 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 2165 __ CallStub(&stub); | 2165 __ CallStub(&stub); |
| 2166 | 2166 |
| 2167 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2167 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 2168 __ Drop(1); // The function is still on the stack; drop it. | 2168 __ Drop(1); // The function is still on the stack; drop it. |
| 2169 | 2169 |
| 2170 // if (!result.done) goto l_try; | 2170 // if (!result.done) goto l_try; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 | 2319 |
| 2320 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2320 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2321 SetSourcePosition(prop->position()); | 2321 SetSourcePosition(prop->position()); |
| 2322 Literal* key = prop->key()->AsLiteral(); | 2322 Literal* key = prop->key()->AsLiteral(); |
| 2323 DCHECK(!key->value()->IsSmi()); | 2323 DCHECK(!key->value()->IsSmi()); |
| 2324 DCHECK(!prop->IsSuperAccess()); | 2324 DCHECK(!prop->IsSuperAccess()); |
| 2325 | 2325 |
| 2326 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); | 2326 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); |
| 2327 __ mov(LoadDescriptor::SlotRegister(), | 2327 __ mov(LoadDescriptor::SlotRegister(), |
| 2328 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2328 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| 2329 CallLoadIC(NOT_CONTEXTUAL); | 2329 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
| 2330 } | 2330 } |
| 2331 | 2331 |
| 2332 | 2332 |
| 2333 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2333 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 2334 // Stack: receiver, home_object. | 2334 // Stack: receiver, home_object. |
| 2335 SetSourcePosition(prop->position()); | 2335 SetSourcePosition(prop->position()); |
| 2336 Literal* key = prop->key()->AsLiteral(); | 2336 Literal* key = prop->key()->AsLiteral(); |
| 2337 DCHECK(!key->value()->IsSmi()); | 2337 DCHECK(!key->value()->IsSmi()); |
| 2338 DCHECK(prop->IsSuperAccess()); | 2338 DCHECK(prop->IsSuperAccess()); |
| 2339 | 2339 |
| 2340 __ push(Immediate(key->value())); | 2340 __ push(Immediate(key->value())); |
| 2341 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2341 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2342 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
| 2342 } | 2343 } |
| 2343 | 2344 |
| 2344 | 2345 |
| 2345 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2346 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2346 SetSourcePosition(prop->position()); | 2347 SetSourcePosition(prop->position()); |
| 2347 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2348 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
| 2348 __ mov(LoadDescriptor::SlotRegister(), | 2349 __ mov(LoadDescriptor::SlotRegister(), |
| 2349 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2350 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| 2350 CallIC(ic); | 2351 CallIC(ic); |
| 2351 } | 2352 } |
| 2352 | 2353 |
| 2353 | 2354 |
| 2354 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2355 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2355 // Stack: receiver, home_object, key. | 2356 // Stack: receiver, home_object, key. |
| 2357 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2356 SetSourcePosition(prop->position()); | 2358 SetSourcePosition(prop->position()); |
| 2357 | 2359 |
| 2358 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2360 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
| 2359 } | 2361 } |
| 2360 | 2362 |
| 2361 | 2363 |
| 2362 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2364 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2363 Token::Value op, | 2365 Token::Value op, |
| 2364 Expression* left, | 2366 Expression* left, |
| 2365 Expression* right) { | 2367 Expression* right) { |
| 2366 // Do combined smi check of the operands. Left operand is on the | 2368 // Do combined smi check of the operands. Left operand is on the |
| 2367 // stack. Right operand is in eax. | 2369 // stack. Right operand is in eax. |
| 2368 Label smi_case, done, stub_call; | 2370 Label smi_case, done, stub_call; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2878 Literal* key = prop->key()->AsLiteral(); | 2880 Literal* key = prop->key()->AsLiteral(); |
| 2879 DCHECK(!key->value()->IsSmi()); | 2881 DCHECK(!key->value()->IsSmi()); |
| 2880 // Load the function from the receiver. | 2882 // Load the function from the receiver. |
| 2881 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2883 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2882 VisitForStackValue(super_ref->home_object()); | 2884 VisitForStackValue(super_ref->home_object()); |
| 2883 VisitForAccumulatorValue(super_ref->this_var()); | 2885 VisitForAccumulatorValue(super_ref->this_var()); |
| 2884 __ push(eax); | 2886 __ push(eax); |
| 2885 __ push(eax); | 2887 __ push(eax); |
| 2886 __ push(Operand(esp, kPointerSize * 2)); | 2888 __ push(Operand(esp, kPointerSize * 2)); |
| 2887 __ push(Immediate(key->value())); | 2889 __ push(Immediate(key->value())); |
| 2890 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2888 // Stack here: | 2891 // Stack here: |
| 2889 // - home_object | 2892 // - home_object |
| 2890 // - this (receiver) | 2893 // - this (receiver) |
| 2891 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2894 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2892 // - home_object | 2895 // - home_object |
| 2893 // - key | 2896 // - key |
| 2894 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2897 // - language_mode |
| 2898 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
| 2895 | 2899 |
| 2896 // Replace home_object with target function. | 2900 // Replace home_object with target function. |
| 2897 __ mov(Operand(esp, kPointerSize), eax); | 2901 __ mov(Operand(esp, kPointerSize), eax); |
| 2898 | 2902 |
| 2899 // Stack here: | 2903 // Stack here: |
| 2900 // - target function | 2904 // - target function |
| 2901 // - this (receiver) | 2905 // - this (receiver) |
| 2902 EmitCall(expr, CallICState::METHOD); | 2906 EmitCall(expr, CallICState::METHOD); |
| 2903 } | 2907 } |
| 2904 | 2908 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2934 | 2938 |
| 2935 SetSourcePosition(prop->position()); | 2939 SetSourcePosition(prop->position()); |
| 2936 // Load the function from the receiver. | 2940 // Load the function from the receiver. |
| 2937 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2941 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2938 VisitForStackValue(super_ref->home_object()); | 2942 VisitForStackValue(super_ref->home_object()); |
| 2939 VisitForAccumulatorValue(super_ref->this_var()); | 2943 VisitForAccumulatorValue(super_ref->this_var()); |
| 2940 __ push(eax); | 2944 __ push(eax); |
| 2941 __ push(eax); | 2945 __ push(eax); |
| 2942 __ push(Operand(esp, kPointerSize * 2)); | 2946 __ push(Operand(esp, kPointerSize * 2)); |
| 2943 VisitForStackValue(prop->key()); | 2947 VisitForStackValue(prop->key()); |
| 2948 __ push(Immediate(Smi::FromInt(language_mode()))); |
| 2944 // Stack here: | 2949 // Stack here: |
| 2945 // - home_object | 2950 // - home_object |
| 2946 // - this (receiver) | 2951 // - this (receiver) |
| 2947 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2952 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2948 // - home_object | 2953 // - home_object |
| 2949 // - key | 2954 // - key |
| 2950 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2955 // - language_mode |
| 2956 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
| 2951 | 2957 |
| 2952 // Replace home_object with target function. | 2958 // Replace home_object with target function. |
| 2953 __ mov(Operand(esp, kPointerSize), eax); | 2959 __ mov(Operand(esp, kPointerSize), eax); |
| 2954 | 2960 |
| 2955 // Stack here: | 2961 // Stack here: |
| 2956 // - target function | 2962 // - target function |
| 2957 // - this (receiver) | 2963 // - this (receiver) |
| 2958 EmitCall(expr, CallICState::METHOD); | 2964 EmitCall(expr, CallICState::METHOD); |
| 2959 } | 2965 } |
| 2960 | 2966 |
| (...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5472 Assembler::target_address_at(call_target_address, | 5478 Assembler::target_address_at(call_target_address, |
| 5473 unoptimized_code)); | 5479 unoptimized_code)); |
| 5474 return OSR_AFTER_STACK_CHECK; | 5480 return OSR_AFTER_STACK_CHECK; |
| 5475 } | 5481 } |
| 5476 | 5482 |
| 5477 | 5483 |
| 5478 } // namespace internal | 5484 } // namespace internal |
| 5479 } // namespace v8 | 5485 } // namespace v8 |
| 5480 | 5486 |
| 5481 #endif // V8_TARGET_ARCH_X87 | 5487 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |