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

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

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/x87/assembler-x87.cc ('k') | src/x87/builtins-x87.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } else if (IsInternalReference(rmode_)) { 80 } else if (IsInternalReference(rmode_)) {
81 // absolute code pointer inside code object moves with the code object. 81 // absolute code pointer inside code object moves with the code object.
82 int32_t* p = reinterpret_cast<int32_t*>(pc_); 82 int32_t* p = reinterpret_cast<int32_t*>(pc_);
83 *p += delta; // Relocate entry. 83 *p += delta; // Relocate entry.
84 if (flush_icache) CpuFeatures::FlushICache(p, sizeof(uint32_t)); 84 if (flush_icache) CpuFeatures::FlushICache(p, sizeof(uint32_t));
85 } 85 }
86 } 86 }
87 87
88 88
89 Address RelocInfo::target_address() { 89 Address RelocInfo::target_address() {
90 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 90 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
91 return Assembler::target_address_at(pc_, host_); 91 return Assembler::target_address_at(pc_, host_);
92 } 92 }
93 93
94 94
95 Address RelocInfo::target_address_address() { 95 Address RelocInfo::target_address_address() {
96 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 96 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
97 || rmode_ == EMBEDDED_OBJECT 97 || rmode_ == EMBEDDED_OBJECT
98 || rmode_ == EXTERNAL_REFERENCE); 98 || rmode_ == EXTERNAL_REFERENCE);
99 return reinterpret_cast<Address>(pc_); 99 return reinterpret_cast<Address>(pc_);
100 } 100 }
101 101
102 102
103 Address RelocInfo::constant_pool_entry_address() { 103 Address RelocInfo::constant_pool_entry_address() {
104 UNREACHABLE(); 104 UNREACHABLE();
105 return NULL; 105 return NULL;
106 } 106 }
107 107
108 108
109 int RelocInfo::target_address_size() { 109 int RelocInfo::target_address_size() {
110 return Assembler::kSpecialTargetSize; 110 return Assembler::kSpecialTargetSize;
111 } 111 }
112 112
113 113
114 void RelocInfo::set_target_address(Address target, 114 void RelocInfo::set_target_address(Address target,
115 WriteBarrierMode write_barrier_mode, 115 WriteBarrierMode write_barrier_mode,
116 ICacheFlushMode icache_flush_mode) { 116 ICacheFlushMode icache_flush_mode) {
117 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); 117 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode);
118 Assembler::set_target_address_at(pc_, host_, target); 118 Assembler::set_target_address_at(pc_, host_, target);
119 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 119 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
120 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 120 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL &&
121 IsCodeTarget(rmode_)) { 121 IsCodeTarget(rmode_)) {
122 Object* target_code = Code::GetCodeFromTargetAddress(target); 122 Object* target_code = Code::GetCodeFromTargetAddress(target);
123 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 123 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
124 host(), this, HeapObject::cast(target_code)); 124 host(), this, HeapObject::cast(target_code));
125 } 125 }
126 } 126 }
127 127
128 128
129 Object* RelocInfo::target_object() { 129 Object* RelocInfo::target_object() {
130 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 130 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
131 return Memory::Object_at(pc_); 131 return Memory::Object_at(pc_);
132 } 132 }
133 133
134 134
135 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 135 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
136 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 136 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
137 return Memory::Object_Handle_at(pc_); 137 return Memory::Object_Handle_at(pc_);
138 } 138 }
139 139
140 140
141 void RelocInfo::set_target_object(Object* target, 141 void RelocInfo::set_target_object(Object* target,
142 WriteBarrierMode write_barrier_mode, 142 WriteBarrierMode write_barrier_mode,
143 ICacheFlushMode icache_flush_mode) { 143 ICacheFlushMode icache_flush_mode) {
144 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 144 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
145 Memory::Object_at(pc_) = target; 145 Memory::Object_at(pc_) = target;
146 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 146 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
147 CpuFeatures::FlushICache(pc_, sizeof(Address)); 147 CpuFeatures::FlushICache(pc_, sizeof(Address));
148 } 148 }
149 if (write_barrier_mode == UPDATE_WRITE_BARRIER && 149 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
150 host() != NULL && 150 host() != NULL &&
151 target->IsHeapObject()) { 151 target->IsHeapObject()) {
152 host()->GetHeap()->incremental_marking()->RecordWrite( 152 host()->GetHeap()->incremental_marking()->RecordWrite(
153 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); 153 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
154 } 154 }
155 } 155 }
156 156
157 157
158 Address RelocInfo::target_reference() { 158 Address RelocInfo::target_reference() {
159 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); 159 DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
160 return Memory::Address_at(pc_); 160 return Memory::Address_at(pc_);
161 } 161 }
162 162
163 163
164 Address RelocInfo::target_runtime_entry(Assembler* origin) { 164 Address RelocInfo::target_runtime_entry(Assembler* origin) {
165 ASSERT(IsRuntimeEntry(rmode_)); 165 DCHECK(IsRuntimeEntry(rmode_));
166 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); 166 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_));
167 } 167 }
168 168
169 169
170 void RelocInfo::set_target_runtime_entry(Address target, 170 void RelocInfo::set_target_runtime_entry(Address target,
171 WriteBarrierMode write_barrier_mode, 171 WriteBarrierMode write_barrier_mode,
172 ICacheFlushMode icache_flush_mode) { 172 ICacheFlushMode icache_flush_mode) {
173 ASSERT(IsRuntimeEntry(rmode_)); 173 DCHECK(IsRuntimeEntry(rmode_));
174 if (target_address() != target) { 174 if (target_address() != target) {
175 set_target_address(target, write_barrier_mode, icache_flush_mode); 175 set_target_address(target, write_barrier_mode, icache_flush_mode);
176 } 176 }
177 } 177 }
178 178
179 179
180 Handle<Cell> RelocInfo::target_cell_handle() { 180 Handle<Cell> RelocInfo::target_cell_handle() {
181 ASSERT(rmode_ == RelocInfo::CELL); 181 DCHECK(rmode_ == RelocInfo::CELL);
182 Address address = Memory::Address_at(pc_); 182 Address address = Memory::Address_at(pc_);
183 return Handle<Cell>(reinterpret_cast<Cell**>(address)); 183 return Handle<Cell>(reinterpret_cast<Cell**>(address));
184 } 184 }
185 185
186 186
187 Cell* RelocInfo::target_cell() { 187 Cell* RelocInfo::target_cell() {
188 ASSERT(rmode_ == RelocInfo::CELL); 188 DCHECK(rmode_ == RelocInfo::CELL);
189 return Cell::FromValueAddress(Memory::Address_at(pc_)); 189 return Cell::FromValueAddress(Memory::Address_at(pc_));
190 } 190 }
191 191
192 192
193 void RelocInfo::set_target_cell(Cell* cell, 193 void RelocInfo::set_target_cell(Cell* cell,
194 WriteBarrierMode write_barrier_mode, 194 WriteBarrierMode write_barrier_mode,
195 ICacheFlushMode icache_flush_mode) { 195 ICacheFlushMode icache_flush_mode) {
196 ASSERT(rmode_ == RelocInfo::CELL); 196 DCHECK(rmode_ == RelocInfo::CELL);
197 Address address = cell->address() + Cell::kValueOffset; 197 Address address = cell->address() + Cell::kValueOffset;
198 Memory::Address_at(pc_) = address; 198 Memory::Address_at(pc_) = address;
199 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 199 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
200 CpuFeatures::FlushICache(pc_, sizeof(Address)); 200 CpuFeatures::FlushICache(pc_, sizeof(Address));
201 } 201 }
202 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) { 202 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
203 // TODO(1550) We are passing NULL as a slot because cell can never be on 203 // TODO(1550) We are passing NULL as a slot because cell can never be on
204 // evacuation candidate. 204 // evacuation candidate.
205 host()->GetHeap()->incremental_marking()->RecordWrite( 205 host()->GetHeap()->incremental_marking()->RecordWrite(
206 host(), NULL, cell); 206 host(), NULL, cell);
207 } 207 }
208 } 208 }
209 209
210 210
211 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { 211 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
212 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 212 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
213 ASSERT(*pc_ == kCallOpcode); 213 DCHECK(*pc_ == kCallOpcode);
214 return Memory::Object_Handle_at(pc_ + 1); 214 return Memory::Object_Handle_at(pc_ + 1);
215 } 215 }
216 216
217 217
218 Code* RelocInfo::code_age_stub() { 218 Code* RelocInfo::code_age_stub() {
219 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 219 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
220 ASSERT(*pc_ == kCallOpcode); 220 DCHECK(*pc_ == kCallOpcode);
221 return Code::GetCodeFromTargetAddress( 221 return Code::GetCodeFromTargetAddress(
222 Assembler::target_address_at(pc_ + 1, host_)); 222 Assembler::target_address_at(pc_ + 1, host_));
223 } 223 }
224 224
225 225
226 void RelocInfo::set_code_age_stub(Code* stub, 226 void RelocInfo::set_code_age_stub(Code* stub,
227 ICacheFlushMode icache_flush_mode) { 227 ICacheFlushMode icache_flush_mode) {
228 ASSERT(*pc_ == kCallOpcode); 228 DCHECK(*pc_ == kCallOpcode);
229 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 229 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
230 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start(), 230 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start(),
231 icache_flush_mode); 231 icache_flush_mode);
232 } 232 }
233 233
234 234
235 Address RelocInfo::call_address() { 235 Address RelocInfo::call_address() {
236 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 236 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
237 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 237 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
238 return Assembler::target_address_at(pc_ + 1, host_); 238 return Assembler::target_address_at(pc_ + 1, host_);
239 } 239 }
240 240
241 241
242 void RelocInfo::set_call_address(Address target) { 242 void RelocInfo::set_call_address(Address target) {
243 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 243 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
244 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 244 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
245 Assembler::set_target_address_at(pc_ + 1, host_, target); 245 Assembler::set_target_address_at(pc_ + 1, host_, target);
246 if (host() != NULL) { 246 if (host() != NULL) {
247 Object* target_code = Code::GetCodeFromTargetAddress(target); 247 Object* target_code = Code::GetCodeFromTargetAddress(target);
248 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 248 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
249 host(), this, HeapObject::cast(target_code)); 249 host(), this, HeapObject::cast(target_code));
250 } 250 }
251 } 251 }
252 252
253 253
254 Object* RelocInfo::call_object() { 254 Object* RelocInfo::call_object() {
255 return *call_object_address(); 255 return *call_object_address();
256 } 256 }
257 257
258 258
259 void RelocInfo::set_call_object(Object* target) { 259 void RelocInfo::set_call_object(Object* target) {
260 *call_object_address() = target; 260 *call_object_address() = target;
261 } 261 }
262 262
263 263
264 Object** RelocInfo::call_object_address() { 264 Object** RelocInfo::call_object_address() {
265 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 265 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
266 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 266 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
267 return reinterpret_cast<Object**>(pc_ + 1); 267 return reinterpret_cast<Object**>(pc_ + 1);
268 } 268 }
269 269
270 270
271 void RelocInfo::WipeOut() { 271 void RelocInfo::WipeOut() {
272 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { 272 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) {
273 Memory::Address_at(pc_) = NULL; 273 Memory::Address_at(pc_) = NULL;
274 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { 274 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
275 // Effectively write zero into the relocation. 275 // Effectively write zero into the relocation.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 x_ = reinterpret_cast<int32_t>(internal_offset); 360 x_ = reinterpret_cast<int32_t>(internal_offset);
361 rmode_ = RelocInfo::INTERNAL_REFERENCE; 361 rmode_ = RelocInfo::INTERNAL_REFERENCE;
362 } 362 }
363 363
364 364
365 Immediate::Immediate(Handle<Object> handle) { 365 Immediate::Immediate(Handle<Object> handle) {
366 AllowDeferredHandleDereference using_raw_address; 366 AllowDeferredHandleDereference using_raw_address;
367 // Verify all Objects referred by code are NOT in new space. 367 // Verify all Objects referred by code are NOT in new space.
368 Object* obj = *handle; 368 Object* obj = *handle;
369 if (obj->IsHeapObject()) { 369 if (obj->IsHeapObject()) {
370 ASSERT(!HeapObject::cast(obj)->GetHeap()->InNewSpace(obj)); 370 DCHECK(!HeapObject::cast(obj)->GetHeap()->InNewSpace(obj));
371 x_ = reinterpret_cast<intptr_t>(handle.location()); 371 x_ = reinterpret_cast<intptr_t>(handle.location());
372 rmode_ = RelocInfo::EMBEDDED_OBJECT; 372 rmode_ = RelocInfo::EMBEDDED_OBJECT;
373 } else { 373 } else {
374 // no relocation needed 374 // no relocation needed
375 x_ = reinterpret_cast<intptr_t>(obj); 375 x_ = reinterpret_cast<intptr_t>(obj);
376 rmode_ = RelocInfo::NONE32; 376 rmode_ = RelocInfo::NONE32;
377 } 377 }
378 } 378 }
379 379
380 380
(...skipping 12 matching lines...) Expand all
393 void Assembler::emit(uint32_t x) { 393 void Assembler::emit(uint32_t x) {
394 *reinterpret_cast<uint32_t*>(pc_) = x; 394 *reinterpret_cast<uint32_t*>(pc_) = x;
395 pc_ += sizeof(uint32_t); 395 pc_ += sizeof(uint32_t);
396 } 396 }
397 397
398 398
399 void Assembler::emit(Handle<Object> handle) { 399 void Assembler::emit(Handle<Object> handle) {
400 AllowDeferredHandleDereference heap_object_check; 400 AllowDeferredHandleDereference heap_object_check;
401 // Verify all Objects referred by code are NOT in new space. 401 // Verify all Objects referred by code are NOT in new space.
402 Object* obj = *handle; 402 Object* obj = *handle;
403 ASSERT(!isolate()->heap()->InNewSpace(obj)); 403 DCHECK(!isolate()->heap()->InNewSpace(obj));
404 if (obj->IsHeapObject()) { 404 if (obj->IsHeapObject()) {
405 emit(reinterpret_cast<intptr_t>(handle.location()), 405 emit(reinterpret_cast<intptr_t>(handle.location()),
406 RelocInfo::EMBEDDED_OBJECT); 406 RelocInfo::EMBEDDED_OBJECT);
407 } else { 407 } else {
408 // no relocation needed 408 // no relocation needed
409 emit(reinterpret_cast<intptr_t>(obj)); 409 emit(reinterpret_cast<intptr_t>(obj));
410 } 410 }
411 } 411 }
412 412
413 413
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 int32_t pos; 446 int32_t pos;
447 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; 447 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag;
448 emit(pos); 448 emit(pos);
449 } else { 449 } else {
450 emit_disp(label, Displacement::CODE_RELATIVE); 450 emit_disp(label, Displacement::CODE_RELATIVE);
451 } 451 }
452 } 452 }
453 453
454 454
455 void Assembler::emit_w(const Immediate& x) { 455 void Assembler::emit_w(const Immediate& x) {
456 ASSERT(RelocInfo::IsNone(x.rmode_)); 456 DCHECK(RelocInfo::IsNone(x.rmode_));
457 uint16_t value = static_cast<uint16_t>(x.x_); 457 uint16_t value = static_cast<uint16_t>(x.x_);
458 reinterpret_cast<uint16_t*>(pc_)[0] = value; 458 reinterpret_cast<uint16_t*>(pc_)[0] = value;
459 pc_ += sizeof(uint16_t); 459 pc_ += sizeof(uint16_t);
460 } 460 }
461 461
462 462
463 Address Assembler::target_address_at(Address pc, 463 Address Assembler::target_address_at(Address pc,
464 ConstantPoolArray* constant_pool) { 464 ConstantPoolArray* constant_pool) {
465 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); 465 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
466 } 466 }
(...skipping 30 matching lines...) Expand all
497 Displacement disp(L, type); 497 Displacement disp(L, type);
498 L->link_to(pc_offset()); 498 L->link_to(pc_offset());
499 emit(static_cast<int>(disp.data())); 499 emit(static_cast<int>(disp.data()));
500 } 500 }
501 501
502 502
503 void Assembler::emit_near_disp(Label* L) { 503 void Assembler::emit_near_disp(Label* L) {
504 byte disp = 0x00; 504 byte disp = 0x00;
505 if (L->is_near_linked()) { 505 if (L->is_near_linked()) {
506 int offset = L->near_link_pos() - pc_offset(); 506 int offset = L->near_link_pos() - pc_offset();
507 ASSERT(is_int8(offset)); 507 DCHECK(is_int8(offset));
508 disp = static_cast<byte>(offset & 0xFF); 508 disp = static_cast<byte>(offset & 0xFF);
509 } 509 }
510 L->link_to(pc_offset(), Label::kNear); 510 L->link_to(pc_offset(), Label::kNear);
511 *pc_++ = disp; 511 *pc_++ = disp;
512 } 512 }
513 513
514 514
515 void Operand::set_modrm(int mod, Register rm) { 515 void Operand::set_modrm(int mod, Register rm) {
516 ASSERT((mod & -4) == 0); 516 DCHECK((mod & -4) == 0);
517 buf_[0] = mod << 6 | rm.code(); 517 buf_[0] = mod << 6 | rm.code();
518 len_ = 1; 518 len_ = 1;
519 } 519 }
520 520
521 521
522 void Operand::set_sib(ScaleFactor scale, Register index, Register base) { 522 void Operand::set_sib(ScaleFactor scale, Register index, Register base) {
523 ASSERT(len_ == 1); 523 DCHECK(len_ == 1);
524 ASSERT((scale & -4) == 0); 524 DCHECK((scale & -4) == 0);
525 // Use SIB with no index register only for base esp. 525 // Use SIB with no index register only for base esp.
526 ASSERT(!index.is(esp) || base.is(esp)); 526 DCHECK(!index.is(esp) || base.is(esp));
527 buf_[1] = scale << 6 | index.code() << 3 | base.code(); 527 buf_[1] = scale << 6 | index.code() << 3 | base.code();
528 len_ = 2; 528 len_ = 2;
529 } 529 }
530 530
531 531
532 void Operand::set_disp8(int8_t disp) { 532 void Operand::set_disp8(int8_t disp) {
533 ASSERT(len_ == 1 || len_ == 2); 533 DCHECK(len_ == 1 || len_ == 2);
534 *reinterpret_cast<int8_t*>(&buf_[len_++]) = disp; 534 *reinterpret_cast<int8_t*>(&buf_[len_++]) = disp;
535 } 535 }
536 536
537 537
538 void Operand::set_dispr(int32_t disp, RelocInfo::Mode rmode) { 538 void Operand::set_dispr(int32_t disp, RelocInfo::Mode rmode) {
539 ASSERT(len_ == 1 || len_ == 2); 539 DCHECK(len_ == 1 || len_ == 2);
540 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 540 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
541 *p = disp; 541 *p = disp;
542 len_ += sizeof(int32_t); 542 len_ += sizeof(int32_t);
543 rmode_ = rmode; 543 rmode_ = rmode;
544 } 544 }
545 545
546 Operand::Operand(Register reg) { 546 Operand::Operand(Register reg) {
547 // reg 547 // reg
548 set_modrm(3, reg); 548 set_modrm(3, reg);
549 } 549 }
550 550
551 551
552 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 552 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
553 // [disp/r] 553 // [disp/r]
554 set_modrm(0, ebp); 554 set_modrm(0, ebp);
555 set_dispr(disp, rmode); 555 set_dispr(disp, rmode);
556 } 556 }
557 557
558 558
559 Operand::Operand(Immediate imm) { 559 Operand::Operand(Immediate imm) {
560 // [disp/r] 560 // [disp/r]
561 set_modrm(0, ebp); 561 set_modrm(0, ebp);
562 set_dispr(imm.x_, imm.rmode_); 562 set_dispr(imm.x_, imm.rmode_);
563 } 563 }
564 } } // namespace v8::internal 564 } } // namespace v8::internal
565 565
566 #endif // V8_X87_ASSEMBLER_X87_INL_H_ 566 #endif // V8_X87_ASSEMBLER_X87_INL_H_
OLDNEW
« no previous file with comments | « src/x87/assembler-x87.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698