Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: src/interpreter/interpreter-intrinsics.h

Issue 2759093004: [interpreter] Split out intrinsics generation (Closed)
Patch Set: rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter-generator.cc ('k') | src/interpreter/interpreter-intrinsics.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_INTERPRETER_INTERPRETER_INTRINSICS_H_ 5 #ifndef V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
6 #define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_ 6 #define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
7 7
8 #include "src/allocation.h"
9 #include "src/builtins/builtins.h"
10 #include "src/frames.h"
11 #include "src/interpreter/bytecodes.h"
12 #include "src/interpreter/interpreter-assembler.h"
13 #include "src/runtime/runtime.h" 8 #include "src/runtime/runtime.h"
14 9
15 namespace v8 { 10 namespace v8 {
16 namespace internal { 11 namespace internal {
17
18 namespace compiler {
19 class Node;
20 } // namespace compiler
21
22 namespace interpreter { 12 namespace interpreter {
23 13
24 // List of supported intrisics, with upper case name, lower case name and 14 // List of supported intrisics, with upper case name, lower case name and
25 // expected number of arguments (-1 denoting argument count is variable). 15 // expected number of arguments (-1 denoting argument count is variable).
26 #define INTRINSICS_LIST(V) \ 16 #define INTRINSICS_LIST(V) \
27 V(Call, call, -1) \ 17 V(Call, call, -1) \
28 V(ClassOf, class_of, 1) \ 18 V(ClassOf, class_of, 1) \
29 V(CreateIterResultObject, create_iter_result_object, 2) \ 19 V(CreateIterResultObject, create_iter_result_object, 2) \
30 V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \ 20 V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \
31 V(HasProperty, has_property, 2) \ 21 V(HasProperty, has_property, 2) \
(...skipping 12 matching lines...) Expand all
44 class IntrinsicsHelper { 34 class IntrinsicsHelper {
45 public: 35 public:
46 enum class IntrinsicId { 36 enum class IntrinsicId {
47 #define DECLARE_INTRINSIC_ID(name, lower_case, count) k##name, 37 #define DECLARE_INTRINSIC_ID(name, lower_case, count) k##name,
48 INTRINSICS_LIST(DECLARE_INTRINSIC_ID) 38 INTRINSICS_LIST(DECLARE_INTRINSIC_ID)
49 #undef DECLARE_INTRINSIC_ID 39 #undef DECLARE_INTRINSIC_ID
50 kIdCount 40 kIdCount
51 }; 41 };
52 STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8); 42 STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8);
53 43
54 explicit IntrinsicsHelper(InterpreterAssembler* assembler);
55
56 compiler::Node* InvokeIntrinsic(compiler::Node* function_id,
57 compiler::Node* context,
58 compiler::Node* first_arg_reg,
59 compiler::Node* arg_count);
60
61 static bool IsSupported(Runtime::FunctionId function_id); 44 static bool IsSupported(Runtime::FunctionId function_id);
62 static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id); 45 static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id);
63 static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id); 46 static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id);
64 47
65 private: 48 private:
66 enum InstanceTypeCompareMode { 49 DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper);
67 kInstanceTypeEqual,
68 kInstanceTypeGreaterThanOrEqual
69 };
70
71 compiler::Node* IsInstanceType(compiler::Node* input, int type);
72 compiler::Node* CompareInstanceType(compiler::Node* map, int type,
73 InstanceTypeCompareMode mode);
74 compiler::Node* IntrinsicAsStubCall(compiler::Node* input,
75 compiler::Node* context,
76 Callable const& callable);
77 void AbortIfArgCountMismatch(int expected, compiler::Node* actual);
78
79 #define DECLARE_INTRINSIC_HELPER(name, lower_case, count) \
80 compiler::Node* name(compiler::Node* input, compiler::Node* arg_count, \
81 compiler::Node* context);
82 INTRINSICS_LIST(DECLARE_INTRINSIC_HELPER)
83 #undef DECLARE_INTRINSIC_HELPER
84
85 Isolate* isolate() { return isolate_; }
86 Zone* zone() { return zone_; }
87
88 Isolate* isolate_;
89 Zone* zone_;
90 InterpreterAssembler* assembler_;
91
92 DISALLOW_COPY_AND_ASSIGN(IntrinsicsHelper);
93 }; 50 };
94 51
95 } // namespace interpreter 52 } // namespace interpreter
96 } // namespace internal 53 } // namespace internal
97 } // namespace v8 54 } // namespace v8
98 55
99 #endif 56 #endif
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-generator.cc ('k') | src/interpreter/interpreter-intrinsics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698