| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 CODE_STUB_LIST_ALL(V) \ | 68 CODE_STUB_LIST_ALL(V) \ |
| 69 CODE_STUB_LIST_ARM(V) | 69 CODE_STUB_LIST_ARM(V) |
| 70 | 70 |
| 71 // Stub is base classes of all stubs. | 71 // Stub is base classes of all stubs. |
| 72 class CodeStub BASE_EMBEDDED { | 72 class CodeStub BASE_EMBEDDED { |
| 73 public: | 73 public: |
| 74 enum Major { | 74 enum Major { |
| 75 #define DEF_ENUM(name) name, | 75 #define DEF_ENUM(name) name, |
| 76 CODE_STUB_LIST(DEF_ENUM) | 76 CODE_STUB_LIST(DEF_ENUM) |
| 77 #undef DEF_ENUM | 77 #undef DEF_ENUM |
| 78 NoCache, // marker for stubs that do custom caching |
| 78 NUMBER_OF_IDS | 79 NUMBER_OF_IDS |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 // Retrieve the code for the stub. Generate the code if needed. | 82 // Retrieve the code for the stub. Generate the code if needed. |
| 82 Handle<Code> GetCode(); | 83 Handle<Code> GetCode(); |
| 83 | 84 |
| 84 static Major MajorKeyFromKey(uint32_t key) { | 85 static Major MajorKeyFromKey(uint32_t key) { |
| 85 return static_cast<Major>(MajorKeyBits::decode(key)); | 86 return static_cast<Major>(MajorKeyBits::decode(key)); |
| 86 }; | 87 }; |
| 87 static int MinorKeyFromKey(uint32_t key) { | 88 static int MinorKeyFromKey(uint32_t key) { |
| 88 return MinorKeyBits::decode(key); | 89 return MinorKeyBits::decode(key); |
| 89 }; | 90 }; |
| 90 static const char* MajorName(Major major_key); | 91 static const char* MajorName(Major major_key); |
| 91 | 92 |
| 92 virtual ~CodeStub() {} | 93 virtual ~CodeStub() {} |
| 93 | 94 |
| 95 // Override these methods to provide a custom caching mechanism for |
| 96 // an individual type of code stub. |
| 97 virtual bool GetCustomCache(Code** code_out) { return false; } |
| 98 virtual void SetCustomCache(Code* value) { } |
| 99 virtual bool has_custom_cache() { return false; } |
| 100 |
| 94 protected: | 101 protected: |
| 95 static const int kMajorBits = 5; | 102 static const int kMajorBits = 5; |
| 96 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 103 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
| 97 | 104 |
| 98 private: | 105 private: |
| 99 // Generates the assembler code for the stub. | 106 // Generates the assembler code for the stub. |
| 100 virtual void Generate(MacroAssembler* masm) = 0; | 107 virtual void Generate(MacroAssembler* masm) = 0; |
| 101 | 108 |
| 102 // Returns information for computing the number key. | 109 // Returns information for computing the number key. |
| 103 virtual Major MajorKey() = 0; | 110 virtual Major MajorKey() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 125 | 132 |
| 126 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 133 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
| 127 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 134 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
| 128 | 135 |
| 129 friend class BreakPointIterator; | 136 friend class BreakPointIterator; |
| 130 }; | 137 }; |
| 131 | 138 |
| 132 } } // namespace v8::internal | 139 } } // namespace v8::internal |
| 133 | 140 |
| 134 #endif // V8_CODE_STUBS_H_ | 141 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |