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 26 matching lines...) Expand all Loading... |
37 enum Major { | 37 enum Major { |
38 CallFunction, | 38 CallFunction, |
39 GenericBinaryOp, | 39 GenericBinaryOp, |
40 SmiOp, | 40 SmiOp, |
41 Compare, | 41 Compare, |
42 RecordWrite, // Last stub that allows stub calls inside. | 42 RecordWrite, // Last stub that allows stub calls inside. |
43 StackCheck, | 43 StackCheck, |
44 UnarySub, | 44 UnarySub, |
45 RevertToNumber, | 45 RevertToNumber, |
46 ToBoolean, | 46 ToBoolean, |
| 47 Instanceof, |
47 CounterOp, | 48 CounterOp, |
48 ArgumentsAccess, | 49 ArgumentsAccess, |
49 Runtime, | 50 Runtime, |
50 CEntry, | 51 CEntry, |
51 JSEntry, | 52 JSEntry, |
52 GetProperty, // ARM only | 53 GetProperty, // ARM only |
53 SetProperty, // ARM only | 54 SetProperty, // ARM only |
54 InvokeBuiltin, // ARM only | 55 InvokeBuiltin, // ARM only |
55 JSExit, // ARM only | 56 JSExit, // ARM only |
56 NUMBER_OF_IDS | 57 NUMBER_OF_IDS |
(...skipping 18 matching lines...) Expand all Loading... |
75 | 76 |
76 private: | 77 private: |
77 // Generates the assembler code for the stub. | 78 // Generates the assembler code for the stub. |
78 virtual void Generate(MacroAssembler* masm) = 0; | 79 virtual void Generate(MacroAssembler* masm) = 0; |
79 | 80 |
80 // Returns information for computing the number key. | 81 // Returns information for computing the number key. |
81 virtual Major MajorKey() = 0; | 82 virtual Major MajorKey() = 0; |
82 virtual int MinorKey() = 0; | 83 virtual int MinorKey() = 0; |
83 | 84 |
84 // Returns a name for logging/debugging purposes. | 85 // Returns a name for logging/debugging purposes. |
85 virtual const char* GetName() = 0; | 86 virtual const char* GetName() { return MajorName(MajorKey()); } |
86 | 87 |
87 #ifdef DEBUG | 88 #ifdef DEBUG |
88 virtual void Print() { PrintF("%s\n", GetName()); } | 89 virtual void Print() { PrintF("%s\n", GetName()); } |
89 #endif | 90 #endif |
90 | 91 |
91 // Computes the key based on major and minor. | 92 // Computes the key based on major and minor. |
92 uint32_t GetKey() { | 93 uint32_t GetKey() { |
93 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 94 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
94 return MinorKeyBits::encode(MinorKey()) | | 95 return MinorKeyBits::encode(MinorKey()) | |
95 MajorKeyBits::encode(MajorKey()); | 96 MajorKeyBits::encode(MajorKey()); |
96 } | 97 } |
97 | 98 |
98 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } | 99 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } |
99 | 100 |
100 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 101 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
101 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 102 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
102 | 103 |
103 friend class BreakPointIterator; | 104 friend class BreakPointIterator; |
104 }; | 105 }; |
105 | 106 |
106 } } // namespace v8::internal | 107 } } // namespace v8::internal |
107 | 108 |
108 #endif // V8_CODE_STUBS_H_ | 109 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |