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