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_FACTORY_H_ | 5 #ifndef V8_CODE_FACTORY_H_ |
6 #define V8_CODE_FACTORY_H_ | 6 #define V8_CODE_FACTORY_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/callable.h" | |
10 #include "src/codegen.h" | 11 #include "src/codegen.h" |
11 #include "src/globals.h" | 12 #include "src/globals.h" |
12 #include "src/interface-descriptors.h" | 13 #include "src/interface-descriptors.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 // Associates a body of code with an interface descriptor. | |
18 class Callable final BASE_EMBEDDED { | |
19 public: | |
20 Callable(Handle<Code> code, CallInterfaceDescriptor descriptor) | |
21 : code_(code), descriptor_(descriptor) {} | |
22 | |
23 Handle<Code> code() const { return code_; } | |
24 CallInterfaceDescriptor descriptor() const { return descriptor_; } | |
25 | |
26 private: | |
27 const Handle<Code> code_; | |
28 const CallInterfaceDescriptor descriptor_; | |
29 }; | |
30 | |
31 class V8_EXPORT_PRIVATE CodeFactory final { | 18 class V8_EXPORT_PRIVATE CodeFactory final { |
32 public: | 19 public: |
33 // CEntryStub has var-args semantics (all the arguments are passed on the | 20 // CEntryStub has var-args semantics (all the arguments are passed on the |
34 // stack and the arguments count is passed via register) which currently | 21 // stack and the arguments count is passed via register) which currently |
35 // can't be expressed in CallInterfaceDescriptor. Therefore only the code | 22 // can't be expressed in CallInterfaceDescriptor. Therefore only the code |
36 // is exported here. | 23 // is exported here. |
37 static Handle<Code> RuntimeCEntry(Isolate* isolate, int result_size = 1); | 24 static Handle<Code> RuntimeCEntry(Isolate* isolate, int result_size = 1); |
38 | 25 |
39 // Initial states for ICs. | 26 // Initial states for ICs. |
40 static Callable LoadIC(Isolate* isolate); | 27 static Callable LoadIC(Isolate* isolate); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 static Callable CallForwardVarargs(Isolate* isolate); | 163 static Callable CallForwardVarargs(Isolate* isolate); |
177 static Callable CallFunctionForwardVarargs(Isolate* isolate); | 164 static Callable CallFunctionForwardVarargs(Isolate* isolate); |
178 static Callable Construct(Isolate* isolate); | 165 static Callable Construct(Isolate* isolate); |
179 static Callable ConstructWithSpread(Isolate* isolate); | 166 static Callable ConstructWithSpread(Isolate* isolate); |
180 static Callable ConstructFunction(Isolate* isolate); | 167 static Callable ConstructFunction(Isolate* isolate); |
181 static Callable CreateIterResultObject(Isolate* isolate); | 168 static Callable CreateIterResultObject(Isolate* isolate); |
182 static Callable HasProperty(Isolate* isolate); | 169 static Callable HasProperty(Isolate* isolate); |
183 static Callable ForInFilter(Isolate* isolate); | 170 static Callable ForInFilter(Isolate* isolate); |
184 | 171 |
185 static Callable InterpreterPushArgsAndCall(Isolate* isolate, | 172 static Callable InterpreterPushArgsAndCall(Isolate* isolate, |
186 TailCallMode tail_call_mode, | 173 TailCallMode tail_call_mode, |
Yang
2017/03/16 11:45:38
Can we extend this for builtins implemented in Mac
jgruber
2017/03/16 12:35:27
Not sure it's beneficial since many (if not most)
| |
187 InterpreterPushArgsMode mode); | 174 InterpreterPushArgsMode mode); |
188 static Callable InterpreterPushArgsAndConstruct(Isolate* isolate, | 175 static Callable InterpreterPushArgsAndConstruct(Isolate* isolate, |
189 InterpreterPushArgsMode mode); | 176 InterpreterPushArgsMode mode); |
190 static Callable InterpreterPushArgsAndConstructArray(Isolate* isolate); | 177 static Callable InterpreterPushArgsAndConstructArray(Isolate* isolate); |
191 static Callable InterpreterCEntry(Isolate* isolate, int result_size = 1); | 178 static Callable InterpreterCEntry(Isolate* isolate, int result_size = 1); |
192 static Callable InterpreterOnStackReplacement(Isolate* isolate); | 179 static Callable InterpreterOnStackReplacement(Isolate* isolate); |
193 | 180 |
194 static Callable ArrayConstructor(Isolate* isolate); | 181 static Callable ArrayConstructor(Isolate* isolate); |
195 static Callable ArrayPush(Isolate* isolate); | 182 static Callable ArrayPush(Isolate* isolate); |
196 static Callable FunctionPrototypeBind(Isolate* isolate); | 183 static Callable FunctionPrototypeBind(Isolate* isolate); |
197 static Callable PromiseHandleReject(Isolate* isolate); | 184 static Callable PromiseHandleReject(Isolate* isolate); |
198 }; | 185 }; |
199 | 186 |
200 } // namespace internal | 187 } // namespace internal |
201 } // namespace v8 | 188 } // namespace v8 |
202 | 189 |
203 #endif // V8_CODE_FACTORY_H_ | 190 #endif // V8_CODE_FACTORY_H_ |
OLD | NEW |