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

Side by Side Diff: src/ia32/assembler-ia32-inl.h

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return reinterpret_cast<Address>(pc_); 82 return reinterpret_cast<Address>(pc_);
83 } 83 }
84 84
85 85
86 int RelocInfo::target_address_size() { 86 int RelocInfo::target_address_size() {
87 return Assembler::kExternalTargetSize; 87 return Assembler::kExternalTargetSize;
88 } 88 }
89 89
90 90
91 void RelocInfo::set_target_address(Address target) { 91 void RelocInfo::set_target_address(Address target) {
92 Assembler::set_target_address_at(pc_, target);
92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 93 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
93 Assembler::set_target_address_at(pc_, target); 94 if (host() != NULL && IsCodeTarget(rmode_)) {
95 Object* target_code = Code::GetCodeFromTargetAddress(target);
96 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
97 host(), this, HeapObject::cast(target_code));
98 }
94 } 99 }
95 100
96 101
97 Object* RelocInfo::target_object() { 102 Object* RelocInfo::target_object() {
98 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
99 return Memory::Object_at(pc_); 104 return Memory::Object_at(pc_);
100 } 105 }
101 106
102 107
103 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 108 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
104 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
105 return Memory::Object_Handle_at(pc_); 110 return Memory::Object_Handle_at(pc_);
106 } 111 }
107 112
108 113
109 Object** RelocInfo::target_object_address() { 114 Object** RelocInfo::target_object_address() {
110 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 115 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
111 return &Memory::Object_at(pc_); 116 return &Memory::Object_at(pc_);
112 } 117 }
113 118
114 119
115 void RelocInfo::set_target_object(Object* target) { 120 void RelocInfo::set_target_object(Object* target) {
116 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 121 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
117 Memory::Object_at(pc_) = target; 122 Memory::Object_at(pc_) = target;
118 CPU::FlushICache(pc_, sizeof(Address)); 123 CPU::FlushICache(pc_, sizeof(Address));
124 if (host() != NULL && target->IsHeapObject()) {
125 host()->GetHeap()->incremental_marking()->RecordWrite(
126 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
127 }
119 } 128 }
120 129
121 130
122 Address* RelocInfo::target_reference_address() { 131 Address* RelocInfo::target_reference_address() {
123 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); 132 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
124 return reinterpret_cast<Address*>(pc_); 133 return reinterpret_cast<Address*>(pc_);
125 } 134 }
126 135
127 136
128 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { 137 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
(...skipping 11 matching lines...) Expand all
140 address - JSGlobalPropertyCell::kValueOffset); 149 address - JSGlobalPropertyCell::kValueOffset);
141 return reinterpret_cast<JSGlobalPropertyCell*>(object); 150 return reinterpret_cast<JSGlobalPropertyCell*>(object);
142 } 151 }
143 152
144 153
145 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { 154 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
146 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 155 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
147 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 156 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
148 Memory::Address_at(pc_) = address; 157 Memory::Address_at(pc_) = address;
149 CPU::FlushICache(pc_, sizeof(Address)); 158 CPU::FlushICache(pc_, sizeof(Address));
159 if (host() != NULL) {
160 // TODO(1550) We are passing NULL as a slot because cell can never be on
161 // evacuation candidate.
162 host()->GetHeap()->incremental_marking()->RecordWrite(
163 host(), NULL, cell);
164 }
150 } 165 }
151 166
152 167
153 Address RelocInfo::call_address() { 168 Address RelocInfo::call_address() {
154 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 169 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
155 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 170 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
156 return Assembler::target_address_at(pc_ + 1); 171 return Assembler::target_address_at(pc_ + 1);
157 } 172 }
158 173
159 174
160 void RelocInfo::set_call_address(Address target) { 175 void RelocInfo::set_call_address(Address target) {
161 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 176 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
162 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 177 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
163 Assembler::set_target_address_at(pc_ + 1, target); 178 Assembler::set_target_address_at(pc_ + 1, target);
179 if (host() != NULL) {
180 Object* target_code = Code::GetCodeFromTargetAddress(target);
181 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
182 host(), this, HeapObject::cast(target_code));
183 }
164 } 184 }
165 185
166 186
167 Object* RelocInfo::call_object() { 187 Object* RelocInfo::call_object() {
168 return *call_object_address(); 188 return *call_object_address();
169 } 189 }
170 190
171 191
172 void RelocInfo::set_call_object(Object* target) { 192 void RelocInfo::set_call_object(Object* target) {
173 *call_object_address() = target; 193 *call_object_address() = target;
(...skipping 13 matching lines...) Expand all
187 207
188 208
189 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { 209 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
190 return !Assembler::IsNop(pc()); 210 return !Assembler::IsNop(pc());
191 } 211 }
192 212
193 213
194 void RelocInfo::Visit(ObjectVisitor* visitor) { 214 void RelocInfo::Visit(ObjectVisitor* visitor) {
195 RelocInfo::Mode mode = rmode(); 215 RelocInfo::Mode mode = rmode();
196 if (mode == RelocInfo::EMBEDDED_OBJECT) { 216 if (mode == RelocInfo::EMBEDDED_OBJECT) {
197 visitor->VisitPointer(target_object_address()); 217 visitor->VisitEmbeddedPointer(host(), target_object_address());
198 CPU::FlushICache(pc_, sizeof(Address)); 218 CPU::FlushICache(pc_, sizeof(Address));
199 } else if (RelocInfo::IsCodeTarget(mode)) { 219 } else if (RelocInfo::IsCodeTarget(mode)) {
200 visitor->VisitCodeTarget(this); 220 visitor->VisitCodeTarget(this);
201 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 221 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
202 visitor->VisitGlobalPropertyCell(this); 222 visitor->VisitGlobalPropertyCell(this);
203 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 223 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
204 visitor->VisitExternalReference(target_reference_address()); 224 visitor->VisitExternalReference(target_reference_address());
205 CPU::FlushICache(pc_, sizeof(Address)); 225 CPU::FlushICache(pc_, sizeof(Address));
206 #ifdef ENABLE_DEBUGGER_SUPPORT 226 #ifdef ENABLE_DEBUGGER_SUPPORT
207 // TODO(isolates): Get a cached isolate below. 227 // TODO(isolates): Get a cached isolate below.
208 } else if (((RelocInfo::IsJSReturn(mode) && 228 } else if (((RelocInfo::IsJSReturn(mode) &&
209 IsPatchedReturnSequence()) || 229 IsPatchedReturnSequence()) ||
210 (RelocInfo::IsDebugBreakSlot(mode) && 230 (RelocInfo::IsDebugBreakSlot(mode) &&
211 IsPatchedDebugBreakSlotSequence())) && 231 IsPatchedDebugBreakSlotSequence())) &&
212 Isolate::Current()->debug()->has_break_points()) { 232 Isolate::Current()->debug()->has_break_points()) {
213 visitor->VisitDebugTarget(this); 233 visitor->VisitDebugTarget(this);
214 #endif 234 #endif
215 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 235 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
216 visitor->VisitRuntimeEntry(this); 236 visitor->VisitRuntimeEntry(this);
217 } 237 }
218 } 238 }
219 239
220 240
221 template<typename StaticVisitor> 241 template<typename StaticVisitor>
222 void RelocInfo::Visit(Heap* heap) { 242 void RelocInfo::Visit(Heap* heap) {
223 RelocInfo::Mode mode = rmode(); 243 RelocInfo::Mode mode = rmode();
224 if (mode == RelocInfo::EMBEDDED_OBJECT) { 244 if (mode == RelocInfo::EMBEDDED_OBJECT) {
225 StaticVisitor::VisitPointer(heap, target_object_address()); 245 StaticVisitor::VisitEmbeddedPointer(heap, host(), target_object_address());
226 CPU::FlushICache(pc_, sizeof(Address)); 246 CPU::FlushICache(pc_, sizeof(Address));
227 } else if (RelocInfo::IsCodeTarget(mode)) { 247 } else if (RelocInfo::IsCodeTarget(mode)) {
228 StaticVisitor::VisitCodeTarget(heap, this); 248 StaticVisitor::VisitCodeTarget(heap, this);
229 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 249 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
230 StaticVisitor::VisitGlobalPropertyCell(heap, this); 250 StaticVisitor::VisitGlobalPropertyCell(heap, this);
231 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 251 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
232 StaticVisitor::VisitExternalReference(target_reference_address()); 252 StaticVisitor::VisitExternalReference(target_reference_address());
233 CPU::FlushICache(pc_, sizeof(Address)); 253 CPU::FlushICache(pc_, sizeof(Address));
234 #ifdef ENABLE_DEBUGGER_SUPPORT 254 #ifdef ENABLE_DEBUGGER_SUPPORT
235 } else if (heap->isolate()->debug()->has_break_points() && 255 } else if (heap->isolate()->debug()->has_break_points() &&
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 457
438 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 458 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
439 // [disp/r] 459 // [disp/r]
440 set_modrm(0, ebp); 460 set_modrm(0, ebp);
441 set_dispr(disp, rmode); 461 set_dispr(disp, rmode);
442 } 462 }
443 463
444 } } // namespace v8::internal 464 } } // namespace v8::internal
445 465
446 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 466 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698