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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 #endif | 293 #endif |
294 } else if (mode == RelocInfo::RUNTIME_ENTRY) { | 294 } else if (mode == RelocInfo::RUNTIME_ENTRY) { |
295 StaticVisitor::VisitRuntimeEntry(this); | 295 StaticVisitor::VisitRuntimeEntry(this); |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 | 299 |
300 | 300 |
301 Immediate::Immediate(int x) { | 301 Immediate::Immediate(int x) { |
302 x_ = x; | 302 x_ = x; |
303 rmode_ = RelocInfo::NONE; | 303 rmode_ = RelocInfo::NONE32; |
304 } | 304 } |
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 x_ = 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 x_ = 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 // Verify all Objects referred by code are NOT in new space. | 320 // Verify all Objects referred by code are NOT in new space. |
321 Object* obj = *handle; | 321 Object* obj = *handle; |
322 ASSERT(!HEAP->InNewSpace(obj)); | 322 ASSERT(!HEAP->InNewSpace(obj)); |
323 if (obj->IsHeapObject()) { | 323 if (obj->IsHeapObject()) { |
324 x_ = reinterpret_cast<intptr_t>(handle.location()); | 324 x_ = 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 x_ = reinterpret_cast<intptr_t>(obj); |
329 rmode_ = RelocInfo::NONE; | 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 x_ = reinterpret_cast<intptr_t>(value); |
336 rmode_ = RelocInfo::NONE; | 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 x_ = reinterpret_cast<int32_t>(addr); |
342 rmode_ = RelocInfo::NONE; | 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 |
352 void Assembler::emit(Handle<Object> handle) { | 352 void Assembler::emit(Handle<Object> handle) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 int32_t pos; | 389 int32_t pos; |
390 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; | 390 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag; |
391 emit(pos); | 391 emit(pos); |
392 } else { | 392 } else { |
393 emit_disp(label, Displacement::CODE_RELATIVE); | 393 emit_disp(label, Displacement::CODE_RELATIVE); |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 void Assembler::emit_w(const Immediate& x) { | 398 void Assembler::emit_w(const Immediate& x) { |
399 ASSERT(x.rmode_ == RelocInfo::NONE); | 399 ASSERT(x.rmode_ == RelocInfo::NONE32); |
400 uint16_t value = static_cast<uint16_t>(x.x_); | 400 uint16_t value = static_cast<uint16_t>(x.x_); |
401 reinterpret_cast<uint16_t*>(pc_)[0] = value; | 401 reinterpret_cast<uint16_t*>(pc_)[0] = value; |
402 pc_ += sizeof(uint16_t); | 402 pc_ += sizeof(uint16_t); |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 Address Assembler::target_address_at(Address pc) { | 406 Address Assembler::target_address_at(Address pc) { |
407 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); | 407 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); |
408 } | 408 } |
409 | 409 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 495 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
496 // [disp/r] | 496 // [disp/r] |
497 set_modrm(0, ebp); | 497 set_modrm(0, ebp); |
498 set_dispr(disp, rmode); | 498 set_dispr(disp, rmode); |
499 } | 499 } |
500 | 500 |
501 } } // namespace v8::internal | 501 } } // namespace v8::internal |
502 | 502 |
503 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 503 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |