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