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(), SLOPPY).code(); | 2199 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).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, language_mode()); | 2367 CallLoadIC(NOT_CONTEXTUAL); |
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 __ Push(Smi::FromInt(language_mode())); | 2379 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2380 __ CallRuntime(Runtime::kLoadFromSuper, 4); | |
2381 } | 2380 } |
2382 | 2381 |
2383 | 2382 |
2384 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2383 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2385 SetSourcePosition(prop->position()); | 2384 SetSourcePosition(prop->position()); |
2386 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); | 2385 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2387 __ Move(LoadDescriptor::SlotRegister(), | 2386 __ Move(LoadDescriptor::SlotRegister(), |
2388 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2387 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2389 CallIC(ic); | 2388 CallIC(ic); |
2390 } | 2389 } |
2391 | 2390 |
2392 | 2391 |
2393 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2392 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2394 // Stack: receiver, home_object, key. | 2393 // Stack: receiver, home_object, key. |
2395 __ Push(Smi::FromInt(language_mode())); | |
2396 SetSourcePosition(prop->position()); | 2394 SetSourcePosition(prop->position()); |
2397 | 2395 |
2398 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 2396 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
2399 } | 2397 } |
2400 | 2398 |
2401 | 2399 |
2402 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2400 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2403 Token::Value op, | 2401 Token::Value op, |
2404 Expression* left, | 2402 Expression* left, |
2405 Expression* right) { | 2403 Expression* right) { |
2406 // Do combined smi check of the operands. Left operand is on the | 2404 // Do combined smi check of the operands. Left operand is on the |
2407 // stack (popped into rdx). Right operand is in rax but moved into | 2405 // stack (popped into rdx). Right operand is in rax but moved into |
2408 // rcx to make the shifts easier. | 2406 // rcx to make the shifts easier. |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 Literal* key = prop->key()->AsLiteral(); | 2882 Literal* key = prop->key()->AsLiteral(); |
2885 DCHECK(!key->value()->IsSmi()); | 2883 DCHECK(!key->value()->IsSmi()); |
2886 // Load the function from the receiver. | 2884 // Load the function from the receiver. |
2887 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2885 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2888 VisitForStackValue(super_ref->home_object()); | 2886 VisitForStackValue(super_ref->home_object()); |
2889 VisitForAccumulatorValue(super_ref->this_var()); | 2887 VisitForAccumulatorValue(super_ref->this_var()); |
2890 __ Push(rax); | 2888 __ Push(rax); |
2891 __ Push(rax); | 2889 __ Push(rax); |
2892 __ Push(Operand(rsp, kPointerSize * 2)); | 2890 __ Push(Operand(rsp, kPointerSize * 2)); |
2893 __ Push(key->value()); | 2891 __ Push(key->value()); |
2894 __ Push(Smi::FromInt(language_mode())); | |
2895 | 2892 |
2896 // Stack here: | 2893 // Stack here: |
2897 // - home_object | 2894 // - home_object |
2898 // - this (receiver) | 2895 // - this (receiver) |
2899 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2896 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2900 // - home_object | 2897 // - home_object |
2901 // - key | 2898 // - key |
2902 // - language_mode | 2899 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2903 __ CallRuntime(Runtime::kLoadFromSuper, 4); | |
2904 | 2900 |
2905 // Replace home_object with target function. | 2901 // Replace home_object with target function. |
2906 __ movp(Operand(rsp, kPointerSize), rax); | 2902 __ movp(Operand(rsp, kPointerSize), rax); |
2907 | 2903 |
2908 // Stack here: | 2904 // Stack here: |
2909 // - target function | 2905 // - target function |
2910 // - this (receiver) | 2906 // - this (receiver) |
2911 EmitCall(expr, CallICState::METHOD); | 2907 EmitCall(expr, CallICState::METHOD); |
2912 } | 2908 } |
2913 | 2909 |
(...skipping 29 matching lines...) Expand all Loading... |
2943 | 2939 |
2944 SetSourcePosition(prop->position()); | 2940 SetSourcePosition(prop->position()); |
2945 // Load the function from the receiver. | 2941 // Load the function from the receiver. |
2946 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2942 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2947 VisitForStackValue(super_ref->home_object()); | 2943 VisitForStackValue(super_ref->home_object()); |
2948 VisitForAccumulatorValue(super_ref->this_var()); | 2944 VisitForAccumulatorValue(super_ref->this_var()); |
2949 __ Push(rax); | 2945 __ Push(rax); |
2950 __ Push(rax); | 2946 __ Push(rax); |
2951 __ Push(Operand(rsp, kPointerSize * 2)); | 2947 __ Push(Operand(rsp, kPointerSize * 2)); |
2952 VisitForStackValue(prop->key()); | 2948 VisitForStackValue(prop->key()); |
2953 __ Push(Smi::FromInt(language_mode())); | |
2954 | 2949 |
2955 // Stack here: | 2950 // Stack here: |
2956 // - home_object | 2951 // - home_object |
2957 // - this (receiver) | 2952 // - this (receiver) |
2958 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2953 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2959 // - home_object | 2954 // - home_object |
2960 // - key | 2955 // - key |
2961 // - language_mode | 2956 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
2962 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | |
2963 | 2957 |
2964 // Replace home_object with target function. | 2958 // Replace home_object with target function. |
2965 __ movp(Operand(rsp, kPointerSize), rax); | 2959 __ movp(Operand(rsp, kPointerSize), rax); |
2966 | 2960 |
2967 // Stack here: | 2961 // Stack here: |
2968 // - target function | 2962 // - target function |
2969 // - this (receiver) | 2963 // - this (receiver) |
2970 EmitCall(expr, CallICState::METHOD); | 2964 EmitCall(expr, CallICState::METHOD); |
2971 } | 2965 } |
2972 | 2966 |
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5509 Assembler::target_address_at(call_target_address, | 5503 Assembler::target_address_at(call_target_address, |
5510 unoptimized_code)); | 5504 unoptimized_code)); |
5511 return OSR_AFTER_STACK_CHECK; | 5505 return OSR_AFTER_STACK_CHECK; |
5512 } | 5506 } |
5513 | 5507 |
5514 | 5508 |
5515 } // namespace internal | 5509 } // namespace internal |
5516 } // namespace v8 | 5510 } // namespace v8 |
5517 | 5511 |
5518 #endif // V8_TARGET_ARCH_X64 | 5512 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |