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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 Immediate::Immediate(Label* internal_offset) { | 326 Immediate::Immediate(Label* internal_offset) { |
327 x_ = reinterpret_cast<int32_t>(internal_offset); | 327 x_ = reinterpret_cast<int32_t>(internal_offset); |
328 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 328 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 Immediate::Immediate(Handle<Object> handle) { | 332 Immediate::Immediate(Handle<Object> handle) { |
| 333 ALLOW_HANDLE_DEREF("using and embedding raw address, heap object check"); |
333 // Verify all Objects referred by code are NOT in new space. | 334 // Verify all Objects referred by code are NOT in new space. |
334 Object* obj = *handle; | 335 Object* obj = *handle; |
335 ASSERT(!HEAP->InNewSpace(obj)); | 336 ASSERT(!HEAP->InNewSpace(obj)); |
336 if (obj->IsHeapObject()) { | 337 if (obj->IsHeapObject()) { |
337 x_ = reinterpret_cast<intptr_t>(handle.location()); | 338 x_ = reinterpret_cast<intptr_t>(handle.location()); |
338 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 339 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
339 } else { | 340 } else { |
340 // no relocation needed | 341 // no relocation needed |
341 x_ = reinterpret_cast<intptr_t>(obj); | 342 x_ = reinterpret_cast<intptr_t>(obj); |
342 rmode_ = RelocInfo::NONE32; | 343 rmode_ = RelocInfo::NONE32; |
(...skipping 13 matching lines...) Expand all Loading... |
356 } | 357 } |
357 | 358 |
358 | 359 |
359 void Assembler::emit(uint32_t x) { | 360 void Assembler::emit(uint32_t x) { |
360 *reinterpret_cast<uint32_t*>(pc_) = x; | 361 *reinterpret_cast<uint32_t*>(pc_) = x; |
361 pc_ += sizeof(uint32_t); | 362 pc_ += sizeof(uint32_t); |
362 } | 363 } |
363 | 364 |
364 | 365 |
365 void Assembler::emit(Handle<Object> handle) { | 366 void Assembler::emit(Handle<Object> handle) { |
| 367 ALLOW_HANDLE_DEREF("heap object check"); |
366 // Verify all Objects referred by code are NOT in new space. | 368 // Verify all Objects referred by code are NOT in new space. |
367 Object* obj = *handle; | 369 Object* obj = *handle; |
368 ASSERT(!isolate()->heap()->InNewSpace(obj)); | 370 ASSERT(!isolate()->heap()->InNewSpace(obj)); |
369 if (obj->IsHeapObject()) { | 371 if (obj->IsHeapObject()) { |
370 emit(reinterpret_cast<intptr_t>(handle.location()), | 372 emit(reinterpret_cast<intptr_t>(handle.location()), |
371 RelocInfo::EMBEDDED_OBJECT); | 373 RelocInfo::EMBEDDED_OBJECT); |
372 } else { | 374 } else { |
373 // no relocation needed | 375 // no relocation needed |
374 emit(reinterpret_cast<intptr_t>(obj)); | 376 emit(reinterpret_cast<intptr_t>(obj)); |
375 } | 377 } |
376 } | 378 } |
377 | 379 |
378 | 380 |
379 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { | 381 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { |
380 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { | 382 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { |
381 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); | 383 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); |
382 } else if (!RelocInfo::IsNone(rmode)) { | 384 } else if (!RelocInfo::IsNone(rmode)) { |
383 RecordRelocInfo(rmode); | 385 RecordRelocInfo(rmode); |
384 } | 386 } |
385 emit(x); | 387 emit(x); |
386 } | 388 } |
387 | 389 |
388 | 390 |
| 391 void Assembler::emit(Handle<Code> code, |
| 392 RelocInfo::Mode rmode, |
| 393 TypeFeedbackId id) { |
| 394 ALLOW_HANDLE_DEREF("embedding raw address"); |
| 395 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id); |
| 396 } |
| 397 |
| 398 |
389 void Assembler::emit(const Immediate& x) { | 399 void Assembler::emit(const Immediate& x) { |
390 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { | 400 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { |
391 Label* label = reinterpret_cast<Label*>(x.x_); | 401 Label* label = reinterpret_cast<Label*>(x.x_); |
392 emit_code_relative_offset(label); | 402 emit_code_relative_offset(label); |
393 return; | 403 return; |
394 } | 404 } |
395 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_); | 405 if (!RelocInfo::IsNone(x.rmode_)) RecordRelocInfo(x.rmode_); |
396 emit(x.x_); | 406 emit(x.x_); |
397 } | 407 } |
398 | 408 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 517 |
508 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 518 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
509 // [disp/r] | 519 // [disp/r] |
510 set_modrm(0, ebp); | 520 set_modrm(0, ebp); |
511 set_dispr(disp, rmode); | 521 set_dispr(disp, rmode); |
512 } | 522 } |
513 | 523 |
514 } } // namespace v8::internal | 524 } } // namespace v8::internal |
515 | 525 |
516 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 526 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |