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 315 matching lines...) Loading... |
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 #ifdef DEBUG | 333 #ifdef DEBUG |
334 Isolate* isolate = Isolate::Current(); | 334 Isolate* isolate = Isolate::Current(); |
335 #endif | 335 #endif |
336 ALLOW_HANDLE_DEREF(isolate, | 336 AllowDeferredHandleDereference using_raw_address; |
337 "using and embedding raw address, heap object check"); | |
338 // Verify all Objects referred by code are NOT in new space. | 337 // Verify all Objects referred by code are NOT in new space. |
339 Object* obj = *handle; | 338 Object* obj = *handle; |
340 ASSERT(!isolate->heap()->InNewSpace(obj)); | 339 ASSERT(!isolate->heap()->InNewSpace(obj)); |
341 if (obj->IsHeapObject()) { | 340 if (obj->IsHeapObject()) { |
342 x_ = reinterpret_cast<intptr_t>(handle.location()); | 341 x_ = reinterpret_cast<intptr_t>(handle.location()); |
343 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 342 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
344 } else { | 343 } else { |
345 // no relocation needed | 344 // no relocation needed |
346 x_ = reinterpret_cast<intptr_t>(obj); | 345 x_ = reinterpret_cast<intptr_t>(obj); |
347 rmode_ = RelocInfo::NONE32; | 346 rmode_ = RelocInfo::NONE32; |
(...skipping 13 matching lines...) Loading... |
361 } | 360 } |
362 | 361 |
363 | 362 |
364 void Assembler::emit(uint32_t x) { | 363 void Assembler::emit(uint32_t x) { |
365 *reinterpret_cast<uint32_t*>(pc_) = x; | 364 *reinterpret_cast<uint32_t*>(pc_) = x; |
366 pc_ += sizeof(uint32_t); | 365 pc_ += sizeof(uint32_t); |
367 } | 366 } |
368 | 367 |
369 | 368 |
370 void Assembler::emit(Handle<Object> handle) { | 369 void Assembler::emit(Handle<Object> handle) { |
371 ALLOW_HANDLE_DEREF(isolate(), "heap object check"); | 370 AllowDeferredHandleDereference heap_object_check; |
372 // Verify all Objects referred by code are NOT in new space. | 371 // Verify all Objects referred by code are NOT in new space. |
373 Object* obj = *handle; | 372 Object* obj = *handle; |
374 ASSERT(!isolate()->heap()->InNewSpace(obj)); | 373 ASSERT(!isolate()->heap()->InNewSpace(obj)); |
375 if (obj->IsHeapObject()) { | 374 if (obj->IsHeapObject()) { |
376 emit(reinterpret_cast<intptr_t>(handle.location()), | 375 emit(reinterpret_cast<intptr_t>(handle.location()), |
377 RelocInfo::EMBEDDED_OBJECT); | 376 RelocInfo::EMBEDDED_OBJECT); |
378 } else { | 377 } else { |
379 // no relocation needed | 378 // no relocation needed |
380 emit(reinterpret_cast<intptr_t>(obj)); | 379 emit(reinterpret_cast<intptr_t>(obj)); |
381 } | 380 } |
382 } | 381 } |
383 | 382 |
384 | 383 |
385 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { | 384 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { |
386 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { | 385 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { |
387 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); | 386 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); |
388 } else if (!RelocInfo::IsNone(rmode)) { | 387 } else if (!RelocInfo::IsNone(rmode)) { |
389 RecordRelocInfo(rmode); | 388 RecordRelocInfo(rmode); |
390 } | 389 } |
391 emit(x); | 390 emit(x); |
392 } | 391 } |
393 | 392 |
394 | 393 |
395 void Assembler::emit(Handle<Code> code, | 394 void Assembler::emit(Handle<Code> code, |
396 RelocInfo::Mode rmode, | 395 RelocInfo::Mode rmode, |
397 TypeFeedbackId id) { | 396 TypeFeedbackId id) { |
398 ALLOW_HANDLE_DEREF(isolate(), "embedding raw address"); | 397 AllowDeferredHandleDereference embedding_raw_address; |
399 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id); | 398 emit(reinterpret_cast<intptr_t>(code.location()), rmode, id); |
400 } | 399 } |
401 | 400 |
402 | 401 |
403 void Assembler::emit(const Immediate& x) { | 402 void Assembler::emit(const Immediate& x) { |
404 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { | 403 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) { |
405 Label* label = reinterpret_cast<Label*>(x.x_); | 404 Label* label = reinterpret_cast<Label*>(x.x_); |
406 emit_code_relative_offset(label); | 405 emit_code_relative_offset(label); |
407 return; | 406 return; |
408 } | 407 } |
(...skipping 112 matching lines...) Loading... |
521 | 520 |
522 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 521 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
523 // [disp/r] | 522 // [disp/r] |
524 set_modrm(0, ebp); | 523 set_modrm(0, ebp); |
525 set_dispr(disp, rmode); | 524 set_dispr(disp, rmode); |
526 } | 525 } |
527 | 526 |
528 } } // namespace v8::internal | 527 } } // namespace v8::internal |
529 | 528 |
530 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 529 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |