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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 Literal* key = prop->key()->AsLiteral(); | 2873 Literal* key = prop->key()->AsLiteral(); |
2872 DCHECK(!key->value()->IsSmi()); | 2874 DCHECK(!key->value()->IsSmi()); |
2873 // Load the function from the receiver. | 2875 // Load the function from the receiver. |
2874 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2876 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2875 VisitForStackValue(super_ref->home_object()); | 2877 VisitForStackValue(super_ref->home_object()); |
2876 VisitForAccumulatorValue(super_ref->this_var()); | 2878 VisitForAccumulatorValue(super_ref->this_var()); |
2877 __ push(eax); | 2879 __ push(eax); |
2878 __ push(eax); | 2880 __ push(eax); |
2879 __ push(Operand(esp, kPointerSize * 2)); | 2881 __ push(Operand(esp, kPointerSize * 2)); |
2880 __ push(Immediate(key->value())); | 2882 __ push(Immediate(key->value())); |
| 2883 __ push(Immediate(Smi::FromInt(language_mode()))); |
2881 // Stack here: | 2884 // Stack here: |
2882 // - home_object | 2885 // - home_object |
2883 // - this (receiver) | 2886 // - this (receiver) |
2884 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2887 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2885 // - home_object | 2888 // - home_object |
2886 // - key | 2889 // - key |
2887 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2890 // - language_mode |
| 2891 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2888 | 2892 |
2889 // Replace home_object with target function. | 2893 // Replace home_object with target function. |
2890 __ mov(Operand(esp, kPointerSize), eax); | 2894 __ mov(Operand(esp, kPointerSize), eax); |
2891 | 2895 |
2892 // Stack here: | 2896 // Stack here: |
2893 // - target function | 2897 // - target function |
2894 // - this (receiver) | 2898 // - this (receiver) |
2895 EmitCall(expr, CallICState::METHOD); | 2899 EmitCall(expr, CallICState::METHOD); |
2896 } | 2900 } |
2897 | 2901 |
(...skipping 29 matching lines...) Expand all Loading... |
2927 | 2931 |
2928 SetSourcePosition(prop->position()); | 2932 SetSourcePosition(prop->position()); |
2929 // Load the function from the receiver. | 2933 // Load the function from the receiver. |
2930 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2934 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2931 VisitForStackValue(super_ref->home_object()); | 2935 VisitForStackValue(super_ref->home_object()); |
2932 VisitForAccumulatorValue(super_ref->this_var()); | 2936 VisitForAccumulatorValue(super_ref->this_var()); |
2933 __ push(eax); | 2937 __ push(eax); |
2934 __ push(eax); | 2938 __ push(eax); |
2935 __ push(Operand(esp, kPointerSize * 2)); | 2939 __ push(Operand(esp, kPointerSize * 2)); |
2936 VisitForStackValue(prop->key()); | 2940 VisitForStackValue(prop->key()); |
| 2941 __ push(Immediate(Smi::FromInt(language_mode()))); |
2937 // Stack here: | 2942 // Stack here: |
2938 // - home_object | 2943 // - home_object |
2939 // - this (receiver) | 2944 // - this (receiver) |
2940 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2945 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2941 // - home_object | 2946 // - home_object |
2942 // - key | 2947 // - key |
2943 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2948 // - language_mode |
| 2949 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2944 | 2950 |
2945 // Replace home_object with target function. | 2951 // Replace home_object with target function. |
2946 __ mov(Operand(esp, kPointerSize), eax); | 2952 __ mov(Operand(esp, kPointerSize), eax); |
2947 | 2953 |
2948 // Stack here: | 2954 // Stack here: |
2949 // - target function | 2955 // - target function |
2950 // - this (receiver) | 2956 // - this (receiver) |
2951 EmitCall(expr, CallICState::METHOD); | 2957 EmitCall(expr, CallICState::METHOD); |
2952 } | 2958 } |
2953 | 2959 |
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 Assembler::target_address_at(call_target_address, | 5482 Assembler::target_address_at(call_target_address, |
5477 unoptimized_code)); | 5483 unoptimized_code)); |
5478 return OSR_AFTER_STACK_CHECK; | 5484 return OSR_AFTER_STACK_CHECK; |
5479 } | 5485 } |
5480 | 5486 |
5481 | 5487 |
5482 } // namespace internal | 5488 } // namespace internal |
5483 } // namespace v8 | 5489 } // namespace v8 |
5484 | 5490 |
5485 #endif // V8_TARGET_ARCH_X87 | 5491 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |