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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 V(RegExpExec) \ | 68 V(RegExpExec) \ |
69 V(RegExpConstructResult) \ | 69 V(RegExpConstructResult) \ |
70 V(NumberToString) \ | 70 V(NumberToString) \ |
71 V(CEntry) \ | 71 V(CEntry) \ |
72 V(JSEntry) \ | 72 V(JSEntry) \ |
73 V(KeyedLoadFastElement) \ | 73 V(KeyedLoadFastElement) \ |
74 V(KeyedStoreFastElement) \ | 74 V(KeyedStoreFastElement) \ |
75 V(KeyedLoadExternalArray) \ | 75 V(KeyedLoadExternalArray) \ |
76 V(KeyedStoreExternalArray) \ | 76 V(KeyedStoreExternalArray) \ |
77 V(DebuggerStatement) \ | 77 V(DebuggerStatement) \ |
78 V(StringDictionaryLookup) | 78 V(StringDictionaryNegativeLookup) |
79 | 79 |
80 // List of code stubs only used on ARM platforms. | 80 // List of code stubs only used on ARM platforms. |
81 #ifdef V8_TARGET_ARCH_ARM | 81 #ifdef V8_TARGET_ARCH_ARM |
82 #define CODE_STUB_LIST_ARM(V) \ | 82 #define CODE_STUB_LIST_ARM(V) \ |
83 V(GetProperty) \ | 83 V(GetProperty) \ |
84 V(SetProperty) \ | 84 V(SetProperty) \ |
85 V(InvokeBuiltin) \ | 85 V(InvokeBuiltin) \ |
86 V(RegExpCEntry) \ | 86 V(RegExpCEntry) \ |
87 V(DirectCEntry) | 87 V(DirectCEntry) |
88 #else | 88 #else |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 // Gets the major key from a code object that is a code stub or binary op IC. | 138 // Gets the major key from a code object that is a code stub or binary op IC. |
139 static Major GetMajorKey(Code* code_stub) { | 139 static Major GetMajorKey(Code* code_stub) { |
140 return static_cast<Major>(code_stub->major_key()); | 140 return static_cast<Major>(code_stub->major_key()); |
141 } | 141 } |
142 | 142 |
143 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 143 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
144 | 144 |
145 virtual ~CodeStub() {} | 145 virtual ~CodeStub() {} |
146 | 146 |
147 // See comment above, where Instanceof is defined. | |
148 virtual bool CompilingCallsToThisStubIsGCSafe() { | |
149 return MajorKey() <= Instanceof; | |
150 } | |
151 | |
152 virtual bool SometimesSetsUpAFrame() { return true; } | |
153 | |
154 protected: | 147 protected: |
155 static const int kMajorBits = 6; | 148 static const int kMajorBits = 6; |
156 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; | 149 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; |
157 | 150 |
158 private: | 151 private: |
159 // Lookup the code in the (possibly custom) cache. | 152 // Lookup the code in the (possibly custom) cache. |
160 bool FindCodeInCache(Code** code_out); | 153 bool FindCodeInCache(Code** code_out); |
161 | 154 |
162 // Nonvirtual wrapper around the stub-specific Generate function. Call | 155 // Nonvirtual wrapper around the stub-specific Generate function. Call |
163 // this function to set up the macro assembler and generate the code. | 156 // this function to set up the macro assembler and generate the code. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 virtual void Print() { PrintF("%s\n", GetName()); } | 193 virtual void Print() { PrintF("%s\n", GetName()); } |
201 #endif | 194 #endif |
202 | 195 |
203 // Computes the key based on major and minor. | 196 // Computes the key based on major and minor. |
204 uint32_t GetKey() { | 197 uint32_t GetKey() { |
205 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 198 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
206 return MinorKeyBits::encode(MinorKey()) | | 199 return MinorKeyBits::encode(MinorKey()) | |
207 MajorKeyBits::encode(MajorKey()); | 200 MajorKeyBits::encode(MajorKey()); |
208 } | 201 } |
209 | 202 |
| 203 // See comment above, where Instanceof is defined. |
| 204 bool AllowsStubCalls() { return MajorKey() <= Instanceof; } |
| 205 |
210 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 206 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
211 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 207 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
212 | 208 |
213 friend class BreakPointIterator; | 209 friend class BreakPointIterator; |
214 }; | 210 }; |
215 | 211 |
216 | 212 |
217 // Helper interface to prepare to/restore after making runtime calls. | 213 // Helper interface to prepare to/restore after making runtime calls. |
218 class RuntimeCallHelper { | 214 class RuntimeCallHelper { |
219 public: | 215 public: |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 568 |
573 | 569 |
574 class CEntryStub : public CodeStub { | 570 class CEntryStub : public CodeStub { |
575 public: | 571 public: |
576 explicit CEntryStub(int result_size) | 572 explicit CEntryStub(int result_size) |
577 : result_size_(result_size), save_doubles_(false) { } | 573 : result_size_(result_size), save_doubles_(false) { } |
578 | 574 |
579 void Generate(MacroAssembler* masm); | 575 void Generate(MacroAssembler* masm); |
580 void SaveDoubles() { save_doubles_ = true; } | 576 void SaveDoubles() { save_doubles_ = true; } |
581 | 577 |
582 // The version of this stub that doesn't save doubles is generated ahead of | |
583 // time, so it's OK to call it from other stubs that can't cope with GC during | |
584 // their code generation. | |
585 virtual bool CompilingCallsToThisStubIsGCSafe() { return !save_doubles_; } | |
586 | |
587 private: | 578 private: |
588 void GenerateCore(MacroAssembler* masm, | 579 void GenerateCore(MacroAssembler* masm, |
589 Label* throw_normal_exception, | 580 Label* throw_normal_exception, |
590 Label* throw_termination_exception, | 581 Label* throw_termination_exception, |
591 Label* throw_out_of_memory_exception, | 582 Label* throw_out_of_memory_exception, |
592 bool do_gc, | 583 bool do_gc, |
593 bool always_allocate_scope); | 584 bool always_allocate_scope); |
594 void GenerateThrowTOS(MacroAssembler* masm); | 585 void GenerateThrowTOS(MacroAssembler* masm); |
595 void GenerateThrowUncatchable(MacroAssembler* masm, | 586 void GenerateThrowUncatchable(MacroAssembler* masm, |
596 UncatchableExceptionType type); | 587 UncatchableExceptionType type); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) | 1008 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) |
1018 | 1009 |
1019 protected: | 1010 protected: |
1020 ExternalArrayType array_type_; | 1011 ExternalArrayType array_type_; |
1021 }; | 1012 }; |
1022 | 1013 |
1023 | 1014 |
1024 } } // namespace v8::internal | 1015 } } // namespace v8::internal |
1025 | 1016 |
1026 #endif // V8_CODE_STUBS_H_ | 1017 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |