Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 2045263002: [heap] Avoid the use of cells to point from code to new-space objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 // The registers are pushed starting with the lowest encoding, 2587 // The registers are pushed starting with the lowest encoding,
2588 // which means that lowest encodings are furthest away from 2588 // which means that lowest encodings are furthest away from
2589 // the stack pointer. 2589 // the stack pointer.
2590 DCHECK(reg_code >= 0 && reg_code < kNumSafepointRegisters); 2590 DCHECK(reg_code >= 0 && reg_code < kNumSafepointRegisters);
2591 return kNumSafepointRegisters - reg_code - 1; 2591 return kNumSafepointRegisters - reg_code - 1;
2592 } 2592 }
2593 2593
2594 2594
2595 void MacroAssembler::LoadHeapObject(Register result, 2595 void MacroAssembler::LoadHeapObject(Register result,
2596 Handle<HeapObject> object) { 2596 Handle<HeapObject> object) {
2597 AllowDeferredHandleDereference embedding_raw_address; 2597 mov(result, object);
2598 if (isolate()->heap()->InNewSpace(*object)) {
2599 Handle<Cell> cell = isolate()->factory()->NewCell(object);
2600 mov(result, Operand::ForCell(cell));
2601 } else {
2602 mov(result, object);
2603 }
2604 } 2598 }
2605 2599
2606 2600
2607 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) { 2601 void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) {
2608 AllowDeferredHandleDereference using_raw_address; 2602 cmp(reg, object);
2609 if (isolate()->heap()->InNewSpace(*object)) {
2610 Handle<Cell> cell = isolate()->factory()->NewCell(object);
2611 cmp(reg, Operand::ForCell(cell));
2612 } else {
2613 cmp(reg, object);
2614 }
2615 } 2603 }
2616 2604
2617 2605 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) { Push(object); }
2618 void MacroAssembler::PushHeapObject(Handle<HeapObject> object) {
2619 AllowDeferredHandleDereference using_raw_address;
2620 if (isolate()->heap()->InNewSpace(*object)) {
2621 Handle<Cell> cell = isolate()->factory()->NewCell(object);
2622 push(Operand::ForCell(cell));
2623 } else {
2624 Push(object);
2625 }
2626 }
2627
2628 2606
2629 void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell, 2607 void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell,
2630 Register scratch) { 2608 Register scratch) {
2631 mov(scratch, cell); 2609 mov(scratch, cell);
2632 cmp(value, FieldOperand(scratch, WeakCell::kValueOffset)); 2610 cmp(value, FieldOperand(scratch, WeakCell::kValueOffset));
2633 } 2611 }
2634 2612
2635 2613
2636 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { 2614 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) {
2637 mov(value, cell); 2615 mov(value, cell);
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 mov(eax, dividend); 3433 mov(eax, dividend);
3456 shr(eax, 31); 3434 shr(eax, 31);
3457 add(edx, eax); 3435 add(edx, eax);
3458 } 3436 }
3459 3437
3460 3438
3461 } // namespace internal 3439 } // namespace internal
3462 } // namespace v8 3440 } // namespace v8
3463 3441
3464 #endif // V8_TARGET_ARCH_IA32 3442 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698