| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 } | 2707 } |
| 2708 } | 2708 } |
| 2709 | 2709 |
| 2710 | 2710 |
| 2711 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2711 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
| 2712 ASSERT(ToRegister(instr->context()).is(rsi)); | 2712 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 2713 ASSERT(ToRegister(instr->global_object()).is(rax)); | 2713 ASSERT(ToRegister(instr->global_object()).is(rax)); |
| 2714 ASSERT(ToRegister(instr->result()).is(rax)); | 2714 ASSERT(ToRegister(instr->result()).is(rax)); |
| 2715 | 2715 |
| 2716 __ Move(rcx, instr->name()); | 2716 __ Move(rcx, instr->name()); |
| 2717 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 2717 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
| 2718 RelocInfo::CODE_TARGET_CONTEXT; | 2718 Handle<Code> ic = LoadIC::initialize_stub(isolate(), mode); |
| 2719 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2719 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2720 CallCode(ic, mode, instr); | |
| 2721 } | 2720 } |
| 2722 | 2721 |
| 2723 | 2722 |
| 2724 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2723 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2725 Register value = ToRegister(instr->value()); | 2724 Register value = ToRegister(instr->value()); |
| 2726 Handle<Cell> cell_handle = instr->hydrogen()->cell().handle(); | 2725 Handle<Cell> cell_handle = instr->hydrogen()->cell().handle(); |
| 2727 | 2726 |
| 2728 // If the cell we are storing to contains the hole it could have | 2727 // If the cell we are storing to contains the hole it could have |
| 2729 // been deleted from the property dictionary. In that case, we need | 2728 // been deleted from the property dictionary. In that case, we need |
| 2730 // to update the property details in the property dictionary to mark | 2729 // to update the property details in the property dictionary to mark |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2746 // Cells are always rescanned, so no write barrier here. | 2745 // Cells are always rescanned, so no write barrier here. |
| 2747 } | 2746 } |
| 2748 | 2747 |
| 2749 | 2748 |
| 2750 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2749 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 2751 ASSERT(ToRegister(instr->context()).is(rsi)); | 2750 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 2752 ASSERT(ToRegister(instr->global_object()).is(rdx)); | 2751 ASSERT(ToRegister(instr->global_object()).is(rdx)); |
| 2753 ASSERT(ToRegister(instr->value()).is(rax)); | 2752 ASSERT(ToRegister(instr->value()).is(rax)); |
| 2754 | 2753 |
| 2755 __ Move(rcx, instr->name()); | 2754 __ Move(rcx, instr->name()); |
| 2756 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 2755 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 2757 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2756 instr->strict_mode_flag(), |
| 2758 : isolate()->builtins()->StoreIC_Initialize(); | 2757 CONTEXTUAL); |
| 2759 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2758 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2760 } | 2759 } |
| 2761 | 2760 |
| 2762 | 2761 |
| 2763 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2762 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2764 Register context = ToRegister(instr->context()); | 2763 Register context = ToRegister(instr->context()); |
| 2765 Register result = ToRegister(instr->result()); | 2764 Register result = ToRegister(instr->result()); |
| 2766 __ movq(result, ContextOperand(context, instr->slot_index())); | 2765 __ movq(result, ContextOperand(context, instr->slot_index())); |
| 2767 if (instr->hydrogen()->RequiresHoleCheck()) { | 2766 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2768 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2767 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 2769 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2768 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2846 __ Load(result, FieldOperand(object, offset), access.representation()); | 2845 __ Load(result, FieldOperand(object, offset), access.representation()); |
| 2847 } | 2846 } |
| 2848 | 2847 |
| 2849 | 2848 |
| 2850 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2849 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2851 ASSERT(ToRegister(instr->context()).is(rsi)); | 2850 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 2852 ASSERT(ToRegister(instr->object()).is(rax)); | 2851 ASSERT(ToRegister(instr->object()).is(rax)); |
| 2853 ASSERT(ToRegister(instr->result()).is(rax)); | 2852 ASSERT(ToRegister(instr->result()).is(rax)); |
| 2854 | 2853 |
| 2855 __ Move(rcx, instr->name()); | 2854 __ Move(rcx, instr->name()); |
| 2856 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2855 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
| 2857 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2856 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2858 } | 2857 } |
| 2859 | 2858 |
| 2860 | 2859 |
| 2861 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2860 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
| 2862 Register function = ToRegister(instr->function()); | 2861 Register function = ToRegister(instr->function()); |
| 2863 Register result = ToRegister(instr->result()); | 2862 Register result = ToRegister(instr->result()); |
| 2864 | 2863 |
| 2865 // Check that the function really is a function. | 2864 // Check that the function really is a function. |
| 2866 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); | 2865 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3779 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); | 3778 isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
| 3780 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3779 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3781 } | 3780 } |
| 3782 | 3781 |
| 3783 | 3782 |
| 3784 void LCodeGen::DoCallNamed(LCallNamed* instr) { | 3783 void LCodeGen::DoCallNamed(LCallNamed* instr) { |
| 3785 ASSERT(ToRegister(instr->context()).is(rsi)); | 3784 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 3786 ASSERT(ToRegister(instr->result()).is(rax)); | 3785 ASSERT(ToRegister(instr->result()).is(rax)); |
| 3787 | 3786 |
| 3788 int arity = instr->arity(); | 3787 int arity = instr->arity(); |
| 3789 RelocInfo::Mode mode = RelocInfo::CODE_TARGET; | |
| 3790 Handle<Code> ic = | 3788 Handle<Code> ic = |
| 3791 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3789 isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL); |
| 3792 __ Move(rcx, instr->name()); | 3790 __ Move(rcx, instr->name()); |
| 3793 CallCode(ic, mode, instr); | 3791 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3794 } | 3792 } |
| 3795 | 3793 |
| 3796 | 3794 |
| 3797 void LCodeGen::DoCallFunction(LCallFunction* instr) { | 3795 void LCodeGen::DoCallFunction(LCallFunction* instr) { |
| 3798 ASSERT(ToRegister(instr->context()).is(rsi)); | 3796 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 3799 ASSERT(ToRegister(instr->function()).is(rdi)); | 3797 ASSERT(ToRegister(instr->function()).is(rdi)); |
| 3800 ASSERT(ToRegister(instr->result()).is(rax)); | 3798 ASSERT(ToRegister(instr->result()).is(rax)); |
| 3801 | 3799 |
| 3802 int arity = instr->arity(); | 3800 int arity = instr->arity(); |
| 3803 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); | 3801 CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS); |
| 3804 if (instr->hydrogen()->IsTailCall()) { | 3802 if (instr->hydrogen()->IsTailCall()) { |
| 3805 if (NeedsEagerFrame()) __ leave(); | 3803 if (NeedsEagerFrame()) __ leave(); |
| 3806 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 3804 __ jmp(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
| 3807 } else { | 3805 } else { |
| 3808 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3806 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 3809 } | 3807 } |
| 3810 } | 3808 } |
| 3811 | 3809 |
| 3812 | 3810 |
| 3813 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { | 3811 void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
| 3814 ASSERT(ToRegister(instr->context()).is(rsi)); | 3812 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 3815 ASSERT(ToRegister(instr->result()).is(rax)); | 3813 ASSERT(ToRegister(instr->result()).is(rax)); |
| 3816 int arity = instr->arity(); | 3814 int arity = instr->arity(); |
| 3817 RelocInfo::Mode mode = RelocInfo::CODE_TARGET_CONTEXT; | |
| 3818 Handle<Code> ic = | 3815 Handle<Code> ic = |
| 3819 isolate()->stub_cache()->ComputeCallInitialize(arity, mode); | 3816 isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL); |
| 3820 __ Move(rcx, instr->name()); | 3817 __ Move(rcx, instr->name()); |
| 3821 CallCode(ic, mode, instr); | 3818 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3822 } | 3819 } |
| 3823 | 3820 |
| 3824 | 3821 |
| 3825 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { | 3822 void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
| 3826 ASSERT(ToRegister(instr->result()).is(rax)); | 3823 ASSERT(ToRegister(instr->result()).is(rax)); |
| 3827 CallKnownFunction(instr->hydrogen()->target(), | 3824 CallKnownFunction(instr->hydrogen()->target(), |
| 3828 instr->hydrogen()->formal_parameter_count(), | 3825 instr->hydrogen()->formal_parameter_count(), |
| 3829 instr->arity(), | 3826 instr->arity(), |
| 3830 instr, | 3827 instr, |
| 3831 CALL_AS_FUNCTION, | 3828 CALL_AS_FUNCTION, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4034 } | 4031 } |
| 4035 } | 4032 } |
| 4036 | 4033 |
| 4037 | 4034 |
| 4038 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4035 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4039 ASSERT(ToRegister(instr->context()).is(rsi)); | 4036 ASSERT(ToRegister(instr->context()).is(rsi)); |
| 4040 ASSERT(ToRegister(instr->object()).is(rdx)); | 4037 ASSERT(ToRegister(instr->object()).is(rdx)); |
| 4041 ASSERT(ToRegister(instr->value()).is(rax)); | 4038 ASSERT(ToRegister(instr->value()).is(rax)); |
| 4042 | 4039 |
| 4043 __ Move(rcx, instr->hydrogen()->name()); | 4040 __ Move(rcx, instr->hydrogen()->name()); |
| 4044 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 4041 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 4045 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 4042 instr->strict_mode_flag(), |
| 4046 : isolate()->builtins()->StoreIC_Initialize(); | 4043 NOT_CONTEXTUAL); |
| 4047 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4044 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4048 } | 4045 } |
| 4049 | 4046 |
| 4050 | 4047 |
| 4051 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 4048 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
| 4052 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4049 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
| 4053 Label done; | 4050 Label done; |
| 4054 __ j(NegateCondition(cc), &done, Label::kNear); | 4051 __ j(NegateCondition(cc), &done, Label::kNear); |
| 4055 __ int3(); | 4052 __ int3(); |
| 4056 __ bind(&done); | 4053 __ bind(&done); |
| (...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5582 FixedArray::kHeaderSize - kPointerSize)); | 5579 FixedArray::kHeaderSize - kPointerSize)); |
| 5583 __ bind(&done); | 5580 __ bind(&done); |
| 5584 } | 5581 } |
| 5585 | 5582 |
| 5586 | 5583 |
| 5587 #undef __ | 5584 #undef __ |
| 5588 | 5585 |
| 5589 } } // namespace v8::internal | 5586 } } // namespace v8::internal |
| 5590 | 5587 |
| 5591 #endif // V8_TARGET_ARCH_X64 | 5588 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |