Changeset 40879 in webkit for trunk/JavaScriptCore/assembler
- Timestamp:
- Feb 11, 2009, 4:37:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/assembler/AbstractMacroAssembler.h
r40867 r40879 197 197 friend class AbstractMacroAssembler; 198 198 friend class PatchBuffer; 199 200 199 public: 201 200 Label() … … 220 219 friend class AbstractMacroAssembler; 221 220 friend class PatchBuffer; 222 223 221 public: 224 222 DataLabelPtr() … … 243 241 friend class AbstractMacroAssembler; 244 242 friend class PatchBuffer; 245 246 243 public: 247 244 DataLabel32() … … 268 265 template<class AssemblerType_T> 269 266 friend class AbstractMacroAssembler; 270 271 267 public: 272 268 Call() … … 314 310 template<class AssemblerType_T> 315 311 friend class AbstractMacroAssembler; 316 317 312 public: 318 313 Jump() … … 401 396 public: 402 397 CodeLocationCommon() 403 : location(0)398 : m_location(0) 404 399 { 405 400 } … … 416 411 CodeLocationDataLabel32 dataLabel32AtOffset(int offset); 417 412 418 operator bool() { return location; }419 void reset() { location = 0; }413 operator bool() { return m_location; } 414 void reset() { m_location = 0; } 420 415 421 416 protected: 422 417 explicit CodeLocationCommon(void* location) 423 : location(location)424 { 425 } 426 427 void* location;418 : m_location(location) 419 { 420 } 421 422 void* m_location; 428 423 }; 429 424 … … 435 430 friend class CodeLocationJump; 436 431 friend class PatchBuffer; 437 438 432 public: 439 433 CodeLocationLabel() … … 441 435 } 442 436 443 void* addressForSwitch() { return this-> location; }444 void* addressForExceptionHandler() { return this-> location; }445 void* addressForJSR() { return this-> location; }437 void* addressForSwitch() { return this->m_location; } 438 void* addressForExceptionHandler() { return this->m_location; } 439 void* addressForJSR() { return this->m_location; } 446 440 447 441 private: … … 451 445 } 452 446 453 void* getJumpDestination() { return this-> location; }447 void* getJumpDestination() { return this->m_location; } 454 448 }; 455 449 … … 467 461 void relink(CodeLocationLabel destination) 468 462 { 469 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this->location), destination.location); 470 } 471 472 private: 473 explicit CodeLocationJump(void* location) : CodeLocationCommon(location) {} 463 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this->m_location), destination.m_location); 464 } 465 466 private: 467 explicit CodeLocationJump(void* location) 468 : CodeLocationCommon(location) 469 { 470 } 474 471 }; 475 472 … … 488 485 void relink(FunctionSig* function) 489 486 { 490 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this-> location), reinterpret_cast<void*>(function));487 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this->m_location), reinterpret_cast<void*>(function)); 491 488 } 492 489 … … 495 492 void* calleeReturnAddressValue() 496 493 { 497 return this->location; 498 } 499 500 private: 501 explicit CodeLocationCall(void* location) : CodeLocationCommon(location) {} 494 return this->m_location; 495 } 496 497 private: 498 explicit CodeLocationCall(void* location) 499 : CodeLocationCommon(location) 500 { 501 } 502 502 }; 503 503 … … 515 515 void repatch(int32_t value) 516 516 { 517 AssemblerType::patchImmediate(reinterpret_cast<intptr_t>(this->location), value); 518 } 519 520 private: 521 explicit CodeLocationDataLabel32(void* location) : CodeLocationCommon(location) {} 517 AssemblerType::patchImmediate(reinterpret_cast<intptr_t>(this->m_location), value); 518 } 519 520 private: 521 explicit CodeLocationDataLabel32(void* location) 522 : CodeLocationCommon(location) 523 { 524 } 522 525 }; 523 526 … … 535 538 void repatch(void* value) 536 539 { 537 AssemblerType::patchPointer(reinterpret_cast<intptr_t>(this->location), reinterpret_cast<intptr_t>(value)); 538 } 539 540 private: 541 explicit CodeLocationDataLabelPtr(void* location) : CodeLocationCommon(location) {} 540 AssemblerType::patchPointer(reinterpret_cast<intptr_t>(this->m_location), reinterpret_cast<intptr_t>(value)); 541 } 542 543 private: 544 explicit CodeLocationDataLabelPtr(void* location) 545 : CodeLocationCommon(location) 546 { 547 } 542 548 }; 543 549 … … 547 553 class ProcessorReturnAddress { 548 554 public: 549 ProcessorReturnAddress(void* location) : location(location) {} 550 555 ProcessorReturnAddress(void* location) 556 : m_location(location) 557 { 558 } 559 551 560 template<typename FunctionSig> 552 561 void relinkCallerToFunction(FunctionSig* newCalleeFunction) 553 562 { 554 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this-> location), reinterpret_cast<void*>(newCalleeFunction));563 AssemblerType::patchBranchOffset(reinterpret_cast<intptr_t>(this->m_location), reinterpret_cast<void*>(newCalleeFunction)); 555 564 } 556 565 557 566 operator void*() 558 567 { 559 return location;560 } 561 562 private: 563 void* location;568 return m_location; 569 } 570 571 private: 572 void* m_location; 564 573 }; 565 574 … … 625 634 void link(Jump jump, CodeLocationLabel label) 626 635 { 627 AssemblerType::link(m_code, jump.m_jmp, label. location);636 AssemblerType::link(m_code, jump.m_jmp, label.m_location); 628 637 } 629 638 … … 631 640 { 632 641 for (unsigned i = 0; i < list.m_jumps.size(); ++i) 633 AssemblerType::link(m_code, list.m_jumps[i].m_jmp, label. location);642 AssemblerType::link(m_code, list.m_jumps[i].m_jmp, label.m_location); 634 643 } 635 644 … … 728 737 729 738 protected: 730 731 739 AssemblerType m_assembler; 732 740 }; … … 734 742 735 743 template <class AssemblerType> 736 typename AbstractMacroAssembler<AssemblerType>::CodeLocationLabel AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::labelAtOffset(int offset) { 737 return typename AbstractMacroAssembler::CodeLocationLabel(reinterpret_cast<char*>(location) + offset); 744 typename AbstractMacroAssembler<AssemblerType>::CodeLocationLabel AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::labelAtOffset(int offset) 745 { 746 return typename AbstractMacroAssembler::CodeLocationLabel(reinterpret_cast<char*>(m_location) + offset); 738 747 } 748 739 749 template <class AssemblerType> 740 typename AbstractMacroAssembler<AssemblerType>::CodeLocationJump AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::jumpAtOffset(int offset) { 741 return typename AbstractMacroAssembler::CodeLocationJump(reinterpret_cast<char*>(location) + offset); 750 typename AbstractMacroAssembler<AssemblerType>::CodeLocationJump AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::jumpAtOffset(int offset) 751 { 752 return typename AbstractMacroAssembler::CodeLocationJump(reinterpret_cast<char*>(m_location) + offset); 742 753 } 754 743 755 template <class AssemblerType> 744 typename AbstractMacroAssembler<AssemblerType>::CodeLocationCall AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::callAtOffset(int offset) { 745 return typename AbstractMacroAssembler::CodeLocationCall(reinterpret_cast<char*>(location) + offset); 756 typename AbstractMacroAssembler<AssemblerType>::CodeLocationCall AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::callAtOffset(int offset) 757 { 758 return typename AbstractMacroAssembler::CodeLocationCall(reinterpret_cast<char*>(m_location) + offset); 746 759 } 760 747 761 template <class AssemblerType> 748 typename AbstractMacroAssembler<AssemblerType>::CodeLocationDataLabelPtr AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::dataLabelPtrAtOffset(int offset) { 749 return typename AbstractMacroAssembler::CodeLocationDataLabelPtr(reinterpret_cast<char*>(location) + offset); 762 typename AbstractMacroAssembler<AssemblerType>::CodeLocationDataLabelPtr AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::dataLabelPtrAtOffset(int offset) 763 { 764 return typename AbstractMacroAssembler::CodeLocationDataLabelPtr(reinterpret_cast<char*>(m_location) + offset); 750 765 } 766 751 767 template <class AssemblerType> 752 typename AbstractMacroAssembler<AssemblerType>::CodeLocationDataLabel32 AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::dataLabel32AtOffset(int offset) { 753 return typename AbstractMacroAssembler::CodeLocationDataLabel32(reinterpret_cast<char*>(location) + offset); 768 typename AbstractMacroAssembler<AssemblerType>::CodeLocationDataLabel32 AbstractMacroAssembler<AssemblerType>::CodeLocationCommon::dataLabel32AtOffset(int offset) 769 { 770 return typename AbstractMacroAssembler::CodeLocationDataLabel32(reinterpret_cast<char*>(m_location) + offset); 754 771 } 755 772
Note:
See TracChangeset
for help on using the changeset viewer.