Chromium Code Reviews| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 for (int i = 0; i < num_parameters; i++) { | 209 for (int i = 0; i < num_parameters; i++) { |
| 210 Slot* slot = scope()->parameter(i)->AsSlot(); | 210 Slot* slot = scope()->parameter(i)->AsSlot(); |
| 211 if (slot != NULL && slot->type() == Slot::CONTEXT) { | 211 if (slot != NULL && slot->type() == Slot::CONTEXT) { |
| 212 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 212 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 213 (num_parameters - 1 - i) * kPointerSize; | 213 (num_parameters - 1 - i) * kPointerSize; |
| 214 // Load parameter from stack. | 214 // Load parameter from stack. |
| 215 __ movq(rax, Operand(rbp, parameter_offset)); | 215 __ movq(rax, Operand(rbp, parameter_offset)); |
| 216 // Store it in the context. | 216 // Store it in the context. |
| 217 int context_offset = Context::SlotOffset(slot->index()); | 217 int context_offset = Context::SlotOffset(slot->index()); |
| 218 __ movq(Operand(rsi, context_offset), rax); | 218 __ movq(Operand(rsi, context_offset), rax); |
| 219 // Update the write barrier. This clobbers all involved | 219 // Update the write barrier. This clobbers rax and rbx. |
| 220 // registers, so we have use a third register to avoid | 220 __ RecordWriteContextSlot(rsi, context_offset, rax, rbx, kSaveFPRegs); |
| 221 // clobbering rsi. | |
| 222 __ movq(rcx, rsi); | |
| 223 __ RecordWrite(rcx, context_offset, rax, rbx, kSaveFPRegs); | |
| 224 } | 221 } |
| 225 } | 222 } |
| 226 Comment(";;; End allocate local context"); | 223 Comment(";;; End allocate local context"); |
| 227 } | 224 } |
| 228 | 225 |
| 229 // Trace the call. | 226 // Trace the call. |
| 230 if (FLAG_trace) { | 227 if (FLAG_trace) { |
| 231 __ CallRuntime(Runtime::kTraceEnter, 0); | 228 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 232 } | 229 } |
| 233 return !is_aborted(); | 230 return !is_aborted(); |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2230 // If the cell we are storing to contains the hole it could have | 2227 // If the cell we are storing to contains the hole it could have |
| 2231 // been deleted from the property dictionary. In that case, we need | 2228 // been deleted from the property dictionary. In that case, we need |
| 2232 // to update the property details in the property dictionary to mark | 2229 // to update the property details in the property dictionary to mark |
| 2233 // it as no longer deleted. We deoptimize in that case. | 2230 // it as no longer deleted. We deoptimize in that case. |
| 2234 __ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL); | 2231 __ movq(temp, instr->hydrogen()->cell(), RelocInfo::GLOBAL_PROPERTY_CELL); |
| 2235 if (check_hole) { | 2232 if (check_hole) { |
| 2236 __ CompareRoot(Operand(temp, 0), Heap::kTheHoleValueRootIndex); | 2233 __ CompareRoot(Operand(temp, 0), Heap::kTheHoleValueRootIndex); |
| 2237 DeoptimizeIf(equal, instr->environment()); | 2234 DeoptimizeIf(equal, instr->environment()); |
| 2238 } | 2235 } |
| 2239 __ movq(Operand(temp, 0), value); | 2236 __ movq(Operand(temp, 0), value); |
| 2240 } | 2237 } |
|
Vyacheslav Egorov (Chromium)
2011/06/07 14:01:27
Missing WriteBarrier (just for the record).
Erik Corry
2011/06/08 10:38:55
Thanks.
| |
| 2241 | 2238 |
| 2242 | 2239 |
| 2243 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2240 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
| 2244 ASSERT(ToRegister(instr->global_object()).is(rdx)); | 2241 ASSERT(ToRegister(instr->global_object()).is(rdx)); |
| 2245 ASSERT(ToRegister(instr->value()).is(rax)); | 2242 ASSERT(ToRegister(instr->value()).is(rax)); |
| 2246 | 2243 |
| 2247 __ Move(rcx, instr->name()); | 2244 __ Move(rcx, instr->name()); |
| 2248 Handle<Code> ic = instr->strict_mode() | 2245 Handle<Code> ic = instr->strict_mode() |
| 2249 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2246 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
| 2250 : isolate()->builtins()->StoreIC_Initialize(); | 2247 : isolate()->builtins()->StoreIC_Initialize(); |
| 2251 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2248 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
| 2252 } | 2249 } |
| 2253 | 2250 |
| 2254 | 2251 |
| 2255 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2252 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2256 Register context = ToRegister(instr->context()); | 2253 Register context = ToRegister(instr->context()); |
| 2257 Register result = ToRegister(instr->result()); | 2254 Register result = ToRegister(instr->result()); |
| 2258 __ movq(result, ContextOperand(context, instr->slot_index())); | 2255 __ movq(result, ContextOperand(context, instr->slot_index())); |
| 2259 } | 2256 } |
| 2260 | 2257 |
| 2261 | 2258 |
| 2262 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2259 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
| 2263 Register context = ToRegister(instr->context()); | 2260 Register context = ToRegister(instr->context()); |
| 2264 Register value = ToRegister(instr->value()); | 2261 Register value = ToRegister(instr->value()); |
| 2265 __ movq(ContextOperand(context, instr->slot_index()), value); | 2262 __ movq(ContextOperand(context, instr->slot_index()), value); |
| 2266 if (instr->needs_write_barrier()) { | 2263 if (instr->needs_write_barrier()) { |
| 2267 int offset = Context::SlotOffset(instr->slot_index()); | 2264 int offset = Context::SlotOffset(instr->slot_index()); |
| 2268 Register scratch = ToRegister(instr->TempAt(0)); | 2265 Register scratch = ToRegister(instr->TempAt(0)); |
| 2269 __ RecordWrite(context, offset, value, scratch, kSaveFPRegs); | 2266 __ RecordWriteContextSlot(context, offset, value, scratch, kSaveFPRegs); |
| 2270 } | 2267 } |
| 2271 } | 2268 } |
| 2272 | 2269 |
| 2273 | 2270 |
| 2274 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2271 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2275 Register object = ToRegister(instr->InputAt(0)); | 2272 Register object = ToRegister(instr->InputAt(0)); |
| 2276 Register result = ToRegister(instr->result()); | 2273 Register result = ToRegister(instr->result()); |
| 2277 if (instr->hydrogen()->is_in_object()) { | 2274 if (instr->hydrogen()->is_in_object()) { |
| 2278 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); | 2275 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); |
| 2279 } else { | 2276 } else { |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3158 if (!instr->transition().is_null()) { | 3155 if (!instr->transition().is_null()) { |
| 3159 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); | 3156 __ Move(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); |
| 3160 } | 3157 } |
| 3161 | 3158 |
| 3162 // Do the store. | 3159 // Do the store. |
| 3163 if (instr->is_in_object()) { | 3160 if (instr->is_in_object()) { |
| 3164 __ movq(FieldOperand(object, offset), value); | 3161 __ movq(FieldOperand(object, offset), value); |
| 3165 if (instr->needs_write_barrier()) { | 3162 if (instr->needs_write_barrier()) { |
| 3166 Register temp = ToRegister(instr->TempAt(0)); | 3163 Register temp = ToRegister(instr->TempAt(0)); |
| 3167 // Update the write barrier for the object for in-object properties. | 3164 // Update the write barrier for the object for in-object properties. |
| 3168 __ RecordWrite(object, offset, value, temp, kSaveFPRegs); | 3165 __ RecordWriteField(object, offset, value, temp, kSaveFPRegs); |
| 3169 } | 3166 } |
| 3170 } else { | 3167 } else { |
| 3171 Register temp = ToRegister(instr->TempAt(0)); | 3168 Register temp = ToRegister(instr->TempAt(0)); |
| 3172 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); | 3169 __ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 3173 __ movq(FieldOperand(temp, offset), value); | 3170 __ movq(FieldOperand(temp, offset), value); |
| 3174 if (instr->needs_write_barrier()) { | 3171 if (instr->needs_write_barrier()) { |
| 3175 // Update the write barrier for the properties array. | 3172 // Update the write barrier for the properties array. |
| 3176 // object is used as a scratch register. | 3173 // object is used as a scratch register. |
| 3177 __ RecordWrite(temp, offset, value, object, kSaveFPRegs); | 3174 __ RecordWriteField(temp, offset, value, object, kSaveFPRegs); |
| 3178 } | 3175 } |
| 3179 } | 3176 } |
| 3180 } | 3177 } |
| 3181 | 3178 |
| 3182 | 3179 |
| 3183 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3180 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 3184 ASSERT(ToRegister(instr->object()).is(rdx)); | 3181 ASSERT(ToRegister(instr->object()).is(rdx)); |
| 3185 ASSERT(ToRegister(instr->value()).is(rax)); | 3182 ASSERT(ToRegister(instr->value()).is(rax)); |
| 3186 | 3183 |
| 3187 __ Move(rcx, instr->hydrogen()->name()); | 3184 __ Move(rcx, instr->hydrogen()->name()); |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4258 RegisterEnvironmentForDeoptimization(environment); | 4255 RegisterEnvironmentForDeoptimization(environment); |
| 4259 ASSERT(osr_pc_offset_ == -1); | 4256 ASSERT(osr_pc_offset_ == -1); |
| 4260 osr_pc_offset_ = masm()->pc_offset(); | 4257 osr_pc_offset_ = masm()->pc_offset(); |
| 4261 } | 4258 } |
| 4262 | 4259 |
| 4263 #undef __ | 4260 #undef __ |
| 4264 | 4261 |
| 4265 } } // namespace v8::internal | 4262 } } // namespace v8::internal |
| 4266 | 4263 |
| 4267 #endif // V8_TARGET_ARCH_X64 | 4264 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |