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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 for (int i = 0; i < num_parameters; i++) { | 216 for (int i = 0; i < num_parameters; i++) { |
217 Variable* var = scope()->parameter(i); | 217 Variable* var = scope()->parameter(i); |
218 if (var->IsContextSlot()) { | 218 if (var->IsContextSlot()) { |
219 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 219 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
220 (num_parameters - 1 - i) * kPointerSize; | 220 (num_parameters - 1 - i) * kPointerSize; |
221 // Load parameter from stack. | 221 // Load parameter from stack. |
222 __ movq(rax, Operand(rbp, parameter_offset)); | 222 __ movq(rax, Operand(rbp, parameter_offset)); |
223 // Store it in the context. | 223 // Store it in the context. |
224 int context_offset = Context::SlotOffset(var->index()); | 224 int context_offset = Context::SlotOffset(var->index()); |
225 __ movq(Operand(rsi, context_offset), rax); | 225 __ movq(Operand(rsi, context_offset), rax); |
226 // Update the write barrier. This clobbers all involved | 226 // Update the write barrier. This clobbers rax and rbx. |
227 // registers, so we have use a third register to avoid | 227 __ RecordWriteContextSlot(rsi, context_offset, rax, rbx, kSaveFPRegs); |
228 // clobbering rsi. | |
229 __ movq(rcx, rsi); | |
230 __ RecordWrite(rcx, context_offset, rax, rbx); | |
231 } | 228 } |
232 } | 229 } |
233 Comment(";;; End allocate local context"); | 230 Comment(";;; End allocate local context"); |
234 } | 231 } |
235 | 232 |
236 // Trace the call. | 233 // Trace the call. |
237 if (FLAG_trace) { | 234 if (FLAG_trace) { |
238 __ CallRuntime(Runtime::kTraceEnter, 0); | 235 __ CallRuntime(Runtime::kTraceEnter, 0); |
239 } | 236 } |
240 return !is_aborted(); | 237 return !is_aborted(); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } | 663 } |
667 | 664 |
668 | 665 |
669 void LCodeGen::RecordSafepoint( | 666 void LCodeGen::RecordSafepoint( |
670 LPointerMap* pointers, | 667 LPointerMap* pointers, |
671 Safepoint::Kind kind, | 668 Safepoint::Kind kind, |
672 int arguments, | 669 int arguments, |
673 int deoptimization_index) { | 670 int deoptimization_index) { |
674 ASSERT(kind == expected_safepoint_kind_); | 671 ASSERT(kind == expected_safepoint_kind_); |
675 | 672 |
676 const ZoneList<LOperand*>* operands = pointers->operands(); | 673 const ZoneList<LOperand*>* operands = pointers->GetNormalizedOperands(); |
677 | 674 |
678 Safepoint safepoint = safepoints_.DefineSafepoint(masm(), | 675 Safepoint safepoint = safepoints_.DefineSafepoint(masm(), |
679 kind, arguments, deoptimization_index); | 676 kind, arguments, deoptimization_index); |
680 for (int i = 0; i < operands->length(); i++) { | 677 for (int i = 0; i < operands->length(); i++) { |
681 LOperand* pointer = operands->at(i); | 678 LOperand* pointer = operands->at(i); |
682 if (pointer->IsStackSlot()) { | 679 if (pointer->IsStackSlot()) { |
683 safepoint.DefinePointerSlot(pointer->index()); | 680 safepoint.DefinePointerSlot(pointer->index()); |
684 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { | 681 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { |
685 safepoint.DefinePointerRegister(ToRegister(pointer)); | 682 safepoint.DefinePointerRegister(ToRegister(pointer)); |
686 } | 683 } |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2018 | 2015 |
2019 __ Move(rcx, instr->name()); | 2016 __ Move(rcx, instr->name()); |
2020 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : | 2017 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET : |
2021 RelocInfo::CODE_TARGET_CONTEXT; | 2018 RelocInfo::CODE_TARGET_CONTEXT; |
2022 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2019 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2023 CallCode(ic, mode, instr); | 2020 CallCode(ic, mode, instr); |
2024 } | 2021 } |
2025 | 2022 |
2026 | 2023 |
2027 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2024 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
| 2025 Register object = ToRegister(instr->TempAt(0)); |
| 2026 Register address = ToRegister(instr->TempAt(1)); |
2028 Register value = ToRegister(instr->InputAt(0)); | 2027 Register value = ToRegister(instr->InputAt(0)); |
2029 Register temp = ToRegister(instr->TempAt(0)); | 2028 ASSERT(!value.is(object)); |
2030 ASSERT(!value.is(temp)); | 2029 Handle<JSGlobalPropertyCell> cell_handle(instr->hydrogen()->cell()); |
2031 bool check_hole = instr->hydrogen()->check_hole_value(); | 2030 |
2032 if (!check_hole && value.is(rax)) { | 2031 __ movq(address, cell_handle, RelocInfo::GLOBAL_PROPERTY_CELL); |
2033 __ store_rax(instr->hydrogen()->cell().location(), | 2032 |
2034 RelocInfo::GLOBAL_PROPERTY_CELL); | |
2035 return; | |
2036 } | |
2037 // If the cell we are storing to contains the hole it could have | 2033 // If the cell we are storing to contains the hole it could have |
2038 // been deleted from the property dictionary. In that case, we need | 2034 // been deleted from the property dictionary. In that case, we need |
2039 // to update the property details in the property dictionary to mark | 2035 // to update the property details in the property dictionary to mark |
2040 // it as no longer deleted. We deoptimize in that case. | 2036 // it as no longer deleted. We deoptimize in that case. |
2041 __ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL); | 2037 if (instr->hydrogen()->check_hole_value()) { |
2042 if (check_hole) { | 2038 __ CompareRoot(Operand(address, 0), Heap::kTheHoleValueRootIndex); |
2043 __ CompareRoot(Operand(temp, 0), Heap::kTheHoleValueRootIndex); | |
2044 DeoptimizeIf(equal, instr->environment()); | 2039 DeoptimizeIf(equal, instr->environment()); |
2045 } | 2040 } |
2046 __ movq(Operand(temp, 0), value); | 2041 |
| 2042 // Store the value. |
| 2043 __ movq(Operand(address, 0), value); |
| 2044 |
| 2045 Label smi_store; |
| 2046 __ JumpIfSmi(value, &smi_store, Label::kNear); |
| 2047 |
| 2048 int offset = JSGlobalPropertyCell::kValueOffset - kHeapObjectTag; |
| 2049 __ lea(object, Operand(address, -offset)); |
| 2050 // Cells are always in the remembered set. |
| 2051 __ RecordWrite(object, |
| 2052 address, |
| 2053 value, |
| 2054 kSaveFPRegs, |
| 2055 OMIT_REMEMBERED_SET, |
| 2056 OMIT_SMI_CHECK); |
| 2057 __ bind(&smi_store); |
2047 } | 2058 } |
2048 | 2059 |
2049 | 2060 |
2050 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2061 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2051 ASSERT(ToRegister(instr->global_object()).is(rdx)); | 2062 ASSERT(ToRegister(instr->global_object()).is(rdx)); |
2052 ASSERT(ToRegister(instr->value()).is(rax)); | 2063 ASSERT(ToRegister(instr->value()).is(rax)); |
2053 | 2064 |
2054 __ Move(rcx, instr->name()); | 2065 __ Move(rcx, instr->name()); |
2055 Handle<Code> ic = instr->strict_mode() | 2066 Handle<Code> ic = instr->strict_mode() |
2056 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2067 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2057 : isolate()->builtins()->StoreIC_Initialize(); | 2068 : isolate()->builtins()->StoreIC_Initialize(); |
2058 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2069 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2059 } | 2070 } |
2060 | 2071 |
2061 | 2072 |
2062 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2073 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2063 Register context = ToRegister(instr->context()); | 2074 Register context = ToRegister(instr->context()); |
2064 Register result = ToRegister(instr->result()); | 2075 Register result = ToRegister(instr->result()); |
2065 __ movq(result, ContextOperand(context, instr->slot_index())); | 2076 __ movq(result, ContextOperand(context, instr->slot_index())); |
2066 } | 2077 } |
2067 | 2078 |
2068 | 2079 |
2069 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2080 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2070 Register context = ToRegister(instr->context()); | 2081 Register context = ToRegister(instr->context()); |
2071 Register value = ToRegister(instr->value()); | 2082 Register value = ToRegister(instr->value()); |
2072 __ movq(ContextOperand(context, instr->slot_index()), value); | 2083 __ movq(ContextOperand(context, instr->slot_index()), value); |
2073 if (instr->needs_write_barrier()) { | 2084 if (instr->needs_write_barrier()) { |
2074 int offset = Context::SlotOffset(instr->slot_index()); | 2085 int offset = Context::SlotOffset(instr->slot_index()); |
2075 Register scratch = ToRegister(instr->TempAt(0)); | 2086 Register scratch = ToRegister(instr->TempAt(0)); |
2076 __ RecordWrite(context, offset, value, scratch); | 2087 __ RecordWriteContextSlot(context, offset, value, scratch, kSaveFPRegs); |
2077 } | 2088 } |
2078 } | 2089 } |
2079 | 2090 |
2080 | 2091 |
2081 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2092 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2082 Register object = ToRegister(instr->InputAt(0)); | 2093 Register object = ToRegister(instr->InputAt(0)); |
2083 Register result = ToRegister(instr->result()); | 2094 Register result = ToRegister(instr->result()); |
2084 if (instr->hydrogen()->is_in_object()) { | 2095 if (instr->hydrogen()->is_in_object()) { |
2085 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); | 2096 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); |
2086 } else { | 2097 } else { |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 if (!instr->transition().is_null()) { | 3046 if (!instr->transition().is_null()) { |
3036 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); | 3047 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); |
3037 } | 3048 } |
3038 | 3049 |
3039 // Do the store. | 3050 // Do the store. |
3040 if (instr->is_in_object()) { | 3051 if (instr->is_in_object()) { |
3041 __ movq(FieldOperand(object, offset), value); | 3052 __ movq(FieldOperand(object, offset), value); |
3042 if (instr->needs_write_barrier()) { | 3053 if (instr->needs_write_barrier()) { |
3043 Register temp = ToRegister(instr->TempAt(0)); | 3054 Register temp = ToRegister(instr->TempAt(0)); |
3044 // Update the write barrier for the object for in-object properties. | 3055 // Update the write barrier for the object for in-object properties. |
3045 __ RecordWrite(object, offset, value, temp); | 3056 __ RecordWriteField(object, offset, value, temp, kSaveFPRegs); |
3046 } | 3057 } |
3047 } else { | 3058 } else { |
3048 Register temp = ToRegister(instr->TempAt(0)); | 3059 Register temp = ToRegister(instr->TempAt(0)); |
3049 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); | 3060 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); |
3050 __ movq(FieldOperand(temp, offset), value); | 3061 __ movq(FieldOperand(temp, offset), value); |
3051 if (instr->needs_write_barrier()) { | 3062 if (instr->needs_write_barrier()) { |
3052 // Update the write barrier for the properties array. | 3063 // Update the write barrier for the properties array. |
3053 // object is used as a scratch register. | 3064 // object is used as a scratch register. |
3054 __ RecordWrite(temp, offset, value, object); | 3065 __ RecordWriteField(temp, offset, value, object, kSaveFPRegs); |
3055 } | 3066 } |
3056 } | 3067 } |
3057 } | 3068 } |
3058 | 3069 |
3059 | 3070 |
3060 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3071 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3061 ASSERT(ToRegister(instr->object()).is(rdx)); | 3072 ASSERT(ToRegister(instr->object()).is(rdx)); |
3062 ASSERT(ToRegister(instr->value()).is(rax)); | 3073 ASSERT(ToRegister(instr->value()).is(rax)); |
3063 | 3074 |
3064 __ Move(rcx, instr->hydrogen()->name()); | 3075 __ Move(rcx, instr->hydrogen()->name()); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 FixedArray::kHeaderSize), | 3159 FixedArray::kHeaderSize), |
3149 value); | 3160 value); |
3150 } | 3161 } |
3151 | 3162 |
3152 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3163 if (instr->hydrogen()->NeedsWriteBarrier()) { |
3153 // Compute address of modified element and store it into key register. | 3164 // Compute address of modified element and store it into key register. |
3154 __ lea(key, FieldOperand(elements, | 3165 __ lea(key, FieldOperand(elements, |
3155 key, | 3166 key, |
3156 times_pointer_size, | 3167 times_pointer_size, |
3157 FixedArray::kHeaderSize)); | 3168 FixedArray::kHeaderSize)); |
3158 __ RecordWrite(elements, key, value); | 3169 __ RecordWrite(elements, key, value, kSaveFPRegs); |
3159 } | 3170 } |
3160 } | 3171 } |
3161 | 3172 |
3162 | 3173 |
3163 void LCodeGen::DoStoreKeyedFastDoubleElement( | 3174 void LCodeGen::DoStoreKeyedFastDoubleElement( |
3164 LStoreKeyedFastDoubleElement* instr) { | 3175 LStoreKeyedFastDoubleElement* instr) { |
3165 XMMRegister value = ToDoubleRegister(instr->value()); | 3176 XMMRegister value = ToDoubleRegister(instr->value()); |
3166 Label have_value; | 3177 Label have_value; |
3167 | 3178 |
3168 __ ucomisd(value, value); | 3179 __ ucomisd(value, value); |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4157 RegisterEnvironmentForDeoptimization(environment); | 4168 RegisterEnvironmentForDeoptimization(environment); |
4158 ASSERT(osr_pc_offset_ == -1); | 4169 ASSERT(osr_pc_offset_ == -1); |
4159 osr_pc_offset_ = masm()->pc_offset(); | 4170 osr_pc_offset_ = masm()->pc_offset(); |
4160 } | 4171 } |
4161 | 4172 |
4162 #undef __ | 4173 #undef __ |
4163 | 4174 |
4164 } } // namespace v8::internal | 4175 } } // namespace v8::internal |
4165 | 4176 |
4166 #endif // V8_TARGET_ARCH_X64 | 4177 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |