OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 return MinorKeyBits::decode(key); | 192 return MinorKeyBits::decode(key); |
193 } | 193 } |
194 | 194 |
195 // Gets the major key from a code object that is a code stub or binary op IC. | 195 // Gets the major key from a code object that is a code stub or binary op IC. |
196 static Major GetMajorKey(Code* code_stub) { | 196 static Major GetMajorKey(Code* code_stub) { |
197 return MajorKeyFromKey(code_stub->stub_key()); | 197 return MajorKeyFromKey(code_stub->stub_key()); |
198 } | 198 } |
199 | 199 |
200 static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); } | 200 static uint32_t NoCacheKey() { return MajorKeyBits::encode(NoCache); } |
201 | 201 |
202 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 202 static const char* MajorName(Major major_key); |
203 | 203 |
204 explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {} | 204 explicit CodeStub(Isolate* isolate) : minor_key_(0), isolate_(isolate) {} |
205 virtual ~CodeStub() {} | 205 virtual ~CodeStub() {} |
206 | 206 |
207 static void GenerateStubsAheadOfTime(Isolate* isolate); | 207 static void GenerateStubsAheadOfTime(Isolate* isolate); |
208 static void GenerateFPStubs(Isolate* isolate); | 208 static void GenerateFPStubs(Isolate* isolate); |
209 | 209 |
210 // Some stubs put untagged junk on the stack that cannot be scanned by the | 210 // Some stubs put untagged junk on the stack that cannot be scanned by the |
211 // GC. This means that we must be statically sure that no GC can occur while | 211 // GC. This means that we must be statically sure that no GC can occur while |
212 // they are running. If that is the case they should override this to return | 212 // they are running. If that is the case they should override this to return |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; | 309 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; |
310 class MinorKeyBits: public BitField<uint32_t, | 310 class MinorKeyBits: public BitField<uint32_t, |
311 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT | 311 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT |
312 | 312 |
313 friend class BreakPointIterator; | 313 friend class BreakPointIterator; |
314 | 314 |
315 Isolate* isolate_; | 315 Isolate* isolate_; |
316 }; | 316 }; |
317 | 317 |
318 | 318 |
319 // TODO(svenpanne) This class is only used to construct a more or less sensible | |
320 // CompilationInfo for testing purposes, basically pretending that we are | |
321 // currently compiling some kind of code stub. Remove this when the pipeline and | |
322 // testing machinery is restructured in such a way that we don't have to come up | |
323 // with a CompilationInfo out of thin air, although we only need a few parts of | |
324 // it. | |
325 struct FakeStubForTesting : public CodeStub { | |
326 explicit FakeStubForTesting(Isolate* isolate) : CodeStub(isolate) {} | |
327 | |
328 // Only used by pipeline.cc's GetDebugName in DEBUG mode. | |
329 Major MajorKey() const override { return CodeStub::NoCache; } | |
330 | |
331 CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { | |
332 return ContextOnlyDescriptor(isolate()); | |
333 } | |
334 | |
335 Handle<Code> GenerateCode() override { | |
336 UNREACHABLE(); | |
337 return Handle<Code>(); | |
338 } | |
339 }; | |
340 | |
341 | |
342 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \ | 319 #define DEFINE_CODE_STUB_BASE(NAME, SUPER) \ |
343 public: \ | 320 public: \ |
344 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ | 321 NAME(uint32_t key, Isolate* isolate) : SUPER(key, isolate) {} \ |
345 \ | 322 \ |
346 private: \ | 323 private: \ |
347 DISALLOW_COPY_AND_ASSIGN(NAME) | 324 DISALLOW_COPY_AND_ASSIGN(NAME) |
348 | 325 |
349 | 326 |
350 #define DEFINE_CODE_STUB(NAME, SUPER) \ | 327 #define DEFINE_CODE_STUB(NAME, SUPER) \ |
351 protected: \ | 328 protected: \ |
(...skipping 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3150 #undef DEFINE_PLATFORM_CODE_STUB | 3127 #undef DEFINE_PLATFORM_CODE_STUB |
3151 #undef DEFINE_HANDLER_CODE_STUB | 3128 #undef DEFINE_HANDLER_CODE_STUB |
3152 #undef DEFINE_HYDROGEN_CODE_STUB | 3129 #undef DEFINE_HYDROGEN_CODE_STUB |
3153 #undef DEFINE_CODE_STUB | 3130 #undef DEFINE_CODE_STUB |
3154 #undef DEFINE_CODE_STUB_BASE | 3131 #undef DEFINE_CODE_STUB_BASE |
3155 | 3132 |
3156 extern Representation RepresentationFromType(Type* type); | 3133 extern Representation RepresentationFromType(Type* type); |
3157 } } // namespace v8::internal | 3134 } } // namespace v8::internal |
3158 | 3135 |
3159 #endif // V8_CODE_STUBS_H_ | 3136 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |