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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 75 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
76 | 76 |
77 private: | 77 private: |
78 // Generates the assembler code for the stub. | 78 // Generates the assembler code for the stub. |
79 virtual void Generate(MacroAssembler* masm) = 0; | 79 virtual void Generate(MacroAssembler* masm) = 0; |
80 | 80 |
81 // Returns information for computing the number key. | 81 // Returns information for computing the number key. |
82 virtual Major MajorKey() = 0; | 82 virtual Major MajorKey() = 0; |
83 virtual int MinorKey() = 0; | 83 virtual int MinorKey() = 0; |
84 | 84 |
| 85 // The CallFunctionStub needs to override this so it can encode whether a |
| 86 // lazily generated function should be fully optimized or not. |
| 87 virtual InlineCacheInLoop InLoop() { return NOT_IN_LOOP; } |
| 88 |
85 // Returns a name for logging/debugging purposes. | 89 // Returns a name for logging/debugging purposes. |
86 virtual const char* GetName() { return MajorName(MajorKey()); } | 90 virtual const char* GetName() { return MajorName(MajorKey()); } |
87 | 91 |
88 #ifdef DEBUG | 92 #ifdef DEBUG |
89 virtual void Print() { PrintF("%s\n", GetName()); } | 93 virtual void Print() { PrintF("%s\n", GetName()); } |
90 #endif | 94 #endif |
91 | 95 |
92 // Computes the key based on major and minor. | 96 // Computes the key based on major and minor. |
93 uint32_t GetKey() { | 97 uint32_t GetKey() { |
94 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 98 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
95 return MinorKeyBits::encode(MinorKey()) | | 99 return MinorKeyBits::encode(MinorKey()) | |
96 MajorKeyBits::encode(MajorKey()); | 100 MajorKeyBits::encode(MajorKey()); |
97 } | 101 } |
98 | 102 |
99 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } | 103 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } |
100 | 104 |
101 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 105 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
102 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 106 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
103 | 107 |
104 friend class BreakPointIterator; | 108 friend class BreakPointIterator; |
105 }; | 109 }; |
106 | 110 |
107 } } // namespace v8::internal | 111 } } // namespace v8::internal |
108 | 112 |
109 #endif // V8_CODE_STUBS_H_ | 113 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |