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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 __ LoadRoot(load_name, Heap::knext_stringRootIndex); | 2202 __ LoadRoot(load_name, Heap::knext_stringRootIndex); |
2203 __ Push(load_name); // "next" | 2203 __ Push(load_name); // "next" |
2204 __ Push(Operand(rsp, 2 * kPointerSize)); // iter | 2204 __ Push(Operand(rsp, 2 * kPointerSize)); // iter |
2205 __ Push(rax); // received | 2205 __ Push(rax); // received |
2206 | 2206 |
2207 // result = receiver[f](arg); | 2207 // result = receiver[f](arg); |
2208 __ bind(&l_call); | 2208 __ bind(&l_call); |
2209 __ movp(load_receiver, Operand(rsp, kPointerSize)); | 2209 __ movp(load_receiver, Operand(rsp, kPointerSize)); |
2210 __ Move(LoadDescriptor::SlotRegister(), | 2210 __ Move(LoadDescriptor::SlotRegister(), |
2211 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 2211 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
2212 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2212 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2213 CallIC(ic, TypeFeedbackId::None()); | 2213 CallIC(ic, TypeFeedbackId::None()); |
2214 __ movp(rdi, rax); | 2214 __ movp(rdi, rax); |
2215 __ movp(Operand(rsp, 2 * kPointerSize), rdi); | 2215 __ movp(Operand(rsp, 2 * kPointerSize), rdi); |
2216 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2216 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2217 __ CallStub(&stub); | 2217 __ CallStub(&stub); |
2218 | 2218 |
2219 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2219 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2220 __ Drop(1); // The function is still on the stack; drop it. | 2220 __ Drop(1); // The function is still on the stack; drop it. |
2221 | 2221 |
2222 // if (!result.done) goto l_try; | 2222 // if (!result.done) goto l_try; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 | 2370 |
2371 | 2371 |
2372 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2372 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2373 SetSourcePosition(prop->position()); | 2373 SetSourcePosition(prop->position()); |
2374 Literal* key = prop->key()->AsLiteral(); | 2374 Literal* key = prop->key()->AsLiteral(); |
2375 DCHECK(!prop->IsSuperAccess()); | 2375 DCHECK(!prop->IsSuperAccess()); |
2376 | 2376 |
2377 __ Move(LoadDescriptor::NameRegister(), key->value()); | 2377 __ Move(LoadDescriptor::NameRegister(), key->value()); |
2378 __ Move(LoadDescriptor::SlotRegister(), | 2378 __ Move(LoadDescriptor::SlotRegister(), |
2379 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2379 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2380 CallLoadIC(NOT_CONTEXTUAL); | 2380 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
2381 } | 2381 } |
2382 | 2382 |
2383 | 2383 |
2384 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2384 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2385 // Stack: receiver, home_object | 2385 // Stack: receiver, home_object |
2386 SetSourcePosition(prop->position()); | 2386 SetSourcePosition(prop->position()); |
2387 Literal* key = prop->key()->AsLiteral(); | 2387 Literal* key = prop->key()->AsLiteral(); |
2388 DCHECK(!key->value()->IsSmi()); | 2388 DCHECK(!key->value()->IsSmi()); |
2389 DCHECK(prop->IsSuperAccess()); | 2389 DCHECK(prop->IsSuperAccess()); |
2390 | 2390 |
2391 __ Push(key->value()); | 2391 __ Push(key->value()); |
2392 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2392 __ Push(Smi::FromInt(language_mode())); |
| 2393 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2393 } | 2394 } |
2394 | 2395 |
2395 | 2396 |
2396 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2397 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2397 SetSourcePosition(prop->position()); | 2398 SetSourcePosition(prop->position()); |
2398 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2399 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
2399 __ Move(LoadDescriptor::SlotRegister(), | 2400 __ Move(LoadDescriptor::SlotRegister(), |
2400 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2401 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2401 CallIC(ic); | 2402 CallIC(ic); |
2402 } | 2403 } |
2403 | 2404 |
2404 | 2405 |
2405 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2406 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2406 // Stack: receiver, home_object, key. | 2407 // Stack: receiver, home_object, key. |
| 2408 __ Push(Smi::FromInt(language_mode())); |
2407 SetSourcePosition(prop->position()); | 2409 SetSourcePosition(prop->position()); |
2408 | 2410 |
2409 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2411 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2410 } | 2412 } |
2411 | 2413 |
2412 | 2414 |
2413 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2415 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2414 Token::Value op, | 2416 Token::Value op, |
2415 Expression* left, | 2417 Expression* left, |
2416 Expression* right) { | 2418 Expression* right) { |
2417 // Do combined smi check of the operands. Left operand is on the | 2419 // Do combined smi check of the operands. Left operand is on the |
2418 // stack (popped into rdx). Right operand is in rax but moved into | 2420 // stack (popped into rdx). Right operand is in rax but moved into |
2419 // rcx to make the shifts easier. | 2421 // rcx to make the shifts easier. |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2888 Literal* key = prop->key()->AsLiteral(); | 2890 Literal* key = prop->key()->AsLiteral(); |
2889 DCHECK(!key->value()->IsSmi()); | 2891 DCHECK(!key->value()->IsSmi()); |
2890 // Load the function from the receiver. | 2892 // Load the function from the receiver. |
2891 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2893 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2892 VisitForStackValue(super_ref->home_object()); | 2894 VisitForStackValue(super_ref->home_object()); |
2893 VisitForAccumulatorValue(super_ref->this_var()); | 2895 VisitForAccumulatorValue(super_ref->this_var()); |
2894 __ Push(rax); | 2896 __ Push(rax); |
2895 __ Push(rax); | 2897 __ Push(rax); |
2896 __ Push(Operand(rsp, kPointerSize * 2)); | 2898 __ Push(Operand(rsp, kPointerSize * 2)); |
2897 __ Push(key->value()); | 2899 __ Push(key->value()); |
| 2900 __ Push(Smi::FromInt(language_mode())); |
2898 | 2901 |
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 __ movp(Operand(rsp, kPointerSize), rax); | 2912 __ movp(Operand(rsp, kPointerSize), rax); |
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(rax); | 2955 __ Push(rax); |
2952 __ Push(rax); | 2956 __ Push(rax); |
2953 __ Push(Operand(rsp, kPointerSize * 2)); | 2957 __ Push(Operand(rsp, kPointerSize * 2)); |
2954 VisitForStackValue(prop->key()); | 2958 VisitForStackValue(prop->key()); |
| 2959 __ Push(Smi::FromInt(language_mode())); |
2955 | 2960 |
2956 // Stack here: | 2961 // Stack here: |
2957 // - home_object | 2962 // - home_object |
2958 // - this (receiver) | 2963 // - this (receiver) |
2959 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2964 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2960 // - home_object | 2965 // - home_object |
2961 // - key | 2966 // - key |
2962 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2967 // - language_mode |
| 2968 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2963 | 2969 |
2964 // Replace home_object with target function. | 2970 // Replace home_object with target function. |
2965 __ movp(Operand(rsp, kPointerSize), rax); | 2971 __ movp(Operand(rsp, kPointerSize), rax); |
2966 | 2972 |
2967 // Stack here: | 2973 // Stack here: |
2968 // - target function | 2974 // - target function |
2969 // - this (receiver) | 2975 // - this (receiver) |
2970 EmitCall(expr, CallICState::METHOD); | 2976 EmitCall(expr, CallICState::METHOD); |
2971 } | 2977 } |
2972 | 2978 |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5523 Assembler::target_address_at(call_target_address, | 5529 Assembler::target_address_at(call_target_address, |
5524 unoptimized_code)); | 5530 unoptimized_code)); |
5525 return OSR_AFTER_STACK_CHECK; | 5531 return OSR_AFTER_STACK_CHECK; |
5526 } | 5532 } |
5527 | 5533 |
5528 | 5534 |
5529 } // namespace internal | 5535 } // namespace internal |
5530 } // namespace v8 | 5536 } // namespace v8 |
5531 | 5537 |
5532 #endif // V8_TARGET_ARCH_X64 | 5538 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |