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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Copy any necessary parameters into the context. | 207 // Copy any necessary parameters into the context. |
208 int num_parameters = scope()->num_parameters(); | 208 int num_parameters = scope()->num_parameters(); |
209 for (int i = 0; i < num_parameters; i++) { | 209 for (int i = 0; i < num_parameters; i++) { |
210 Variable* var = scope()->parameter(i); | 210 Variable* var = scope()->parameter(i); |
211 if (var->IsContextSlot()) { | 211 if (var->IsContextSlot()) { |
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 __ ldr(r0, MemOperand(fp, parameter_offset)); | 215 __ ldr(r0, MemOperand(fp, parameter_offset)); |
216 // Store it in the context. | 216 // Store it in the context. |
217 __ mov(r1, Operand(Context::SlotOffset(var->index()))); | 217 MemOperand target = ContextOperand(cp, var->index()); |
218 __ str(r0, MemOperand(cp, r1)); | 218 __ str(r0, target); |
219 // Update the write barrier. This clobbers all involved | 219 // Update the write barrier. This clobbers r3 and r0. |
220 // registers, so we have to use two more registers to avoid | 220 __ RecordWriteContextSlot( |
221 // clobbering cp. | 221 cp, target.offset(), r0, r3, kLRHasBeenSaved, kSaveFPRegs); |
222 __ mov(r2, Operand(cp)); | |
223 __ RecordWrite(r2, Operand(r1), r3, r0); | |
224 } | 222 } |
225 } | 223 } |
226 Comment(";;; End allocate local context"); | 224 Comment(";;; End allocate local context"); |
227 } | 225 } |
228 | 226 |
229 // Trace the call. | 227 // Trace the call. |
230 if (FLAG_trace) { | 228 if (FLAG_trace) { |
231 __ CallRuntime(Runtime::kTraceEnter, 0); | 229 __ CallRuntime(Runtime::kTraceEnter, 0); |
232 } | 230 } |
233 return !is_aborted(); | 231 return !is_aborted(); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 738 } |
741 | 739 |
742 | 740 |
743 void LCodeGen::RecordSafepoint( | 741 void LCodeGen::RecordSafepoint( |
744 LPointerMap* pointers, | 742 LPointerMap* pointers, |
745 Safepoint::Kind kind, | 743 Safepoint::Kind kind, |
746 int arguments, | 744 int arguments, |
747 int deoptimization_index) { | 745 int deoptimization_index) { |
748 ASSERT(expected_safepoint_kind_ == kind); | 746 ASSERT(expected_safepoint_kind_ == kind); |
749 | 747 |
750 const ZoneList<LOperand*>* operands = pointers->operands(); | 748 const ZoneList<LOperand*>* operands = pointers->GetNormalizedOperands(); |
751 Safepoint safepoint = safepoints_.DefineSafepoint(masm(), | 749 Safepoint safepoint = safepoints_.DefineSafepoint(masm(), |
752 kind, arguments, deoptimization_index); | 750 kind, arguments, deoptimization_index); |
753 for (int i = 0; i < operands->length(); i++) { | 751 for (int i = 0; i < operands->length(); i++) { |
754 LOperand* pointer = operands->at(i); | 752 LOperand* pointer = operands->at(i); |
755 if (pointer->IsStackSlot()) { | 753 if (pointer->IsStackSlot()) { |
756 safepoint.DefinePointerSlot(pointer->index()); | 754 safepoint.DefinePointerSlot(pointer->index()); |
757 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { | 755 } else if (pointer->IsRegister() && (kind & Safepoint::kWithRegisters)) { |
758 safepoint.DefinePointerRegister(ToRegister(pointer)); | 756 safepoint.DefinePointerRegister(ToRegister(pointer)); |
759 } | 757 } |
760 } | 758 } |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET | 2212 RelocInfo::Mode mode = instr->for_typeof() ? RelocInfo::CODE_TARGET |
2215 : RelocInfo::CODE_TARGET_CONTEXT; | 2213 : RelocInfo::CODE_TARGET_CONTEXT; |
2216 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2214 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2217 CallCode(ic, mode, instr); | 2215 CallCode(ic, mode, instr); |
2218 } | 2216 } |
2219 | 2217 |
2220 | 2218 |
2221 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | 2219 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { |
2222 Register value = ToRegister(instr->InputAt(0)); | 2220 Register value = ToRegister(instr->InputAt(0)); |
2223 Register scratch = scratch0(); | 2221 Register scratch = scratch0(); |
| 2222 Register scratch2 = ToRegister(instr->TempAt(0)); |
2224 | 2223 |
2225 // Load the cell. | 2224 // Load the cell. |
2226 __ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell()))); | 2225 __ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell()))); |
2227 | 2226 |
2228 // 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 |
2229 // been deleted from the property dictionary. In that case, we need | 2228 // been deleted from the property dictionary. In that case, we need |
2230 // to update the property details in the property dictionary to mark | 2229 // to update the property details in the property dictionary to mark |
2231 // it as no longer deleted. | 2230 // it as no longer deleted. |
2232 if (instr->hydrogen()->check_hole_value()) { | 2231 if (instr->hydrogen()->check_hole_value()) { |
2233 Register scratch2 = ToRegister(instr->TempAt(0)); | |
2234 __ ldr(scratch2, | 2232 __ ldr(scratch2, |
2235 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 2233 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
2236 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2234 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
2237 __ cmp(scratch2, ip); | 2235 __ cmp(scratch2, ip); |
2238 DeoptimizeIf(eq, instr->environment()); | 2236 DeoptimizeIf(eq, instr->environment()); |
2239 } | 2237 } |
2240 | 2238 |
2241 // Store the value. | 2239 // Store the value. |
2242 __ str(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 2240 __ str(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
| 2241 |
| 2242 // Cells are always in the remembered set. |
| 2243 __ RecordWriteField(scratch, |
| 2244 JSGlobalPropertyCell::kValueOffset, |
| 2245 value, |
| 2246 scratch2, |
| 2247 kLRHasBeenSaved, |
| 2248 kSaveFPRegs, |
| 2249 OMIT_REMEMBERED_SET); |
2243 } | 2250 } |
2244 | 2251 |
2245 | 2252 |
2246 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2253 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2247 ASSERT(ToRegister(instr->global_object()).is(r1)); | 2254 ASSERT(ToRegister(instr->global_object()).is(r1)); |
2248 ASSERT(ToRegister(instr->value()).is(r0)); | 2255 ASSERT(ToRegister(instr->value()).is(r0)); |
2249 | 2256 |
2250 __ mov(r2, Operand(instr->name())); | 2257 __ mov(r2, Operand(instr->name())); |
2251 Handle<Code> ic = instr->strict_mode() | 2258 Handle<Code> ic = instr->strict_mode() |
2252 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2259 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2253 : isolate()->builtins()->StoreIC_Initialize(); | 2260 : isolate()->builtins()->StoreIC_Initialize(); |
2254 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2261 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2255 } | 2262 } |
2256 | 2263 |
2257 | 2264 |
2258 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2265 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2259 Register context = ToRegister(instr->context()); | 2266 Register context = ToRegister(instr->context()); |
2260 Register result = ToRegister(instr->result()); | 2267 Register result = ToRegister(instr->result()); |
2261 __ ldr(result, ContextOperand(context, instr->slot_index())); | 2268 __ ldr(result, ContextOperand(context, instr->slot_index())); |
2262 } | 2269 } |
2263 | 2270 |
2264 | 2271 |
2265 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2272 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2266 Register context = ToRegister(instr->context()); | 2273 Register context = ToRegister(instr->context()); |
2267 Register value = ToRegister(instr->value()); | 2274 Register value = ToRegister(instr->value()); |
2268 __ str(value, ContextOperand(context, instr->slot_index())); | 2275 MemOperand target = ContextOperand(context, instr->slot_index()); |
| 2276 __ str(value, target); |
2269 if (instr->needs_write_barrier()) { | 2277 if (instr->needs_write_barrier()) { |
2270 int offset = Context::SlotOffset(instr->slot_index()); | 2278 __ RecordWriteContextSlot(context, |
2271 __ RecordWrite(context, Operand(offset), value, scratch0()); | 2279 target.offset(), |
| 2280 value, |
| 2281 scratch0(), |
| 2282 kLRHasBeenSaved, |
| 2283 kSaveFPRegs); |
2272 } | 2284 } |
2273 } | 2285 } |
2274 | 2286 |
2275 | 2287 |
2276 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2288 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2277 Register object = ToRegister(instr->InputAt(0)); | 2289 Register object = ToRegister(instr->InputAt(0)); |
2278 Register result = ToRegister(instr->result()); | 2290 Register result = ToRegister(instr->result()); |
2279 if (instr->hydrogen()->is_in_object()) { | 2291 if (instr->hydrogen()->is_in_object()) { |
2280 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); | 2292 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); |
2281 } else { | 2293 } else { |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 if (!instr->transition().is_null()) { | 3285 if (!instr->transition().is_null()) { |
3274 __ mov(scratch, Operand(instr->transition())); | 3286 __ mov(scratch, Operand(instr->transition())); |
3275 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 3287 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
3276 } | 3288 } |
3277 | 3289 |
3278 // Do the store. | 3290 // Do the store. |
3279 if (instr->is_in_object()) { | 3291 if (instr->is_in_object()) { |
3280 __ str(value, FieldMemOperand(object, offset)); | 3292 __ str(value, FieldMemOperand(object, offset)); |
3281 if (instr->needs_write_barrier()) { | 3293 if (instr->needs_write_barrier()) { |
3282 // Update the write barrier for the object for in-object properties. | 3294 // Update the write barrier for the object for in-object properties. |
3283 __ RecordWrite(object, Operand(offset), value, scratch); | 3295 __ RecordWriteField( |
| 3296 object, offset, value, scratch, kLRHasBeenSaved, kSaveFPRegs); |
3284 } | 3297 } |
3285 } else { | 3298 } else { |
3286 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 3299 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
3287 __ str(value, FieldMemOperand(scratch, offset)); | 3300 __ str(value, FieldMemOperand(scratch, offset)); |
3288 if (instr->needs_write_barrier()) { | 3301 if (instr->needs_write_barrier()) { |
3289 // Update the write barrier for the properties array. | 3302 // Update the write barrier for the properties array. |
3290 // object is used as a scratch register. | 3303 // object is used as a scratch register. |
3291 __ RecordWrite(scratch, Operand(offset), value, object); | 3304 __ RecordWriteField( |
| 3305 scratch, offset, value, object, kLRHasBeenSaved, kSaveFPRegs); |
3292 } | 3306 } |
3293 } | 3307 } |
3294 } | 3308 } |
3295 | 3309 |
3296 | 3310 |
3297 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3311 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3298 ASSERT(ToRegister(instr->object()).is(r1)); | 3312 ASSERT(ToRegister(instr->object()).is(r1)); |
3299 ASSERT(ToRegister(instr->value()).is(r0)); | 3313 ASSERT(ToRegister(instr->value()).is(r0)); |
3300 | 3314 |
3301 // Name is always in r2. | 3315 // Name is always in r2. |
(...skipping 25 matching lines...) Expand all Loading... |
3327 ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize; | 3341 ToInteger32(const_operand) * kPointerSize + FixedArray::kHeaderSize; |
3328 __ str(value, FieldMemOperand(elements, offset)); | 3342 __ str(value, FieldMemOperand(elements, offset)); |
3329 } else { | 3343 } else { |
3330 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); | 3344 __ add(scratch, elements, Operand(key, LSL, kPointerSizeLog2)); |
3331 __ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | 3345 __ str(value, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
3332 } | 3346 } |
3333 | 3347 |
3334 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3348 if (instr->hydrogen()->NeedsWriteBarrier()) { |
3335 // Compute address of modified element and store it into key register. | 3349 // Compute address of modified element and store it into key register. |
3336 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); | 3350 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); |
3337 __ RecordWrite(elements, key, value); | 3351 __ RecordWrite(elements, key, value, kLRHasBeenSaved, kSaveFPRegs); |
3338 } | 3352 } |
3339 } | 3353 } |
3340 | 3354 |
3341 | 3355 |
3342 void LCodeGen::DoStoreKeyedFastDoubleElement( | 3356 void LCodeGen::DoStoreKeyedFastDoubleElement( |
3343 LStoreKeyedFastDoubleElement* instr) { | 3357 LStoreKeyedFastDoubleElement* instr) { |
3344 DwVfpRegister value = ToDoubleRegister(instr->value()); | 3358 DwVfpRegister value = ToDoubleRegister(instr->value()); |
3345 Register elements = ToRegister(instr->elements()); | 3359 Register elements = ToRegister(instr->elements()); |
3346 Register key = no_reg; | 3360 Register key = no_reg; |
3347 Register scratch = scratch0(); | 3361 Register scratch = scratch0(); |
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4528 ASSERT(osr_pc_offset_ == -1); | 4542 ASSERT(osr_pc_offset_ == -1); |
4529 osr_pc_offset_ = masm()->pc_offset(); | 4543 osr_pc_offset_ = masm()->pc_offset(); |
4530 } | 4544 } |
4531 | 4545 |
4532 | 4546 |
4533 | 4547 |
4534 | 4548 |
4535 #undef __ | 4549 #undef __ |
4536 | 4550 |
4537 } } // namespace v8::internal | 4551 } } // namespace v8::internal |
OLD | NEW |