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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 // The registers are pushed starting with the lowest encoding, | 2588 // The registers are pushed starting with the lowest encoding, |
2589 // which means that lowest encodings are furthest away from | 2589 // which means that lowest encodings are furthest away from |
2590 // the stack pointer. | 2590 // the stack pointer. |
2591 DCHECK(reg_code >= 0 && reg_code < kNumSafepointRegisters); | 2591 DCHECK(reg_code >= 0 && reg_code < kNumSafepointRegisters); |
2592 return kNumSafepointRegisters - reg_code - 1; | 2592 return kNumSafepointRegisters - reg_code - 1; |
2593 } | 2593 } |
2594 | 2594 |
2595 | 2595 |
2596 void MacroAssembler::LoadHeapObject(Register result, | 2596 void MacroAssembler::LoadHeapObject(Register result, |
2597 Handle<HeapObject> object) { | 2597 Handle<HeapObject> object) { |
2598 mov(result, object); | 2598 AllowDeferredHandleDereference embedding_raw_address; |
| 2599 if (isolate()->heap()->InNewSpace(*object)) { |
| 2600 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2601 mov(result, Operand::ForCell(cell)); |
| 2602 } else { |
| 2603 mov(result, object); |
| 2604 } |
2599 } | 2605 } |
2600 | 2606 |
2601 | 2607 |
2602 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) { | 2608 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) { |
2603 cmp(reg, object); | 2609 AllowDeferredHandleDereference using_raw_address; |
| 2610 if (isolate()->heap()->InNewSpace(*object)) { |
| 2611 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2612 cmp(reg, Operand::ForCell(cell)); |
| 2613 } else { |
| 2614 cmp(reg, object); |
| 2615 } |
2604 } | 2616 } |
2605 | 2617 |
2606 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { Push(object); } | 2618 |
| 2619 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { |
| 2620 AllowDeferredHandleDereference using_raw_address; |
| 2621 if (isolate()->heap()->InNewSpace(*object)) { |
| 2622 Handle<Cell> cell = isolate()->factory()->NewCell(object); |
| 2623 push(Operand::ForCell(cell)); |
| 2624 } else { |
| 2625 Push(object); |
| 2626 } |
| 2627 } |
| 2628 |
2607 | 2629 |
2608 void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell, | 2630 void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell, |
2609 Register scratch) { | 2631 Register scratch) { |
2610 mov(scratch, cell); | 2632 mov(scratch, cell); |
2611 cmp(value, FieldOperand(scratch, WeakCell::kValueOffset)); | 2633 cmp(value, FieldOperand(scratch, WeakCell::kValueOffset)); |
2612 } | 2634 } |
2613 | 2635 |
2614 | 2636 |
2615 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { | 2637 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { |
2616 mov(value, cell); | 2638 mov(value, cell); |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 mov(eax, dividend); | 3456 mov(eax, dividend); |
3435 shr(eax, 31); | 3457 shr(eax, 31); |
3436 add(edx, eax); | 3458 add(edx, eax); |
3437 } | 3459 } |
3438 | 3460 |
3439 | 3461 |
3440 } // namespace internal | 3462 } // namespace internal |
3441 } // namespace v8 | 3463 } // namespace v8 |
3442 | 3464 |
3443 #endif // V8_TARGET_ARCH_IA32 | 3465 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |