OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "arm/lithium-codegen-arm.h" | 30 #include "arm/lithium-codegen-arm.h" |
31 #include "arm/lithium-gap-resolver-arm.h" | 31 #include "arm/lithium-gap-resolver-arm.h" |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
34 | 34 |
35 namespace v8 { | 35 namespace v8 { |
36 namespace internal { | 36 namespace internal { |
37 | 37 |
38 | 38 |
| 39 static SaveFPRegsMode GetSaveFPRegsMode() { |
| 40 // We don't need to save floating point regs when generating the snapshot |
| 41 return CpuFeatures::IsSafeForSnapshot(VFP32DREGS) |
| 42 ? kSaveFPRegs |
| 43 : kDontSaveFPRegs; |
| 44 } |
| 45 |
| 46 |
39 class SafepointGenerator : public CallWrapper { | 47 class SafepointGenerator : public CallWrapper { |
40 public: | 48 public: |
41 SafepointGenerator(LCodeGen* codegen, | 49 SafepointGenerator(LCodeGen* codegen, |
42 LPointerMap* pointers, | 50 LPointerMap* pointers, |
43 Safepoint::DeoptMode mode) | 51 Safepoint::DeoptMode mode) |
44 : codegen_(codegen), | 52 : codegen_(codegen), |
45 pointers_(pointers), | 53 pointers_(pointers), |
46 deopt_mode_(mode) { } | 54 deopt_mode_(mode) { } |
47 virtual ~SafepointGenerator() { } | 55 virtual ~SafepointGenerator() { } |
48 | 56 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 if (var->IsContextSlot()) { | 239 if (var->IsContextSlot()) { |
232 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 240 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
233 (num_parameters - 1 - i) * kPointerSize; | 241 (num_parameters - 1 - i) * kPointerSize; |
234 // Load parameter from stack. | 242 // Load parameter from stack. |
235 __ ldr(r0, MemOperand(fp, parameter_offset)); | 243 __ ldr(r0, MemOperand(fp, parameter_offset)); |
236 // Store it in the context. | 244 // Store it in the context. |
237 MemOperand target = ContextOperand(cp, var->index()); | 245 MemOperand target = ContextOperand(cp, var->index()); |
238 __ str(r0, target); | 246 __ str(r0, target); |
239 // Update the write barrier. This clobbers r3 and r0. | 247 // Update the write barrier. This clobbers r3 and r0. |
240 __ RecordWriteContextSlot( | 248 __ RecordWriteContextSlot( |
241 cp, target.offset(), r0, r3, GetLinkRegisterState(), kSaveFPRegs); | 249 cp, |
| 250 target.offset(), |
| 251 r0, |
| 252 r3, |
| 253 GetLinkRegisterState(), |
| 254 GetSaveFPRegsMode()); |
242 } | 255 } |
243 } | 256 } |
244 Comment(";;; End allocate local context"); | 257 Comment(";;; End allocate local context"); |
245 } | 258 } |
246 | 259 |
247 // Trace the call. | 260 // Trace the call. |
248 if (FLAG_trace && info()->IsOptimizing()) { | 261 if (FLAG_trace && info()->IsOptimizing()) { |
249 __ CallRuntime(Runtime::kTraceEnter, 0); | 262 __ CallRuntime(Runtime::kTraceEnter, 0); |
250 } | 263 } |
251 return !is_aborted(); | 264 return !is_aborted(); |
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 __ str(value, target); | 3075 __ str(value, target); |
3063 if (instr->hydrogen()->NeedsWriteBarrier()) { | 3076 if (instr->hydrogen()->NeedsWriteBarrier()) { |
3064 HType type = instr->hydrogen()->value()->type(); | 3077 HType type = instr->hydrogen()->value()->type(); |
3065 SmiCheck check_needed = | 3078 SmiCheck check_needed = |
3066 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 3079 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
3067 __ RecordWriteContextSlot(context, | 3080 __ RecordWriteContextSlot(context, |
3068 target.offset(), | 3081 target.offset(), |
3069 value, | 3082 value, |
3070 scratch, | 3083 scratch, |
3071 GetLinkRegisterState(), | 3084 GetLinkRegisterState(), |
3072 kSaveFPRegs, | 3085 GetSaveFPRegsMode(), |
3073 EMIT_REMEMBERED_SET, | 3086 EMIT_REMEMBERED_SET, |
3074 check_needed); | 3087 check_needed); |
3075 } | 3088 } |
3076 | 3089 |
3077 __ bind(&skip_assignment); | 3090 __ bind(&skip_assignment); |
3078 } | 3091 } |
3079 | 3092 |
3080 | 3093 |
3081 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3094 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3082 Register object = ToRegister(instr->object()); | 3095 Register object = ToRegister(instr->object()); |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4251 __ mov(scratch, Operand(instr->transition())); | 4264 __ mov(scratch, Operand(instr->transition())); |
4252 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 4265 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
4253 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { | 4266 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { |
4254 Register temp = ToRegister(instr->temp()); | 4267 Register temp = ToRegister(instr->temp()); |
4255 // Update the write barrier for the map field. | 4268 // Update the write barrier for the map field. |
4256 __ RecordWriteField(object, | 4269 __ RecordWriteField(object, |
4257 HeapObject::kMapOffset, | 4270 HeapObject::kMapOffset, |
4258 scratch, | 4271 scratch, |
4259 temp, | 4272 temp, |
4260 GetLinkRegisterState(), | 4273 GetLinkRegisterState(), |
4261 kSaveFPRegs, | 4274 GetSaveFPRegsMode(), |
4262 OMIT_REMEMBERED_SET, | 4275 OMIT_REMEMBERED_SET, |
4263 OMIT_SMI_CHECK); | 4276 OMIT_SMI_CHECK); |
4264 } | 4277 } |
4265 } | 4278 } |
4266 | 4279 |
4267 // Do the store. | 4280 // Do the store. |
4268 HType type = instr->hydrogen()->value()->type(); | 4281 HType type = instr->hydrogen()->value()->type(); |
4269 SmiCheck check_needed = | 4282 SmiCheck check_needed = |
4270 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4283 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4271 if (instr->is_in_object()) { | 4284 if (instr->is_in_object()) { |
4272 __ str(value, FieldMemOperand(object, offset)); | 4285 __ str(value, FieldMemOperand(object, offset)); |
4273 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4286 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4274 // Update the write barrier for the object for in-object properties. | 4287 // Update the write barrier for the object for in-object properties. |
4275 __ RecordWriteField(object, | 4288 __ RecordWriteField(object, |
4276 offset, | 4289 offset, |
4277 value, | 4290 value, |
4278 scratch, | 4291 scratch, |
4279 GetLinkRegisterState(), | 4292 GetLinkRegisterState(), |
4280 kSaveFPRegs, | 4293 GetSaveFPRegsMode(), |
4281 EMIT_REMEMBERED_SET, | 4294 EMIT_REMEMBERED_SET, |
4282 check_needed); | 4295 check_needed); |
4283 } | 4296 } |
4284 } else { | 4297 } else { |
4285 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 4298 __ ldr(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
4286 __ str(value, FieldMemOperand(scratch, offset)); | 4299 __ str(value, FieldMemOperand(scratch, offset)); |
4287 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4300 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4288 // Update the write barrier for the properties array. | 4301 // Update the write barrier for the properties array. |
4289 // object is used as a scratch register. | 4302 // object is used as a scratch register. |
4290 __ RecordWriteField(scratch, | 4303 __ RecordWriteField(scratch, |
4291 offset, | 4304 offset, |
4292 value, | 4305 value, |
4293 object, | 4306 object, |
4294 GetLinkRegisterState(), | 4307 GetLinkRegisterState(), |
4295 kSaveFPRegs, | 4308 GetSaveFPRegsMode(), |
4296 EMIT_REMEMBERED_SET, | 4309 EMIT_REMEMBERED_SET, |
4297 check_needed); | 4310 check_needed); |
4298 } | 4311 } |
4299 } | 4312 } |
4300 } | 4313 } |
4301 | 4314 |
4302 | 4315 |
4303 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4316 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4304 ASSERT(ToRegister(instr->object()).is(r1)); | 4317 ASSERT(ToRegister(instr->object()).is(r1)); |
4305 ASSERT(ToRegister(instr->value()).is(r0)); | 4318 ASSERT(ToRegister(instr->value()).is(r0)); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4479 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4492 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4480 HType type = instr->hydrogen()->value()->type(); | 4493 HType type = instr->hydrogen()->value()->type(); |
4481 SmiCheck check_needed = | 4494 SmiCheck check_needed = |
4482 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4495 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4483 // Compute address of modified element and store it into key register. | 4496 // Compute address of modified element and store it into key register. |
4484 __ add(key, store_base, Operand(offset - kHeapObjectTag)); | 4497 __ add(key, store_base, Operand(offset - kHeapObjectTag)); |
4485 __ RecordWrite(elements, | 4498 __ RecordWrite(elements, |
4486 key, | 4499 key, |
4487 value, | 4500 value, |
4488 GetLinkRegisterState(), | 4501 GetLinkRegisterState(), |
4489 kSaveFPRegs, | 4502 GetSaveFPRegsMode(), |
4490 EMIT_REMEMBERED_SET, | 4503 EMIT_REMEMBERED_SET, |
4491 check_needed); | 4504 check_needed); |
4492 } | 4505 } |
4493 } | 4506 } |
4494 | 4507 |
4495 | 4508 |
4496 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4509 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
4497 // By cases: external, fast double | 4510 // By cases: external, fast double |
4498 if (instr->is_external()) { | 4511 if (instr->is_external()) { |
4499 DoStoreKeyedExternalArray(instr); | 4512 DoStoreKeyedExternalArray(instr); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5997 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6010 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5998 __ ldr(result, FieldMemOperand(scratch, | 6011 __ ldr(result, FieldMemOperand(scratch, |
5999 FixedArray::kHeaderSize - kPointerSize)); | 6012 FixedArray::kHeaderSize - kPointerSize)); |
6000 __ bind(&done); | 6013 __ bind(&done); |
6001 } | 6014 } |
6002 | 6015 |
6003 | 6016 |
6004 #undef __ | 6017 #undef __ |
6005 | 6018 |
6006 } } // namespace v8::internal | 6019 } } // namespace v8::internal |
OLD | NEW |