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 } | |
2499 } | 2487 } |
2500 | 2488 |
2501 | 2489 |
2502 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2490 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2503 Register context = ToRegister(instr->context()); | 2491 Register context = ToRegister(instr->context()); |
2504 Register value = ToRegister(instr->value()); | 2492 Register value = ToRegister(instr->value()); |
2505 Register scratch = scratch0(); | 2493 Register scratch = scratch0(); |
2506 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2494 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2507 | 2495 |
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 | |
2521 __ sw(value, target); | 2496 __ sw(value, target); |
2522 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2497 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2523 SmiCheck check_needed = | 2498 SmiCheck check_needed = |
2524 instr->hydrogen()->value()->type().IsHeapObject() | 2499 instr->hydrogen()->value()->type().IsHeapObject() |
2525 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2500 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2526 __ RecordWriteContextSlot(context, | 2501 __ RecordWriteContextSlot(context, |
2527 target.offset(), | 2502 target.offset(), |
2528 value, | 2503 value, |
2529 scratch0(), | 2504 scratch0(), |
2530 GetRAState(), | 2505 GetRAState(), |
2531 kSaveFPRegs, | 2506 kSaveFPRegs, |
2532 EMIT_REMEMBERED_SET, | 2507 EMIT_REMEMBERED_SET, |
2533 check_needed); | 2508 check_needed); |
2534 } | 2509 } |
2535 | |
2536 __ bind(&skip_assignment); | |
2537 } | 2510 } |
2538 | 2511 |
2539 | 2512 |
2540 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2513 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2541 HObjectAccess access = instr->hydrogen()->access(); | 2514 HObjectAccess access = instr->hydrogen()->access(); |
2542 int offset = access.offset(); | 2515 int offset = access.offset(); |
2543 Register object = ToRegister(instr->object()); | 2516 Register object = ToRegister(instr->object()); |
2544 | 2517 |
2545 if (access.IsExternalMemory()) { | 2518 if (access.IsExternalMemory()) { |
2546 Register result = ToRegister(instr->result()); | 2519 Register result = ToRegister(instr->result()); |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5418 __ lw(result, FieldMemOperand(scratch, | 5391 __ lw(result, FieldMemOperand(scratch, |
5419 FixedArray::kHeaderSize - kPointerSize)); | 5392 FixedArray::kHeaderSize - kPointerSize)); |
5420 __ bind(deferred->exit()); | 5393 __ bind(deferred->exit()); |
5421 __ bind(&done); | 5394 __ bind(&done); |
5422 } | 5395 } |
5423 | 5396 |
5424 #undef __ | 5397 #undef __ |
5425 | 5398 |
5426 } // namespace internal | 5399 } // namespace internal |
5427 } // namespace v8 | 5400 } // namespace v8 |
OLD | NEW |