OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 __ SmiToInteger32(reg, reg); | 2510 __ SmiToInteger32(reg, reg); |
2511 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; | 2511 Register return_addr_reg = reg.is(rcx) ? rbx : rcx; |
2512 __ PopReturnAddressTo(return_addr_reg); | 2512 __ PopReturnAddressTo(return_addr_reg); |
2513 __ shlp(reg, Immediate(kPointerSizeLog2)); | 2513 __ shlp(reg, Immediate(kPointerSizeLog2)); |
2514 __ addp(rsp, reg); | 2514 __ addp(rsp, reg); |
2515 __ jmp(return_addr_reg); | 2515 __ jmp(return_addr_reg); |
2516 } | 2516 } |
2517 } | 2517 } |
2518 | 2518 |
2519 | 2519 |
2520 template <class T> | |
2521 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | |
2522 Register vector_register = ToRegister(instr->temp_vector()); | |
2523 Register slot_register = LoadWithVectorDescriptor::SlotRegister(); | |
2524 DCHECK(vector_register.is(LoadWithVectorDescriptor::VectorRegister())); | |
2525 DCHECK(slot_register.is(rax)); | |
2526 | |
2527 AllowDeferredHandleDereference vector_structure_check; | |
2528 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | |
2529 __ Move(vector_register, vector); | |
2530 // No need to allocate this register. | |
2531 FeedbackVectorSlot slot = instr->hydrogen()->slot(); | |
2532 int index = vector->GetIndex(slot); | |
2533 __ Move(slot_register, Smi::FromInt(index)); | |
2534 } | |
2535 | |
2536 | |
2537 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2520 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2538 Register context = ToRegister(instr->context()); | 2521 Register context = ToRegister(instr->context()); |
2539 Register result = ToRegister(instr->result()); | 2522 Register result = ToRegister(instr->result()); |
2540 __ movp(result, ContextOperand(context, instr->slot_index())); | 2523 __ movp(result, ContextOperand(context, instr->slot_index())); |
2541 if (instr->hydrogen()->RequiresHoleCheck()) { | 2524 if (instr->hydrogen()->RequiresHoleCheck()) { |
2542 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2525 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
2543 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2526 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2544 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); | 2527 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); |
2545 } else { | 2528 } else { |
2546 Label is_not_hole; | 2529 Label is_not_hole; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 | 2887 |
2905 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); | 2888 ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size); |
2906 return Operand(elements_pointer_reg, | 2889 return Operand(elements_pointer_reg, |
2907 ToRegister(key), | 2890 ToRegister(key), |
2908 scale_factor, | 2891 scale_factor, |
2909 offset); | 2892 offset); |
2910 } | 2893 } |
2911 } | 2894 } |
2912 | 2895 |
2913 | 2896 |
2914 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | |
2915 DCHECK(ToRegister(instr->context()).is(rsi)); | |
2916 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | |
2917 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | |
2918 | |
2919 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | |
2920 | |
2921 Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code(); | |
2922 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
2923 } | |
2924 | |
2925 | |
2926 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 2897 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
2927 Register result = ToRegister(instr->result()); | 2898 Register result = ToRegister(instr->result()); |
2928 | 2899 |
2929 if (instr->hydrogen()->from_inlined()) { | 2900 if (instr->hydrogen()->from_inlined()) { |
2930 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); | 2901 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); |
2931 } else if (instr->hydrogen()->arguments_adaptor()) { | 2902 } else if (instr->hydrogen()->arguments_adaptor()) { |
2932 // Check for arguments adapter frame. | 2903 // Check for arguments adapter frame. |
2933 Label done, adapted; | 2904 Label done, adapted; |
2934 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2905 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2935 __ Cmp(Operand(result, CommonFrameConstants::kContextOrFrameTypeOffset), | 2906 __ Cmp(Operand(result, CommonFrameConstants::kContextOrFrameTypeOffset), |
(...skipping 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5496 __ bind(deferred->exit()); | 5467 __ bind(deferred->exit()); |
5497 __ bind(&done); | 5468 __ bind(&done); |
5498 } | 5469 } |
5499 | 5470 |
5500 #undef __ | 5471 #undef __ |
5501 | 5472 |
5502 } // namespace internal | 5473 } // namespace internal |
5503 } // namespace v8 | 5474 } // namespace v8 |
5504 | 5475 |
5505 #endif // V8_TARGET_ARCH_X64 | 5476 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |