OLD | NEW |
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 IsPatchedDebugBreakSlotSequence()) { | 288 IsPatchedDebugBreakSlotSequence()) { |
289 StaticVisitor::VisitDebugTarget(heap, this); | 289 StaticVisitor::VisitDebugTarget(heap, this); |
290 } else if (IsRuntimeEntry(mode)) { | 290 } else if (IsRuntimeEntry(mode)) { |
291 StaticVisitor::VisitRuntimeEntry(this); | 291 StaticVisitor::VisitRuntimeEntry(this); |
292 } | 292 } |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 | 296 |
297 Immediate::Immediate(int x) { | 297 Immediate::Immediate(int x) { |
298 x_ = x; | 298 value_.immediate = x; |
299 rmode_ = RelocInfo::NONE32; | 299 rmode_ = RelocInfo::NONE32; |
300 } | 300 } |
301 | 301 |
302 Immediate::Immediate(Address x, RelocInfo::Mode rmode) { | 302 Immediate::Immediate(Address x, RelocInfo::Mode rmode) { |
303 x_ = reinterpret_cast<int32_t>(x); | 303 value_.immediate = reinterpret_cast<int32_t>(x); |
304 rmode_ = rmode; | 304 rmode_ = rmode; |
305 } | 305 } |
306 | 306 |
307 Immediate::Immediate(const ExternalReference& ext) { | 307 Immediate::Immediate(const ExternalReference& ext) { |
308 x_ = reinterpret_cast<int32_t>(ext.address()); | 308 value_.immediate = reinterpret_cast<int32_t>(ext.address()); |
309 rmode_ = RelocInfo::EXTERNAL_REFERENCE; | 309 rmode_ = RelocInfo::EXTERNAL_REFERENCE; |
310 } | 310 } |
311 | 311 |
312 | 312 |
313 Immediate::Immediate(Label* internal_offset) { | 313 Immediate::Immediate(Label* internal_offset) { |
314 x_ = reinterpret_cast<int32_t>(internal_offset); | 314 value_.immediate = reinterpret_cast<int32_t>(internal_offset); |
315 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 315 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 Immediate::Immediate(Handle<Object> handle) { | 319 Immediate::Immediate(Handle<Object> handle) { |
320 AllowDeferredHandleDereference using_raw_address; | 320 AllowDeferredHandleDereference using_raw_address; |
321 // Verify all Objects referred by code are NOT in new space. | 321 // Verify all Objects referred by code are NOT in new space. |
322 Object* obj = *handle; | 322 Object* obj = *handle; |
323 if (obj->IsHeapObject()) { | 323 if (obj->IsHeapObject()) { |
324 x_ = reinterpret_cast<intptr_t>(handle.location()); | 324 value_.immediate = reinterpret_cast<intptr_t>(handle.location()); |
325 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 325 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
326 } else { | 326 } else { |
327 // no relocation needed | 327 // no relocation needed |
328 x_ = reinterpret_cast<intptr_t>(obj); | 328 value_.immediate = reinterpret_cast<intptr_t>(obj); |
329 rmode_ = RelocInfo::NONE32; | 329 rmode_ = RelocInfo::NONE32; |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 Immediate::Immediate(Smi* value) { | 334 Immediate::Immediate(Smi* value) { |
335 x_ = reinterpret_cast<intptr_t>(value); | 335 value_.immediate = reinterpret_cast<intptr_t>(value); |
336 rmode_ = RelocInfo::NONE32; | 336 rmode_ = RelocInfo::NONE32; |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 Immediate::Immediate(Address addr) { | 340 Immediate::Immediate(Address addr) { |
341 x_ = reinterpret_cast<int32_t>(addr); | 341 value_.immediate = reinterpret_cast<int32_t>(addr); |
342 rmode_ = RelocInfo::NONE32; | 342 rmode_ = RelocInfo::NONE32; |
343 } | 343 } |
344 | 344 |
345 | 345 |
346 void Assembler::emit(uint32_t x) { | 346 void Assembler::emit(uint32_t x) { |
347 *reinterpret_cast<uint32_t*>(pc_) = x; | 347 *reinterpret_cast<uint32_t*>(pc_) = x; |
348 pc_ += sizeof(uint32_t); | 348 pc_ += sizeof(uint32_t); |
349 } | 349 } |
350 | 350 |
351 | 351 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 void Assembler::emit(Handle<Code> code, | 383 void Assembler::emit(Handle<Code> code, |
384 RelocInfo::Mode rmode, | 384 RelocInfo::Mode rmode, |
385 TypeFeedbackId id) { | 385 TypeFeedbackId id) { |
386 AllowDeferredHandleDereference embedding_raw_address; | 386 AllowDeferredHandleDereference embedding_raw_address; |
387 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id); | 387 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id); |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 void Assembler::emit(const Immediate& x) { | 391 void Assembler::emit(const Immediate& x) { |
392 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { | 392 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { |
393 Label* label = reinterpret_cast<Label*>(x.x_); | 393 Label* label = reinterpret_cast<Label*>(x.immediate()); |
394 emit_code_relative_offset(label); | 394 emit_code_relative_offset(label); |
395 return; | 395 return; |
396 } | 396 } |
397 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_); | 397 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_); |
398 emit(x.x_); | 398 if (x.is_heap_number()) { |
| 399 RequestHeapNumber(x.heap_number()); |
| 400 emit(0); |
| 401 } else { |
| 402 emit(x.immediate()); |
| 403 } |
399 } | 404 } |
400 | 405 |
401 | 406 |
402 void Assembler::emit_code_relative_offset(Label* label) { | 407 void Assembler::emit_code_relative_offset(Label* label) { |
403 if (label->is_bound()) { | 408 if (label->is_bound()) { |
404 int32_t pos; | 409 int32_t pos; |
405 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; | 410 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; |
406 emit(pos); | 411 emit(pos); |
407 } else { | 412 } else { |
408 emit_disp(label, Displacement::CODE_RELATIVE); | 413 emit_disp(label, Displacement::CODE_RELATIVE); |
409 } | 414 } |
410 } | 415 } |
411 | 416 |
412 void Assembler::emit_b(Immediate x) { | 417 void Assembler::emit_b(Immediate x) { |
413 DCHECK(x.is_int8() || x.is_uint8()); | 418 DCHECK(x.is_int8() || x.is_uint8()); |
414 uint8_t value = static_cast<uint8_t>(x.x_); | 419 uint8_t value = static_cast<uint8_t>(x.immediate()); |
415 *pc_++ = value; | 420 *pc_++ = value; |
416 } | 421 } |
417 | 422 |
418 void Assembler::emit_w(const Immediate& x) { | 423 void Assembler::emit_w(const Immediate& x) { |
419 DCHECK(RelocInfo::IsNone(x.rmode_)); | 424 DCHECK(RelocInfo::IsNone(x.rmode_)); |
420 uint16_t value = static_cast<uint16_t>(x.x_); | 425 uint16_t value = static_cast<uint16_t>(x.immediate()); |
421 reinterpret_cast<uint16_t*>(pc_)[0] = value; | 426 reinterpret_cast<uint16_t*>(pc_)[0] = value; |
422 pc_ += sizeof(uint16_t); | 427 pc_ += sizeof(uint16_t); |
423 } | 428 } |
424 | 429 |
425 | 430 |
426 Address Assembler::target_address_at(Address pc, Address constant_pool) { | 431 Address Assembler::target_address_at(Address pc, Address constant_pool) { |
427 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); | 432 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); |
428 } | 433 } |
429 | 434 |
430 | 435 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 542 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
538 // [disp/r] | 543 // [disp/r] |
539 set_modrm(0, ebp); | 544 set_modrm(0, ebp); |
540 set_dispr(disp, rmode); | 545 set_dispr(disp, rmode); |
541 } | 546 } |
542 | 547 |
543 | 548 |
544 Operand::Operand(Immediate imm) { | 549 Operand::Operand(Immediate imm) { |
545 // [disp/r] | 550 // [disp/r] |
546 set_modrm(0, ebp); | 551 set_modrm(0, ebp); |
547 set_dispr(imm.x_, imm.rmode_); | 552 set_dispr(imm.immediate(), imm.rmode_); |
548 } | 553 } |
549 } // namespace internal | 554 } // namespace internal |
550 } // namespace v8 | 555 } // namespace v8 |
551 | 556 |
552 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 557 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |