OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2477 | 2477 |
2478 __ Jump(ra); | 2478 __ Jump(ra); |
2479 } | 2479 } |
2480 | 2480 |
2481 | 2481 |
2482 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2482 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2483 Register context = ToRegister(instr->context()); | 2483 Register context = ToRegister(instr->context()); |
2484 Register result = ToRegister(instr->result()); | 2484 Register result = ToRegister(instr->result()); |
2485 | 2485 |
2486 __ lw(result, ContextMemOperand(context, instr->slot_index())); | 2486 __ lw(result, ContextMemOperand(context, instr->slot_index())); |
| 2487 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2488 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 2489 |
| 2490 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2491 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, result, Operand(at)); |
| 2492 } else { |
| 2493 Label is_not_hole; |
| 2494 __ Branch(&is_not_hole, ne, result, Operand(at)); |
| 2495 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); |
| 2496 __ bind(&is_not_hole); |
| 2497 } |
| 2498 } |
2487 } | 2499 } |
2488 | 2500 |
2489 | 2501 |
2490 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2502 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2491 Register context = ToRegister(instr->context()); | 2503 Register context = ToRegister(instr->context()); |
2492 Register value = ToRegister(instr->value()); | 2504 Register value = ToRegister(instr->value()); |
| 2505 Register scratch = scratch0(); |
2493 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2506 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2494 | 2507 |
| 2508 Label skip_assignment; |
| 2509 |
| 2510 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2511 __ lw(scratch, target); |
| 2512 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 2513 |
| 2514 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2515 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole, scratch, Operand(at)); |
| 2516 } else { |
| 2517 __ Branch(&skip_assignment, ne, scratch, Operand(at)); |
| 2518 } |
| 2519 } |
| 2520 |
2495 __ sw(value, target); | 2521 __ sw(value, target); |
2496 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2522 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2497 SmiCheck check_needed = | 2523 SmiCheck check_needed = |
2498 instr->hydrogen()->value()->type().IsHeapObject() | 2524 instr->hydrogen()->value()->type().IsHeapObject() |
2499 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2525 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2500 __ RecordWriteContextSlot(context, | 2526 __ RecordWriteContextSlot(context, |
2501 target.offset(), | 2527 target.offset(), |
2502 value, | 2528 value, |
2503 scratch0(), | 2529 scratch0(), |
2504 GetRAState(), | 2530 GetRAState(), |
2505 kSaveFPRegs, | 2531 kSaveFPRegs, |
2506 EMIT_REMEMBERED_SET, | 2532 EMIT_REMEMBERED_SET, |
2507 check_needed); | 2533 check_needed); |
2508 } | 2534 } |
| 2535 |
| 2536 __ bind(&skip_assignment); |
2509 } | 2537 } |
2510 | 2538 |
2511 | 2539 |
2512 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2540 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2513 HObjectAccess access = instr->hydrogen()->access(); | 2541 HObjectAccess access = instr->hydrogen()->access(); |
2514 int offset = access.offset(); | 2542 int offset = access.offset(); |
2515 Register object = ToRegister(instr->object()); | 2543 Register object = ToRegister(instr->object()); |
2516 | 2544 |
2517 if (access.IsExternalMemory()) { | 2545 if (access.IsExternalMemory()) { |
2518 Register result = ToRegister(instr->result()); | 2546 Register result = ToRegister(instr->result()); |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 __ lw(result, FieldMemOperand(scratch, | 5418 __ lw(result, FieldMemOperand(scratch, |
5391 FixedArray::kHeaderSize - kPointerSize)); | 5419 FixedArray::kHeaderSize - kPointerSize)); |
5392 __ bind(deferred->exit()); | 5420 __ bind(deferred->exit()); |
5393 __ bind(&done); | 5421 __ bind(&done); |
5394 } | 5422 } |
5395 | 5423 |
5396 #undef __ | 5424 #undef __ |
5397 | 5425 |
5398 } // namespace internal | 5426 } // namespace internal |
5399 } // namespace v8 | 5427 } // namespace v8 |
OLD | NEW |