| 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 | |
| 79 NUMBER_OF_IDS | 78 NUMBER_OF_IDS |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 // Retrieve the code for the stub. Generate the code if needed. | 81 // Retrieve the code for the stub. Generate the code if needed. |
| 83 Handle<Code> GetCode(); | 82 Handle<Code> GetCode(); |
| 84 | 83 |
| 85 static Major MajorKeyFromKey(uint32_t key) { | 84 static Major MajorKeyFromKey(uint32_t key) { |
| 86 return static_cast<Major>(MajorKeyBits::decode(key)); | 85 return static_cast<Major>(MajorKeyBits::decode(key)); |
| 87 }; | 86 }; |
| 88 static int MinorKeyFromKey(uint32_t key) { | 87 static int MinorKeyFromKey(uint32_t key) { |
| 89 return MinorKeyBits::decode(key); | 88 return MinorKeyBits::decode(key); |
| 90 }; | 89 }; |
| 91 static const char* MajorName(Major major_key); | 90 static const char* MajorName(Major major_key); |
| 92 | 91 |
| 93 virtual ~CodeStub() {} | 92 virtual ~CodeStub() {} |
| 94 | 93 |
| 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 | |
| 101 protected: | 94 protected: |
| 102 static const int kMajorBits = 5; | 95 static const int kMajorBits = 5; |
| 103 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 96 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
| 104 | 97 |
| 105 private: | 98 private: |
| 106 // Generates the assembler code for the stub. | 99 // Generates the assembler code for the stub. |
| 107 virtual void Generate(MacroAssembler* masm) = 0; | 100 virtual void Generate(MacroAssembler* masm) = 0; |
| 108 | 101 |
| 109 // Returns information for computing the number key. | 102 // Returns information for computing the number key. |
| 110 virtual Major MajorKey() = 0; | 103 virtual Major MajorKey() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 132 | 125 |
| 133 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 126 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
| 134 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 127 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
| 135 | 128 |
| 136 friend class BreakPointIterator; | 129 friend class BreakPointIterator; |
| 137 }; | 130 }; |
| 138 | 131 |
| 139 } } // namespace v8::internal | 132 } } // namespace v8::internal |
| 140 | 133 |
| 141 #endif // V8_CODE_STUBS_H_ | 134 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |