| 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 29 matching lines...) Expand all Loading... |
| 40 #include "ia32/assembler-ia32.h" | 40 #include "ia32/assembler-ia32.h" |
| 41 | 41 |
| 42 #include "cpu.h" | 42 #include "cpu.h" |
| 43 #include "debug.h" | 43 #include "debug.h" |
| 44 | 44 |
| 45 namespace v8 { | 45 namespace v8 { |
| 46 namespace internal { | 46 namespace internal { |
| 47 | 47 |
| 48 | 48 |
| 49 static const byte kCallOpcode = 0xE8; | 49 static const byte kCallOpcode = 0xE8; |
| 50 static const int kNoCodeAgeSequenceLength = 5; |
| 50 | 51 |
| 51 | 52 |
| 52 // The modes possibly affected by apply must be in kApplyMask. | 53 // The modes possibly affected by apply must be in kApplyMask. |
| 53 void RelocInfo::apply(intptr_t delta) { | 54 void RelocInfo::apply(intptr_t delta) { |
| 54 if (IsRuntimeEntry(rmode_) || IsCodeTarget(rmode_)) { | 55 if (IsRuntimeEntry(rmode_) || IsCodeTarget(rmode_)) { |
| 55 int32_t* p = reinterpret_cast<int32_t*>(pc_); | 56 int32_t* p = reinterpret_cast<int32_t*>(pc_); |
| 56 *p -= delta; // Relocate entry. | 57 *p -= delta; // Relocate entry. |
| 57 CPU::FlushICache(p, sizeof(uint32_t)); | 58 CPU::FlushICache(p, sizeof(uint32_t)); |
| 58 } else if (rmode_ == CODE_AGE_SEQUENCE) { | 59 } else if (rmode_ == CODE_AGE_SEQUENCE) { |
| 59 if (*pc_ == kCallOpcode) { | 60 if (*pc_ == kCallOpcode) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 CPU::FlushICache(pc_, sizeof(Address)); | 184 CPU::FlushICache(pc_, sizeof(Address)); |
| 184 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { | 185 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
| 185 // TODO(1550) We are passing NULL as a slot because cell can never be on | 186 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 186 // evacuation candidate. | 187 // evacuation candidate. |
| 187 host()->GetHeap()->incremental_marking()->RecordWrite( | 188 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 188 host(), NULL, cell); | 189 host(), NULL, cell); |
| 189 } | 190 } |
| 190 } | 191 } |
| 191 | 192 |
| 192 | 193 |
| 194 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { |
| 195 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 196 ASSERT(*pc_ == kCallOpcode); |
| 197 return Memory::Object_Handle_at(pc_ + 1); |
| 198 } |
| 199 |
| 200 |
| 193 Code* RelocInfo::code_age_stub() { | 201 Code* RelocInfo::code_age_stub() { |
| 194 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 202 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 195 ASSERT(*pc_ == kCallOpcode); | 203 ASSERT(*pc_ == kCallOpcode); |
| 196 return Code::GetCodeFromTargetAddress( | 204 return Code::GetCodeFromTargetAddress( |
| 197 Assembler::target_address_at(pc_ + 1)); | 205 Assembler::target_address_at(pc_ + 1)); |
| 198 } | 206 } |
| 199 | 207 |
| 200 | 208 |
| 201 void RelocInfo::set_code_age_stub(Code* stub) { | 209 void RelocInfo::set_code_age_stub(Code* stub) { |
| 202 ASSERT(*pc_ == kCallOpcode); | 210 ASSERT(*pc_ == kCallOpcode); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } else { | 380 } else { |
| 373 // no relocation needed | 381 // no relocation needed |
| 374 emit(reinterpret_cast<intptr_t>(obj)); | 382 emit(reinterpret_cast<intptr_t>(obj)); |
| 375 } | 383 } |
| 376 } | 384 } |
| 377 | 385 |
| 378 | 386 |
| 379 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { | 387 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, TypeFeedbackId id) { |
| 380 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { | 388 if (rmode == RelocInfo::CODE_TARGET && !id.IsNone()) { |
| 381 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); | 389 RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, id.ToInt()); |
| 382 } else if (!RelocInfo::IsNone(rmode)) { | 390 } else if (!RelocInfo::IsNone(rmode) |
| 391 && rmode != RelocInfo::CODE_AGE_SEQUENCE) { |
| 383 RecordRelocInfo(rmode); | 392 RecordRelocInfo(rmode); |
| 384 } | 393 } |
| 385 emit(x); | 394 emit(x); |
| 386 } | 395 } |
| 387 | 396 |
| 388 | 397 |
| 389 void Assembler::emit(Handle<Code> code, | 398 void Assembler::emit(Handle<Code> code, |
| 390 RelocInfo::Mode rmode, | 399 RelocInfo::Mode rmode, |
| 391 TypeFeedbackId id) { | 400 TypeFeedbackId id) { |
| 392 AllowDeferredHandleDereference embedding_raw_address; | 401 AllowDeferredHandleDereference embedding_raw_address; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 524 |
| 516 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 525 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 517 // [disp/r] | 526 // [disp/r] |
| 518 set_modrm(0, ebp); | 527 set_modrm(0, ebp); |
| 519 set_dispr(disp, rmode); | 528 set_dispr(disp, rmode); |
| 520 } | 529 } |
| 521 | 530 |
| 522 } } // namespace v8::internal | 531 } } // namespace v8::internal |
| 523 | 532 |
| 524 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 533 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |