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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |