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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2299 } | 2299 } |
| 2300 | 2300 |
| 2301 | 2301 |
| 2302 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2302 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2303 Register context = ToRegister(instr->context()); | 2303 Register context = ToRegister(instr->context()); |
| 2304 Register result = ToRegister(instr->result()); | 2304 Register result = ToRegister(instr->result()); |
| 2305 __ ldr(result, ContextOperand(context, instr->slot_index())); | 2305 __ ldr(result, ContextOperand(context, instr->slot_index())); |
| 2306 if (instr->hydrogen()->RequiresHoleCheck()) { | 2306 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2307 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2307 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2308 __ cmp(result, ip); | 2308 __ cmp(result, ip); |
| 2309 DeoptimizeIf(eq, instr->environment()); | 2309 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2310 DeoptimizeIf(eq, instr->environment()); | |
| 2311 } else { | |
|
Steven
2011/12/12 13:12:44
You can do better here and use a conditional move
| |
| 2312 Label is_not_hole; | |
| 2313 __ b(ne, &is_not_hole); | |
| 2314 | |
| 2315 __ mov(result, Operand(factory()->undefined_value())); | |
| 2316 | |
| 2317 __ bind(&is_not_hole); | |
| 2318 } | |
| 2310 } | 2319 } |
| 2311 } | 2320 } |
| 2312 | 2321 |
| 2313 | 2322 |
| 2314 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2323 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
| 2315 Register context = ToRegister(instr->context()); | 2324 Register context = ToRegister(instr->context()); |
| 2316 Register value = ToRegister(instr->value()); | 2325 Register value = ToRegister(instr->value()); |
| 2326 Register scratch = scratch0(); | |
| 2317 MemOperand target = ContextOperand(context, instr->slot_index()); | 2327 MemOperand target = ContextOperand(context, instr->slot_index()); |
| 2328 | |
| 2329 Label skip_assignment; | |
| 2330 | |
| 2318 if (instr->hydrogen()->RequiresHoleCheck()) { | 2331 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2319 Register scratch = scratch0(); | |
| 2320 __ ldr(scratch, target); | 2332 __ ldr(scratch, target); |
| 2321 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2333 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 2322 __ cmp(scratch, ip); | 2334 __ cmp(scratch, ip); |
| 2323 DeoptimizeIf(eq, instr->environment()); | 2335 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2336 DeoptimizeIf(eq, instr->environment()); | |
| 2337 } else { | |
| 2338 __ b(ne, &skip_assignment); | |
| 2339 } | |
| 2324 } | 2340 } |
| 2341 | |
| 2325 __ str(value, target); | 2342 __ str(value, target); |
| 2326 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2343 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 2327 HType type = instr->hydrogen()->value()->type(); | 2344 HType type = instr->hydrogen()->value()->type(); |
| 2328 SmiCheck check_needed = | 2345 SmiCheck check_needed = |
| 2329 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2346 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 2330 __ RecordWriteContextSlot(context, | 2347 __ RecordWriteContextSlot(context, |
| 2331 target.offset(), | 2348 target.offset(), |
| 2332 value, | 2349 value, |
| 2333 scratch0(), | 2350 scratch, |
| 2334 kLRHasBeenSaved, | 2351 kLRHasBeenSaved, |
| 2335 kSaveFPRegs, | 2352 kSaveFPRegs, |
| 2336 EMIT_REMEMBERED_SET, | 2353 EMIT_REMEMBERED_SET, |
| 2337 check_needed); | 2354 check_needed); |
| 2338 } | 2355 } |
| 2356 | |
| 2357 __ bind(&skip_assignment); | |
| 2339 } | 2358 } |
| 2340 | 2359 |
| 2341 | 2360 |
| 2342 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2361 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2343 Register object = ToRegister(instr->InputAt(0)); | 2362 Register object = ToRegister(instr->InputAt(0)); |
| 2344 Register result = ToRegister(instr->result()); | 2363 Register result = ToRegister(instr->result()); |
| 2345 if (instr->hydrogen()->is_in_object()) { | 2364 if (instr->hydrogen()->is_in_object()) { |
| 2346 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); | 2365 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); |
| 2347 } else { | 2366 } else { |
| 2348 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2367 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| (...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4714 ASSERT(osr_pc_offset_ == -1); | 4733 ASSERT(osr_pc_offset_ == -1); |
| 4715 osr_pc_offset_ = masm()->pc_offset(); | 4734 osr_pc_offset_ = masm()->pc_offset(); |
| 4716 } | 4735 } |
| 4717 | 4736 |
| 4718 | 4737 |
| 4719 | 4738 |
| 4720 | 4739 |
| 4721 #undef __ | 4740 #undef __ |
| 4722 | 4741 |
| 4723 } } // namespace v8::internal | 4742 } } // namespace v8::internal |
| OLD | NEW |