| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2505 SafepointGenerator safepoint_generator(this, | 2505 SafepointGenerator safepoint_generator(this, |
| 2506 pointers, | 2506 pointers, |
| 2507 env->deoptimization_index()); | 2507 env->deoptimization_index()); |
| 2508 v8::internal::ParameterCount actual(rax); | 2508 v8::internal::ParameterCount actual(rax); |
| 2509 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); | 2509 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); |
| 2510 } | 2510 } |
| 2511 | 2511 |
| 2512 | 2512 |
| 2513 void LCodeGen::DoPushArgument(LPushArgument* instr) { | 2513 void LCodeGen::DoPushArgument(LPushArgument* instr) { |
| 2514 LOperand* argument = instr->InputAt(0); | 2514 LOperand* argument = instr->InputAt(0); |
| 2515 if (argument->IsConstantOperand()) { | 2515 EmitPushTaggedOperand(argument); |
| 2516 EmitPushConstantOperand(argument); | |
| 2517 } else if (argument->IsRegister()) { | |
| 2518 __ push(ToRegister(argument)); | |
| 2519 } else { | |
| 2520 ASSERT(!argument->IsDoubleRegister()); | |
| 2521 __ push(ToOperand(argument)); | |
| 2522 } | |
| 2523 } | 2516 } |
| 2524 | 2517 |
| 2525 | 2518 |
| 2526 void LCodeGen::DoContext(LContext* instr) { | 2519 void LCodeGen::DoContext(LContext* instr) { |
| 2527 Register result = ToRegister(instr->result()); | 2520 Register result = ToRegister(instr->result()); |
| 2528 __ movq(result, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2521 __ movq(result, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 2529 } | 2522 } |
| 2530 | 2523 |
| 2531 | 2524 |
| 2532 void LCodeGen::DoOuterContext(LOuterContext* instr) { | 2525 void LCodeGen::DoOuterContext(LOuterContext* instr) { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3106 ASSERT(ToRegister(instr->key()).is(rcx)); | 3099 ASSERT(ToRegister(instr->key()).is(rcx)); |
| 3107 ASSERT(ToRegister(instr->value()).is(rax)); | 3100 ASSERT(ToRegister(instr->value()).is(rax)); |
| 3108 | 3101 |
| 3109 Handle<Code> ic = instr->strict_mode() | 3102 Handle<Code> ic = instr->strict_mode() |
| 3110 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3103 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
| 3111 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3104 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
| 3112 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3105 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3113 } | 3106 } |
| 3114 | 3107 |
| 3115 | 3108 |
| 3109 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| 3110 EmitPushTaggedOperand(instr->left()); |
| 3111 EmitPushTaggedOperand(instr->right()); |
| 3112 StringAddStub stub(NO_STRING_CHECK_IN_STUB); |
| 3113 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3114 } |
| 3115 |
| 3116 |
| 3116 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { | 3117 void LCodeGen::DoStringCharCodeAt(LStringCharCodeAt* instr) { |
| 3117 class DeferredStringCharCodeAt: public LDeferredCode { | 3118 class DeferredStringCharCodeAt: public LDeferredCode { |
| 3118 public: | 3119 public: |
| 3119 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) | 3120 DeferredStringCharCodeAt(LCodeGen* codegen, LStringCharCodeAt* instr) |
| 3120 : LDeferredCode(codegen), instr_(instr) { } | 3121 : LDeferredCode(codegen), instr_(instr) { } |
| 3121 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } | 3122 virtual void Generate() { codegen()->DoDeferredStringCharCodeAt(instr_); } |
| 3122 private: | 3123 private: |
| 3123 LStringCharCodeAt* instr_; | 3124 LStringCharCodeAt* instr_; |
| 3124 }; | 3125 }; |
| 3125 | 3126 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3765 __ PushRoot(pretenure ? | 3766 __ PushRoot(pretenure ? |
| 3766 Heap::kTrueValueRootIndex : | 3767 Heap::kTrueValueRootIndex : |
| 3767 Heap::kFalseValueRootIndex); | 3768 Heap::kFalseValueRootIndex); |
| 3768 CallRuntime(Runtime::kNewClosure, 3, instr); | 3769 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 3769 } | 3770 } |
| 3770 } | 3771 } |
| 3771 | 3772 |
| 3772 | 3773 |
| 3773 void LCodeGen::DoTypeof(LTypeof* instr) { | 3774 void LCodeGen::DoTypeof(LTypeof* instr) { |
| 3774 LOperand* input = instr->InputAt(0); | 3775 LOperand* input = instr->InputAt(0); |
| 3775 if (input->IsConstantOperand()) { | 3776 EmitPushTaggedOperand(input); |
| 3776 __ Push(ToHandle(LConstantOperand::cast(input))); | |
| 3777 } else if (input->IsRegister()) { | |
| 3778 __ push(ToRegister(input)); | |
| 3779 } else { | |
| 3780 ASSERT(input->IsStackSlot()); | |
| 3781 __ push(ToOperand(input)); | |
| 3782 } | |
| 3783 CallRuntime(Runtime::kTypeof, 1, instr); | 3777 CallRuntime(Runtime::kTypeof, 1, instr); |
| 3784 } | 3778 } |
| 3785 | 3779 |
| 3786 | 3780 |
| 3787 void LCodeGen::DoTypeofIs(LTypeofIs* instr) { | 3781 void LCodeGen::DoTypeofIs(LTypeofIs* instr) { |
| 3788 Register input = ToRegister(instr->InputAt(0)); | 3782 Register input = ToRegister(instr->InputAt(0)); |
| 3789 Register result = ToRegister(instr->result()); | 3783 Register result = ToRegister(instr->result()); |
| 3790 Label true_label; | 3784 Label true_label; |
| 3791 Label false_label; | 3785 Label false_label; |
| 3792 NearLabel done; | 3786 NearLabel done; |
| 3793 | 3787 |
| 3794 Condition final_branch_condition = EmitTypeofIs(&true_label, | 3788 Condition final_branch_condition = EmitTypeofIs(&true_label, |
| 3795 &false_label, | 3789 &false_label, |
| 3796 input, | 3790 input, |
| 3797 instr->type_literal()); | 3791 instr->type_literal()); |
| 3798 __ j(final_branch_condition, &true_label); | 3792 __ j(final_branch_condition, &true_label); |
| 3799 __ bind(&false_label); | 3793 __ bind(&false_label); |
| 3800 __ LoadRoot(result, Heap::kFalseValueRootIndex); | 3794 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
| 3801 __ jmp(&done); | 3795 __ jmp(&done); |
| 3802 | 3796 |
| 3803 __ bind(&true_label); | 3797 __ bind(&true_label); |
| 3804 __ LoadRoot(result, Heap::kTrueValueRootIndex); | 3798 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
| 3805 | 3799 |
| 3806 __ bind(&done); | 3800 __ bind(&done); |
| 3807 } | 3801 } |
| 3808 | 3802 |
| 3809 | 3803 |
| 3810 void LCodeGen::EmitPushConstantOperand(LOperand* operand) { | 3804 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
| 3811 ASSERT(operand->IsConstantOperand()); | 3805 ASSERT(!operand->IsDoubleRegister()); |
| 3812 LConstantOperand* const_op = LConstantOperand::cast(operand); | 3806 if (operand->IsConstantOperand()) { |
| 3813 Handle<Object> literal = chunk_->LookupLiteral(const_op); | 3807 __ Push(ToHandle(LConstantOperand::cast(operand))); |
| 3814 Representation r = chunk_->LookupLiteralRepresentation(const_op); | 3808 } else if (operand->IsRegister()) { |
| 3815 if (r.IsInteger32()) { | 3809 __ push(ToRegister(operand)); |
| 3816 ASSERT(literal->IsNumber()); | |
| 3817 __ push(Immediate(static_cast<int32_t>(literal->Number()))); | |
| 3818 } else if (r.IsDouble()) { | |
| 3819 Abort("unsupported double immediate"); | |
| 3820 } else { | 3810 } else { |
| 3821 ASSERT(r.IsTagged()); | 3811 __ push(ToOperand(operand)); |
| 3822 __ Push(literal); | |
| 3823 } | 3812 } |
| 3824 } | 3813 } |
| 3825 | 3814 |
| 3826 | 3815 |
| 3827 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 3816 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
| 3828 Register input = ToRegister(instr->InputAt(0)); | 3817 Register input = ToRegister(instr->InputAt(0)); |
| 3829 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 3818 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 3830 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 3819 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 3831 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 3820 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 3832 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 3821 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3958 | 3947 |
| 3959 | 3948 |
| 3960 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 3949 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
| 3961 DeoptimizeIf(no_condition, instr->environment()); | 3950 DeoptimizeIf(no_condition, instr->environment()); |
| 3962 } | 3951 } |
| 3963 | 3952 |
| 3964 | 3953 |
| 3965 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { | 3954 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
| 3966 LOperand* obj = instr->object(); | 3955 LOperand* obj = instr->object(); |
| 3967 LOperand* key = instr->key(); | 3956 LOperand* key = instr->key(); |
| 3968 // Push object. | 3957 EmitPushTaggedOperand(obj); |
| 3969 if (obj->IsRegister()) { | 3958 EmitPushTaggedOperand(key); |
| 3970 __ push(ToRegister(obj)); | |
| 3971 } else { | |
| 3972 __ push(ToOperand(obj)); | |
| 3973 } | |
| 3974 // Push key. | |
| 3975 if (key->IsConstantOperand()) { | |
| 3976 EmitPushConstantOperand(key); | |
| 3977 } else if (key->IsRegister()) { | |
| 3978 __ push(ToRegister(key)); | |
| 3979 } else { | |
| 3980 __ push(ToOperand(key)); | |
| 3981 } | |
| 3982 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); | 3959 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 3983 LPointerMap* pointers = instr->pointer_map(); | 3960 LPointerMap* pointers = instr->pointer_map(); |
| 3984 LEnvironment* env = instr->deoptimization_environment(); | 3961 LEnvironment* env = instr->deoptimization_environment(); |
| 3985 RecordPosition(pointers->position()); | 3962 RecordPosition(pointers->position()); |
| 3986 RegisterEnvironmentForDeoptimization(env); | 3963 RegisterEnvironmentForDeoptimization(env); |
| 3987 // Create safepoint generator that will also ensure enough space in the | 3964 // Create safepoint generator that will also ensure enough space in the |
| 3988 // reloc info for patching in deoptimization (since this is invoking a | 3965 // reloc info for patching in deoptimization (since this is invoking a |
| 3989 // builtin) | 3966 // builtin) |
| 3990 SafepointGenerator safepoint_generator(this, | 3967 SafepointGenerator safepoint_generator(this, |
| 3991 pointers, | 3968 pointers, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4021 RegisterEnvironmentForDeoptimization(environment); | 3998 RegisterEnvironmentForDeoptimization(environment); |
| 4022 ASSERT(osr_pc_offset_ == -1); | 3999 ASSERT(osr_pc_offset_ == -1); |
| 4023 osr_pc_offset_ = masm()->pc_offset(); | 4000 osr_pc_offset_ = masm()->pc_offset(); |
| 4024 } | 4001 } |
| 4025 | 4002 |
| 4026 #undef __ | 4003 #undef __ |
| 4027 | 4004 |
| 4028 } } // namespace v8::internal | 4005 } } // namespace v8::internal |
| 4029 | 4006 |
| 4030 #endif // V8_TARGET_ARCH_X64 | 4007 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |