説明を見る。00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef V8_CODE_STUBS_H_
00029 #define V8_CODE_STUBS_H_
00030
00031 namespace v8 { namespace internal {
00032
00033
00034
00035 class CodeStub BASE_EMBEDDED {
00036 public:
00037 enum Major {
00038 CallFunction,
00039 GenericBinaryOp,
00040 SmiOp,
00041 Compare,
00042 RecordWrite,
00043 StackCheck,
00044 UnarySub,
00045 RevertToNumber,
00046 ToBoolean,
00047 Instanceof,
00048 CounterOp,
00049 ArgumentsAccess,
00050 Runtime,
00051 CEntry,
00052 JSEntry,
00053 GetProperty,
00054 SetProperty,
00055 InvokeBuiltin,
00056 JSExit,
00057 NUMBER_OF_IDS
00058 };
00059
00060
00061 Handle<Code> GetCode();
00062
00063 static Major MajorKeyFromKey(uint32_t key) {
00064 return static_cast<Major>(MajorKeyBits::decode(key));
00065 };
00066 static int MinorKeyFromKey(uint32_t key) {
00067 return MinorKeyBits::decode(key);
00068 };
00069 static const char* MajorName(Major major_key);
00070
00071 virtual ~CodeStub() {}
00072
00073 protected:
00074 static const int kMajorBits = 5;
00075 static const int kMinorBits = kBitsPerPointer - kMajorBits - kSmiTagSize;
00076
00077 private:
00078
00079 virtual void Generate(MacroAssembler* masm) = 0;
00080
00081
00082 virtual Major MajorKey() = 0;
00083 virtual int MinorKey() = 0;
00084
00085
00086 virtual const char* GetName() { return MajorName(MajorKey()); }
00087
00088 #ifdef DEBUG
00089 virtual void Print() { PrintF("%s\n", GetName()); }
00090 #endif
00091
00092
00093 uint32_t GetKey() {
00094 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
00095 return MinorKeyBits::encode(MinorKey()) |
00096 MajorKeyBits::encode(MajorKey());
00097 }
00098
00099 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; }
00100
00101 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {};
00102 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {};
00103
00104 friend class BreakPointIterator;
00105 };
00106
00107 } }
00108
00109 #endif // V8_CODE_STUBS_H_