OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #ifndef V8_CODE_STUBS_H_ | 28 #ifndef V8_CODE_STUBS_H_ |
29 #define V8_CODE_STUBS_H_ | 29 #define V8_CODE_STUBS_H_ |
30 | 30 |
31 #include "globals.h" | 31 #include "globals.h" |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 namespace internal { | 34 namespace internal { |
35 | 35 |
36 // List of code stubs used on all platforms. The order in this list is important | 36 // List of code stubs used on all platforms. The order in this list is important |
37 // as only the stubs up to and including RecordWrite allows nested stub calls. | 37 // as only the stubs up to and including Instanceof allows nested stub calls. |
38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
39 V(CallFunction) \ | 39 V(CallFunction) \ |
40 V(GenericBinaryOp) \ | 40 V(GenericBinaryOp) \ |
41 V(TypeRecordingBinaryOp) \ | 41 V(TypeRecordingBinaryOp) \ |
42 V(StringAdd) \ | 42 V(StringAdd) \ |
43 V(StringCharAt) \ | 43 V(StringCharAt) \ |
44 V(SubString) \ | 44 V(SubString) \ |
45 V(StringCompare) \ | 45 V(StringCompare) \ |
46 V(SmiOp) \ | 46 V(SmiOp) \ |
47 V(Compare) \ | 47 V(Compare) \ |
48 V(CompareIC) \ | 48 V(CompareIC) \ |
49 V(MathPow) \ | 49 V(MathPow) \ |
50 V(TranscendentalCache) \ | 50 V(TranscendentalCache) \ |
51 V(RecordWrite) \ | 51 V(Instanceof) \ |
52 V(ConvertToDouble) \ | 52 V(ConvertToDouble) \ |
53 V(WriteInt32ToHeapNumber) \ | 53 V(WriteInt32ToHeapNumber) \ |
54 V(IntegerMod) \ | 54 V(IntegerMod) \ |
55 V(StackCheck) \ | 55 V(StackCheck) \ |
56 V(FastNewClosure) \ | 56 V(FastNewClosure) \ |
57 V(FastNewContext) \ | 57 V(FastNewContext) \ |
58 V(FastCloneShallowArray) \ | 58 V(FastCloneShallowArray) \ |
59 V(GenericUnaryOp) \ | 59 V(GenericUnaryOp) \ |
60 V(RevertToNumber) \ | 60 V(RevertToNumber) \ |
61 V(ToBoolean) \ | 61 V(ToBoolean) \ |
62 V(Instanceof) \ | |
63 V(CounterOp) \ | 62 V(CounterOp) \ |
64 V(ArgumentsAccess) \ | 63 V(ArgumentsAccess) \ |
65 V(RegExpExec) \ | 64 V(RegExpExec) \ |
66 V(RegExpConstructResult) \ | 65 V(RegExpConstructResult) \ |
67 V(NumberToString) \ | 66 V(NumberToString) \ |
68 V(CEntry) \ | 67 V(CEntry) \ |
69 V(JSEntry) \ | 68 V(JSEntry) \ |
70 V(DebuggerStatement) | 69 V(DebuggerStatement) |
71 | 70 |
72 // List of code stubs only used on ARM platforms. | 71 // List of code stubs only used on ARM platforms. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 virtual void Print() { PrintF("%s\n", GetName()); } | 172 virtual void Print() { PrintF("%s\n", GetName()); } |
174 #endif | 173 #endif |
175 | 174 |
176 // Computes the key based on major and minor. | 175 // Computes the key based on major and minor. |
177 uint32_t GetKey() { | 176 uint32_t GetKey() { |
178 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 177 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
179 return MinorKeyBits::encode(MinorKey()) | | 178 return MinorKeyBits::encode(MinorKey()) | |
180 MajorKeyBits::encode(MajorKey()); | 179 MajorKeyBits::encode(MajorKey()); |
181 } | 180 } |
182 | 181 |
183 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } | 182 bool AllowsStubCalls() { return MajorKey() <= Instanceof; } |
184 | 183 |
185 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 184 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
186 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 185 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
187 | 186 |
188 friend class BreakPointIterator; | 187 friend class BreakPointIterator; |
189 }; | 188 }; |
190 | 189 |
191 | 190 |
192 // Helper interface to prepare to/restore after making runtime calls. | 191 // Helper interface to prepare to/restore after making runtime calls. |
193 class RuntimeCallHelper { | 192 class RuntimeCallHelper { |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 void GenerateSlow(MacroAssembler* masm, | 909 void GenerateSlow(MacroAssembler* masm, |
911 const RuntimeCallHelper& call_helper); | 910 const RuntimeCallHelper& call_helper); |
912 | 911 |
913 private: | 912 private: |
914 StringCharCodeAtGenerator char_code_at_generator_; | 913 StringCharCodeAtGenerator char_code_at_generator_; |
915 StringCharFromCodeGenerator char_from_code_generator_; | 914 StringCharFromCodeGenerator char_from_code_generator_; |
916 | 915 |
917 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 916 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
918 }; | 917 }; |
919 | 918 |
| 919 |
| 920 class AllowStubCallsScope { |
| 921 public: |
| 922 AllowStubCallsScope(MacroAssembler* masm, bool allow) |
| 923 : masm_(masm), previous_allow_(masm->allow_stub_calls()) { |
| 924 masm_->set_allow_stub_calls(allow); |
| 925 } |
| 926 ~AllowStubCallsScope() { |
| 927 masm_->set_allow_stub_calls(previous_allow_); |
| 928 } |
| 929 |
| 930 private: |
| 931 MacroAssembler* masm_; |
| 932 bool previous_allow_; |
| 933 |
| 934 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); |
| 935 }; |
| 936 |
920 } } // namespace v8::internal | 937 } } // namespace v8::internal |
921 | 938 |
922 #endif // V8_CODE_STUBS_H_ | 939 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |