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

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

Issue 1312763006: [heap] User safer root set accessor when possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-heap-root-set-1
Patch Set: Created 5 years, 4 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } else if (r.IsSmi()) { 59 } else if (r.IsSmi()) {
60 AssertSmi(src); 60 AssertSmi(src);
61 } 61 }
62 mov(dst, src); 62 mov(dst, src);
63 } 63 }
64 } 64 }
65 65
66 66
67 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { 67 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) {
68 if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) { 68 if (isolate()->heap()->RootCanBeTreatedAsConstant(index)) {
69 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); 69 mov(destination, isolate()->heap()->root_handle(index));
70 mov(destination, value);
71 return; 70 return;
72 } 71 }
73 ExternalReference roots_array_start = 72 ExternalReference roots_array_start =
74 ExternalReference::roots_array_start(isolate()); 73 ExternalReference::roots_array_start(isolate());
75 mov(destination, Immediate(index)); 74 mov(destination, Immediate(index));
76 mov(destination, Operand::StaticArray(destination, 75 mov(destination, Operand::StaticArray(destination,
77 times_pointer_size, 76 times_pointer_size,
78 roots_array_start)); 77 roots_array_start));
79 } 78 }
80 79
(...skipping 17 matching lines...) Expand all
98 ExternalReference::roots_array_start(isolate()); 97 ExternalReference::roots_array_start(isolate());
99 mov(scratch, Immediate(index)); 98 mov(scratch, Immediate(index));
100 cmp(with, Operand::StaticArray(scratch, 99 cmp(with, Operand::StaticArray(scratch,
101 times_pointer_size, 100 times_pointer_size,
102 roots_array_start)); 101 roots_array_start));
103 } 102 }
104 103
105 104
106 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) { 105 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) {
107 DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant(index)); 106 DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant(index));
108 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); 107 cmp(with, isolate()->heap()->root_handle(index));
109 cmp(with, value);
110 } 108 }
111 109
112 110
113 void MacroAssembler::CompareRoot(const Operand& with, 111 void MacroAssembler::CompareRoot(const Operand& with,
114 Heap::RootListIndex index) { 112 Heap::RootListIndex index) {
115 DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant(index)); 113 DCHECK(isolate()->heap()->RootCanBeTreatedAsConstant(index));
116 Handle<Object> value(&isolate()->heap()->roots_array_start()[index]); 114 cmp(with, isolate()->heap()->root_handle(index));
117 cmp(with, value);
118 } 115 }
119 116
120 117
121 void MacroAssembler::InNewSpace( 118 void MacroAssembler::InNewSpace(
122 Register object, 119 Register object,
123 Register scratch, 120 Register scratch,
124 Condition cc, 121 Condition cc,
125 Label* condition_met, 122 Label* condition_met,
126 Label::Distance condition_met_distance) { 123 Label::Distance condition_met_distance) {
127 DCHECK(cc == equal || cc == not_equal); 124 DCHECK(cc == equal || cc == not_equal);
(...skipping 3058 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 mov(eax, dividend); 3183 mov(eax, dividend);
3187 shr(eax, 31); 3184 shr(eax, 31);
3188 add(edx, eax); 3185 add(edx, eax);
3189 } 3186 }
3190 3187
3191 3188
3192 } // namespace internal 3189 } // namespace internal
3193 } // namespace v8 3190 } // namespace v8
3194 3191
3195 #endif // V8_TARGET_ARCH_IA32 3192 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/objects-debug.cc » ('j') | src/snapshot/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698