| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // generate the code if not already generated and instead return a | 93 // generate the code if not already generated and instead return a |
| 94 // retry after GC Failure object. | 94 // retry after GC Failure object. |
| 95 Object* TryGetCode(); | 95 Object* TryGetCode(); |
| 96 | 96 |
| 97 static Major MajorKeyFromKey(uint32_t key) { | 97 static Major MajorKeyFromKey(uint32_t key) { |
| 98 return static_cast<Major>(MajorKeyBits::decode(key)); | 98 return static_cast<Major>(MajorKeyBits::decode(key)); |
| 99 }; | 99 }; |
| 100 static int MinorKeyFromKey(uint32_t key) { | 100 static int MinorKeyFromKey(uint32_t key) { |
| 101 return MinorKeyBits::decode(key); | 101 return MinorKeyBits::decode(key); |
| 102 }; | 102 }; |
| 103 static const char* MajorName(Major major_key); | 103 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
| 104 | 104 |
| 105 virtual ~CodeStub() {} | 105 virtual ~CodeStub() {} |
| 106 | 106 |
| 107 // Override these methods to provide a custom caching mechanism for | 107 // Override these methods to provide a custom caching mechanism for |
| 108 // an individual type of code stub. | 108 // an individual type of code stub. |
| 109 virtual bool GetCustomCache(Code** code_out) { return false; } | 109 virtual bool GetCustomCache(Code** code_out) { return false; } |
| 110 virtual void SetCustomCache(Code* value) { } | 110 virtual void SetCustomCache(Code* value) { } |
| 111 virtual bool has_custom_cache() { return false; } | 111 virtual bool has_custom_cache() { return false; } |
| 112 | 112 |
| 113 protected: | 113 protected: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 131 | 131 |
| 132 // Returns information for computing the number key. | 132 // Returns information for computing the number key. |
| 133 virtual Major MajorKey() = 0; | 133 virtual Major MajorKey() = 0; |
| 134 virtual int MinorKey() = 0; | 134 virtual int MinorKey() = 0; |
| 135 | 135 |
| 136 // The CallFunctionStub needs to override this so it can encode whether a | 136 // The CallFunctionStub needs to override this so it can encode whether a |
| 137 // lazily generated function should be fully optimized or not. | 137 // lazily generated function should be fully optimized or not. |
| 138 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } | 138 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } |
| 139 | 139 |
| 140 // Returns a name for logging/debugging purposes. | 140 // Returns a name for logging/debugging purposes. |
| 141 virtual const char* GetName() { return MajorName(MajorKey()); } | 141 virtual const char* GetName() { return MajorName(MajorKey(), false); } |
| 142 | 142 |
| 143 #ifdef DEBUG | 143 #ifdef DEBUG |
| 144 virtual void Print() { PrintF("%s\n", GetName()); } | 144 virtual void Print() { PrintF("%s\n", GetName()); } |
| 145 #endif | 145 #endif |
| 146 | 146 |
| 147 // Computes the key based on major and minor. | 147 // Computes the key based on major and minor. |
| 148 uint32_t GetKey() { | 148 uint32_t GetKey() { |
| 149 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 149 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
| 150 return MinorKeyBits::encode(MinorKey()) | | 150 return MinorKeyBits::encode(MinorKey()) | |
| 151 MajorKeyBits::encode(MajorKey()); | 151 MajorKeyBits::encode(MajorKey()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } | 154 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } |
| 155 | 155 |
| 156 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 156 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
| 157 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 157 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
| 158 | 158 |
| 159 friend class BreakPointIterator; | 159 friend class BreakPointIterator; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| 163 | 163 |
| 164 #endif // V8_CODE_STUBS_H_ | 164 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |