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 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 __ LoadRoot(load_name, Heap::knext_stringRootIndex); | 2192 __ LoadRoot(load_name, Heap::knext_stringRootIndex); |
2193 __ Push(load_name); // "next" | 2193 __ Push(load_name); // "next" |
2194 __ Push(Operand(rsp, 2 * kPointerSize)); // iter | 2194 __ Push(Operand(rsp, 2 * kPointerSize)); // iter |
2195 __ Push(rax); // received | 2195 __ Push(rax); // received |
2196 | 2196 |
2197 // result = receiver[f](arg); | 2197 // result = receiver[f](arg); |
2198 __ bind(&l_call); | 2198 __ bind(&l_call); |
2199 __ movp(load_receiver, Operand(rsp, kPointerSize)); | 2199 __ movp(load_receiver, Operand(rsp, kPointerSize)); |
2200 __ Move(LoadDescriptor::SlotRegister(), | 2200 __ Move(LoadDescriptor::SlotRegister(), |
2201 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 2201 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
2202 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2202 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
2203 CallIC(ic, TypeFeedbackId::None()); | 2203 CallIC(ic, TypeFeedbackId::None()); |
2204 __ movp(rdi, rax); | 2204 __ movp(rdi, rax); |
2205 __ movp(Operand(rsp, 2 * kPointerSize), rdi); | 2205 __ movp(Operand(rsp, 2 * kPointerSize), rdi); |
2206 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2206 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2207 __ CallStub(&stub); | 2207 __ CallStub(&stub); |
2208 | 2208 |
2209 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2209 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2210 __ Drop(1); // The function is still on the stack; drop it. | 2210 __ Drop(1); // The function is still on the stack; drop it. |
2211 | 2211 |
2212 // if (!result.done) goto l_try; | 2212 // if (!result.done) goto l_try; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 | 2360 |
2361 | 2361 |
2362 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2362 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2363 SetSourcePosition(prop->position()); | 2363 SetSourcePosition(prop->position()); |
2364 Literal* key = prop->key()->AsLiteral(); | 2364 Literal* key = prop->key()->AsLiteral(); |
2365 DCHECK(!prop->IsSuperAccess()); | 2365 DCHECK(!prop->IsSuperAccess()); |
2366 | 2366 |
2367 __ Move(LoadDescriptor::NameRegister(), key->value()); | 2367 __ Move(LoadDescriptor::NameRegister(), key->value()); |
2368 __ Move(LoadDescriptor::SlotRegister(), | 2368 __ Move(LoadDescriptor::SlotRegister(), |
2369 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2369 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2370 CallLoadIC(NOT_CONTEXTUAL); | 2370 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
2371 } | 2371 } |
2372 | 2372 |
2373 | 2373 |
2374 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2374 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2375 // Stack: receiver, home_object | 2375 // Stack: receiver, home_object |
2376 SetSourcePosition(prop->position()); | 2376 SetSourcePosition(prop->position()); |
2377 Literal* key = prop->key()->AsLiteral(); | 2377 Literal* key = prop->key()->AsLiteral(); |
2378 DCHECK(!key->value()->IsSmi()); | 2378 DCHECK(!key->value()->IsSmi()); |
2379 DCHECK(prop->IsSuperAccess()); | 2379 DCHECK(prop->IsSuperAccess()); |
2380 | 2380 |
2381 __ Push(key->value()); | 2381 __ Push(key->value()); |
2382 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2382 __ Push(Smi::FromInt(language_mode())); |
| 2383 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2383 } | 2384 } |
2384 | 2385 |
2385 | 2386 |
2386 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2387 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2387 SetSourcePosition(prop->position()); | 2388 SetSourcePosition(prop->position()); |
2388 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2389 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
2389 __ Move(LoadDescriptor::SlotRegister(), | 2390 __ Move(LoadDescriptor::SlotRegister(), |
2390 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2391 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2391 CallIC(ic); | 2392 CallIC(ic); |
2392 } | 2393 } |
2393 | 2394 |
2394 | 2395 |
2395 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2396 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2396 // Stack: receiver, home_object, key. | 2397 // Stack: receiver, home_object, key. |
| 2398 __ Push(Smi::FromInt(language_mode())); |
2397 SetSourcePosition(prop->position()); | 2399 SetSourcePosition(prop->position()); |
2398 | 2400 |
2399 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2401 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2400 } | 2402 } |
2401 | 2403 |
2402 | 2404 |
2403 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2405 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2404 Token::Value op, | 2406 Token::Value op, |
2405 Expression* left, | 2407 Expression* left, |
2406 Expression* right) { | 2408 Expression* right) { |
2407 // Do combined smi check of the operands. Left operand is on the | 2409 // Do combined smi check of the operands. Left operand is on the |
2408 // stack (popped into rdx). Right operand is in rax but moved into | 2410 // stack (popped into rdx). Right operand is in rax but moved into |
2409 // rcx to make the shifts easier. | 2411 // rcx to make the shifts easier. |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 Literal* key = prop->key()->AsLiteral(); | 2887 Literal* key = prop->key()->AsLiteral(); |
2886 DCHECK(!key->value()->IsSmi()); | 2888 DCHECK(!key->value()->IsSmi()); |
2887 // Load the function from the receiver. | 2889 // Load the function from the receiver. |
2888 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2890 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2889 VisitForStackValue(super_ref->home_object()); | 2891 VisitForStackValue(super_ref->home_object()); |
2890 VisitForAccumulatorValue(super_ref->this_var()); | 2892 VisitForAccumulatorValue(super_ref->this_var()); |
2891 __ Push(rax); | 2893 __ Push(rax); |
2892 __ Push(rax); | 2894 __ Push(rax); |
2893 __ Push(Operand(rsp, kPointerSize * 2)); | 2895 __ Push(Operand(rsp, kPointerSize * 2)); |
2894 __ Push(key->value()); | 2896 __ Push(key->value()); |
| 2897 __ Push(Smi::FromInt(language_mode())); |
2895 | 2898 |
2896 // Stack here: | 2899 // Stack here: |
2897 // - home_object | 2900 // - home_object |
2898 // - this (receiver) | 2901 // - this (receiver) |
2899 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2902 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2900 // - home_object | 2903 // - home_object |
2901 // - key | 2904 // - key |
2902 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2905 // - language_mode |
| 2906 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2903 | 2907 |
2904 // Replace home_object with target function. | 2908 // Replace home_object with target function. |
2905 __ movp(Operand(rsp, kPointerSize), rax); | 2909 __ movp(Operand(rsp, kPointerSize), rax); |
2906 | 2910 |
2907 // Stack here: | 2911 // Stack here: |
2908 // - target function | 2912 // - target function |
2909 // - this (receiver) | 2913 // - this (receiver) |
2910 EmitCall(expr, CallICState::METHOD); | 2914 EmitCall(expr, CallICState::METHOD); |
2911 } | 2915 } |
2912 | 2916 |
(...skipping 29 matching lines...) Expand all Loading... |
2942 | 2946 |
2943 SetSourcePosition(prop->position()); | 2947 SetSourcePosition(prop->position()); |
2944 // Load the function from the receiver. | 2948 // Load the function from the receiver. |
2945 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2949 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2946 VisitForStackValue(super_ref->home_object()); | 2950 VisitForStackValue(super_ref->home_object()); |
2947 VisitForAccumulatorValue(super_ref->this_var()); | 2951 VisitForAccumulatorValue(super_ref->this_var()); |
2948 __ Push(rax); | 2952 __ Push(rax); |
2949 __ Push(rax); | 2953 __ Push(rax); |
2950 __ Push(Operand(rsp, kPointerSize * 2)); | 2954 __ Push(Operand(rsp, kPointerSize * 2)); |
2951 VisitForStackValue(prop->key()); | 2955 VisitForStackValue(prop->key()); |
| 2956 __ Push(Smi::FromInt(language_mode())); |
2952 | 2957 |
2953 // Stack here: | 2958 // Stack here: |
2954 // - home_object | 2959 // - home_object |
2955 // - this (receiver) | 2960 // - this (receiver) |
2956 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2961 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2957 // - home_object | 2962 // - home_object |
2958 // - key | 2963 // - key |
2959 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2964 // - language_mode |
| 2965 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2960 | 2966 |
2961 // Replace home_object with target function. | 2967 // Replace home_object with target function. |
2962 __ movp(Operand(rsp, kPointerSize), rax); | 2968 __ movp(Operand(rsp, kPointerSize), rax); |
2963 | 2969 |
2964 // Stack here: | 2970 // Stack here: |
2965 // - target function | 2971 // - target function |
2966 // - this (receiver) | 2972 // - this (receiver) |
2967 EmitCall(expr, CallICState::METHOD); | 2973 EmitCall(expr, CallICState::METHOD); |
2968 } | 2974 } |
2969 | 2975 |
(...skipping 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5490 Assembler::target_address_at(call_target_address, | 5496 Assembler::target_address_at(call_target_address, |
5491 unoptimized_code)); | 5497 unoptimized_code)); |
5492 return OSR_AFTER_STACK_CHECK; | 5498 return OSR_AFTER_STACK_CHECK; |
5493 } | 5499 } |
5494 | 5500 |
5495 | 5501 |
5496 } // namespace internal | 5502 } // namespace internal |
5497 } // namespace v8 | 5503 } // namespace v8 |
5498 | 5504 |
5499 #endif // V8_TARGET_ARCH_X64 | 5505 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |