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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (strlen(FLAG_stop_at) > 0 && | 144 if (strlen(FLAG_stop_at) > 0 && |
145 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 145 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
146 __ int3(); | 146 __ int3(); |
147 } | 147 } |
148 #endif | 148 #endif |
149 | 149 |
150 // Strict mode functions need to replace the receiver with undefined | 150 // Strict mode functions need to replace the receiver with undefined |
151 // when called as functions (without an explicit receiver | 151 // when called as functions (without an explicit receiver |
152 // object). rcx is zero for method calls and non-zero for function | 152 // object). rcx is zero for method calls and non-zero for function |
153 // calls. | 153 // calls. |
154 if (info_->is_strict_mode() || info_->is_native()) { | 154 if (!info_->is_classic_mode() || info_->is_native()) { |
155 Label ok; | 155 Label ok; |
156 __ testq(rcx, rcx); | 156 __ testq(rcx, rcx); |
157 __ j(zero, &ok, Label::kNear); | 157 __ j(zero, &ok, Label::kNear); |
158 // +1 for return address. | 158 // +1 for return address. |
159 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 159 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
160 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 160 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
161 __ movq(Operand(rsp, receiver_offset), kScratchRegister); | 161 __ movq(Operand(rsp, receiver_offset), kScratchRegister); |
162 __ bind(&ok); | 162 __ bind(&ok); |
163 } | 163 } |
164 | 164 |
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 __ bind(&smi_store); | 2089 __ bind(&smi_store); |
2090 } | 2090 } |
2091 } | 2091 } |
2092 | 2092 |
2093 | 2093 |
2094 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2094 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2095 ASSERT(ToRegister(instr->global_object()).is(rdx)); | 2095 ASSERT(ToRegister(instr->global_object()).is(rdx)); |
2096 ASSERT(ToRegister(instr->value()).is(rax)); | 2096 ASSERT(ToRegister(instr->value()).is(rax)); |
2097 | 2097 |
2098 __ Move(rcx, instr->name()); | 2098 __ Move(rcx, instr->name()); |
2099 Handle<Code> ic = instr->strict_mode() | 2099 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
2100 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2100 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2101 : isolate()->builtins()->StoreIC_Initialize(); | 2101 : isolate()->builtins()->StoreIC_Initialize(); |
2102 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2102 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2103 } | 2103 } |
2104 | 2104 |
2105 | 2105 |
2106 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2106 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2107 Register context = ToRegister(instr->context()); | 2107 Register context = ToRegister(instr->context()); |
2108 Register result = ToRegister(instr->result()); | 2108 Register result = ToRegister(instr->result()); |
2109 __ movq(result, ContextOperand(context, instr->slot_index())); | 2109 __ movq(result, ContextOperand(context, instr->slot_index())); |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3123 } | 3123 } |
3124 } | 3124 } |
3125 } | 3125 } |
3126 | 3126 |
3127 | 3127 |
3128 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3128 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3129 ASSERT(ToRegister(instr->object()).is(rdx)); | 3129 ASSERT(ToRegister(instr->object()).is(rdx)); |
3130 ASSERT(ToRegister(instr->value()).is(rax)); | 3130 ASSERT(ToRegister(instr->value()).is(rax)); |
3131 | 3131 |
3132 __ Move(rcx, instr->hydrogen()->name()); | 3132 __ Move(rcx, instr->hydrogen()->name()); |
3133 Handle<Code> ic = instr->strict_mode() | 3133 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3134 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3134 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3135 : isolate()->builtins()->StoreIC_Initialize(); | 3135 : isolate()->builtins()->StoreIC_Initialize(); |
3136 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3136 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3137 } | 3137 } |
3138 | 3138 |
3139 | 3139 |
3140 void LCodeGen::DoStoreKeyedSpecializedArrayElement( | 3140 void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
3141 LStoreKeyedSpecializedArrayElement* instr) { | 3141 LStoreKeyedSpecializedArrayElement* instr) { |
3142 ElementsKind elements_kind = instr->elements_kind(); | 3142 ElementsKind elements_kind = instr->elements_kind(); |
3143 Operand operand(BuildFastArrayOperand(instr->external_pointer(), | 3143 Operand operand(BuildFastArrayOperand(instr->external_pointer(), |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS, | 3261 instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS, |
3262 FixedDoubleArray::kHeaderSize - kHeapObjectTag); | 3262 FixedDoubleArray::kHeaderSize - kHeapObjectTag); |
3263 __ movsd(double_store_operand, value); | 3263 __ movsd(double_store_operand, value); |
3264 } | 3264 } |
3265 | 3265 |
3266 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3266 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
3267 ASSERT(ToRegister(instr->object()).is(rdx)); | 3267 ASSERT(ToRegister(instr->object()).is(rdx)); |
3268 ASSERT(ToRegister(instr->key()).is(rcx)); | 3268 ASSERT(ToRegister(instr->key()).is(rcx)); |
3269 ASSERT(ToRegister(instr->value()).is(rax)); | 3269 ASSERT(ToRegister(instr->value()).is(rax)); |
3270 | 3270 |
3271 Handle<Code> ic = instr->strict_mode() | 3271 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3272 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3272 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
3273 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3273 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
3274 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3274 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3275 } | 3275 } |
3276 | 3276 |
3277 | 3277 |
3278 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 3278 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
3279 Register object_reg = ToRegister(instr->object()); | 3279 Register object_reg = ToRegister(instr->object()); |
3280 Register new_map_reg = ToRegister(instr->new_map_reg()); | 3280 Register new_map_reg = ToRegister(instr->new_map_reg()); |
3281 | 3281 |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4030 } | 4030 } |
4031 } | 4031 } |
4032 | 4032 |
4033 | 4033 |
4034 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 4034 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
4035 // Use the fast case closure allocation code that allocates in new | 4035 // Use the fast case closure allocation code that allocates in new |
4036 // space for nested functions that don't need literals cloning. | 4036 // space for nested functions that don't need literals cloning. |
4037 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 4037 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
4038 bool pretenure = instr->hydrogen()->pretenure(); | 4038 bool pretenure = instr->hydrogen()->pretenure(); |
4039 if (!pretenure && shared_info->num_literals() == 0) { | 4039 if (!pretenure && shared_info->num_literals() == 0) { |
4040 FastNewClosureStub stub(shared_info->strict_mode_flag()); | 4040 FastNewClosureStub stub(shared_info->language_mode()); |
4041 __ Push(shared_info); | 4041 __ Push(shared_info); |
4042 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4042 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4043 } else { | 4043 } else { |
4044 __ push(rsi); | 4044 __ push(rsi); |
4045 __ Push(shared_info); | 4045 __ Push(shared_info); |
4046 __ PushRoot(pretenure ? | 4046 __ PushRoot(pretenure ? |
4047 Heap::kTrueValueRootIndex : | 4047 Heap::kTrueValueRootIndex : |
4048 Heap::kFalseValueRootIndex); | 4048 Heap::kFalseValueRootIndex); |
4049 CallRuntime(Runtime::kNewClosure, 3, instr); | 4049 CallRuntime(Runtime::kNewClosure, 3, instr); |
4050 } | 4050 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4296 RegisterEnvironmentForDeoptimization(environment); | 4296 RegisterEnvironmentForDeoptimization(environment); |
4297 ASSERT(osr_pc_offset_ == -1); | 4297 ASSERT(osr_pc_offset_ == -1); |
4298 osr_pc_offset_ = masm()->pc_offset(); | 4298 osr_pc_offset_ = masm()->pc_offset(); |
4299 } | 4299 } |
4300 | 4300 |
4301 #undef __ | 4301 #undef __ |
4302 | 4302 |
4303 } } // namespace v8::internal | 4303 } } // namespace v8::internal |
4304 | 4304 |
4305 #endif // V8_TARGET_ARCH_X64 | 4305 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |