OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/builtins/builtins-constructor.h" | 8 #include "src/builtins/builtins-constructor.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2560 | 2560 |
2561 __ Jump(lr); | 2561 __ Jump(lr); |
2562 } | 2562 } |
2563 } | 2563 } |
2564 | 2564 |
2565 | 2565 |
2566 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2566 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2567 Register context = ToRegister(instr->context()); | 2567 Register context = ToRegister(instr->context()); |
2568 Register result = ToRegister(instr->result()); | 2568 Register result = ToRegister(instr->result()); |
2569 __ ldr(result, ContextMemOperand(context, instr->slot_index())); | 2569 __ ldr(result, ContextMemOperand(context, instr->slot_index())); |
2570 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2571 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
2572 __ cmp(result, ip); | |
2573 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2574 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); | |
2575 } else { | |
2576 __ mov(result, Operand(factory()->undefined_value()), LeaveCC, eq); | |
2577 } | |
2578 } | |
2579 } | 2570 } |
2580 | 2571 |
2581 | 2572 |
2582 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2573 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2583 Register context = ToRegister(instr->context()); | 2574 Register context = ToRegister(instr->context()); |
2584 Register value = ToRegister(instr->value()); | 2575 Register value = ToRegister(instr->value()); |
2585 Register scratch = scratch0(); | 2576 Register scratch = scratch0(); |
2586 MemOperand target = ContextMemOperand(context, instr->slot_index()); | 2577 MemOperand target = ContextMemOperand(context, instr->slot_index()); |
2587 | 2578 |
2588 Label skip_assignment; | |
2589 | |
2590 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2591 __ ldr(scratch, target); | |
2592 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
2593 __ cmp(scratch, ip); | |
2594 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2595 DeoptimizeIf(eq, instr, DeoptimizeReason::kHole); | |
2596 } else { | |
2597 __ b(ne, &skip_assignment); | |
2598 } | |
2599 } | |
2600 | |
2601 __ str(value, target); | 2579 __ str(value, target); |
2602 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2580 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2603 SmiCheck check_needed = | 2581 SmiCheck check_needed = |
2604 instr->hydrogen()->value()->type().IsHeapObject() | 2582 instr->hydrogen()->value()->type().IsHeapObject() |
2605 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2583 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2606 __ RecordWriteContextSlot(context, | 2584 __ RecordWriteContextSlot(context, |
2607 target.offset(), | 2585 target.offset(), |
2608 value, | 2586 value, |
2609 scratch, | 2587 scratch, |
2610 GetLinkRegisterState(), | 2588 GetLinkRegisterState(), |
2611 kSaveFPRegs, | 2589 kSaveFPRegs, |
2612 EMIT_REMEMBERED_SET, | 2590 EMIT_REMEMBERED_SET, |
2613 check_needed); | 2591 check_needed); |
2614 } | 2592 } |
2615 | |
2616 __ bind(&skip_assignment); | |
2617 } | 2593 } |
2618 | 2594 |
2619 | 2595 |
2620 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2596 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2621 HObjectAccess access = instr->hydrogen()->access(); | 2597 HObjectAccess access = instr->hydrogen()->access(); |
2622 int offset = access.offset(); | 2598 int offset = access.offset(); |
2623 Register object = ToRegister(instr->object()); | 2599 Register object = ToRegister(instr->object()); |
2624 | 2600 |
2625 if (access.IsExternalMemory()) { | 2601 if (access.IsExternalMemory()) { |
2626 Register result = ToRegister(instr->result()); | 2602 Register result = ToRegister(instr->result()); |
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5386 __ ldr(result, FieldMemOperand(scratch, | 5362 __ ldr(result, FieldMemOperand(scratch, |
5387 FixedArray::kHeaderSize - kPointerSize)); | 5363 FixedArray::kHeaderSize - kPointerSize)); |
5388 __ bind(deferred->exit()); | 5364 __ bind(deferred->exit()); |
5389 __ bind(&done); | 5365 __ bind(&done); |
5390 } | 5366 } |
5391 | 5367 |
5392 #undef __ | 5368 #undef __ |
5393 | 5369 |
5394 } // namespace internal | 5370 } // namespace internal |
5395 } // namespace v8 | 5371 } // namespace v8 |
OLD | NEW |