OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_BUILTINS_BUILTINS_H_ | 5 #ifndef V8_BUILTINS_BUILTINS_H_ |
6 #define V8_BUILTINS_BUILTINS_H_ | 6 #define V8_BUILTINS_BUILTINS_H_ |
7 | 7 |
8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
9 #include "src/builtins/builtins-definitions.h" | 9 #include "src/builtins/builtins-definitions.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class Callable; | 15 class Callable; |
16 template <typename T> | 16 template <typename T> |
17 class Handle; | 17 class Handle; |
18 class Isolate; | 18 class Isolate; |
19 | 19 |
20 // Forward declarations. | 20 // Forward declarations. |
| 21 class BailoutId; |
21 class RootVisitor; | 22 class RootVisitor; |
22 enum class InterpreterPushArgsMode : unsigned; | 23 enum class InterpreterPushArgsMode : unsigned; |
23 namespace compiler { | 24 namespace compiler { |
24 class CodeAssemblerState; | 25 class CodeAssemblerState; |
25 } | 26 } |
26 | 27 |
27 class Builtins { | 28 class Builtins { |
28 public: | 29 public: |
29 ~Builtins(); | 30 ~Builtins(); |
30 | 31 |
31 void TearDown(); | 32 void TearDown(); |
32 | 33 |
33 // Garbage collection support. | 34 // Garbage collection support. |
34 void IterateBuiltins(RootVisitor* v); | 35 void IterateBuiltins(RootVisitor* v); |
35 | 36 |
36 // Disassembler support. | 37 // Disassembler support. |
37 const char* Lookup(byte* pc); | 38 const char* Lookup(byte* pc); |
38 | 39 |
39 enum Name : int32_t { | 40 enum Name : int32_t { |
40 #define DEF_ENUM(Name, ...) k##Name, | 41 #define DEF_ENUM(Name, ...) k##Name, |
41 BUILTIN_LIST_ALL(DEF_ENUM) | 42 BUILTIN_LIST_ALL(DEF_ENUM) |
42 #undef DEF_ENUM | 43 #undef DEF_ENUM |
43 builtin_count | 44 builtin_count |
44 }; | 45 }; |
45 | 46 |
| 47 static BailoutId GetContinuationBailoutId(Name name); |
| 48 static Name GetBuiltinFromBailoutId(BailoutId); |
| 49 |
46 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) \ | 50 #define DECLARE_BUILTIN_ACCESSOR(Name, ...) \ |
47 V8_EXPORT_PRIVATE Handle<Code> Name(); | 51 V8_EXPORT_PRIVATE Handle<Code> Name(); |
48 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR) | 52 BUILTIN_LIST_ALL(DECLARE_BUILTIN_ACCESSOR) |
49 #undef DECLARE_BUILTIN_ACCESSOR | 53 #undef DECLARE_BUILTIN_ACCESSOR |
50 | 54 |
51 // Convenience wrappers. | 55 // Convenience wrappers. |
52 Handle<Code> CallFunction( | 56 Handle<Code> CallFunction( |
53 ConvertReceiverMode = ConvertReceiverMode::kAny, | 57 ConvertReceiverMode = ConvertReceiverMode::kAny, |
54 TailCallMode tail_call_mode = TailCallMode::kDisallow); | 58 TailCallMode tail_call_mode = TailCallMode::kDisallow); |
55 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, | 59 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, |
(...skipping 17 matching lines...) Expand all Loading... |
73 } | 77 } |
74 | 78 |
75 Address builtin_address(Name name) { | 79 Address builtin_address(Name name) { |
76 return reinterpret_cast<Address>(&builtins_[name]); | 80 return reinterpret_cast<Address>(&builtins_[name]); |
77 } | 81 } |
78 | 82 |
79 static int GetBuiltinParameterCount(Name name); | 83 static int GetBuiltinParameterCount(Name name); |
80 | 84 |
81 static Callable CallableFor(Isolate* isolate, Name name); | 85 static Callable CallableFor(Isolate* isolate, Name name); |
82 | 86 |
| 87 static int GetStackParameterCount(Isolate* isolate, Name name); |
| 88 |
83 static const char* name(int index); | 89 static const char* name(int index); |
84 | 90 |
85 // Returns the C++ entry point for builtins implemented in C++, and the null | 91 // Returns the C++ entry point for builtins implemented in C++, and the null |
86 // Address otherwise. | 92 // Address otherwise. |
87 static Address CppEntryOf(int index); | 93 static Address CppEntryOf(int index); |
88 | 94 |
89 static bool IsCpp(int index); | 95 static bool IsCpp(int index); |
90 static bool IsApi(int index); | 96 static bool IsApi(int index); |
91 static bool HasCppImplementation(int index); | 97 static bool HasCppImplementation(int index); |
92 | 98 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 friend class Isolate; | 159 friend class Isolate; |
154 friend class SetupIsolateDelegate; | 160 friend class SetupIsolateDelegate; |
155 | 161 |
156 DISALLOW_COPY_AND_ASSIGN(Builtins); | 162 DISALLOW_COPY_AND_ASSIGN(Builtins); |
157 }; | 163 }; |
158 | 164 |
159 } // namespace internal | 165 } // namespace internal |
160 } // namespace v8 | 166 } // namespace v8 |
161 | 167 |
162 #endif // V8_BUILTINS_BUILTINS_H_ | 168 #endif // V8_BUILTINS_BUILTINS_H_ |
OLD | NEW |