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