Index: src/interpreter/interpreter-intrinsics.cc |
diff --git a/src/interpreter/interpreter-intrinsics.cc b/src/interpreter/interpreter-intrinsics.cc |
index f961b3b29ad170c0497d736933b8066a86a32e6f..bf1f7d3e4691e85d4c892d7ed759579042f7e728 100644 |
--- a/src/interpreter/interpreter-intrinsics.cc |
+++ b/src/interpreter/interpreter-intrinsics.cc |
@@ -15,6 +15,7 @@ using compiler::Node; |
IntrinsicsHelper::IntrinsicsHelper(InterpreterAssembler* assembler) |
: assembler_(assembler) {} |
+// static |
bool IntrinsicsHelper::IsSupported(Runtime::FunctionId function_id) { |
switch (function_id) { |
#define SUPPORTED(name, lower_case, count) case Runtime::kInline##name: |
@@ -26,6 +27,36 @@ bool IntrinsicsHelper::IsSupported(Runtime::FunctionId function_id) { |
} |
} |
+// static |
+IntrinsicsHelper::IntrinsicId IntrinsicsHelper::FromRuntimeId( |
+ Runtime::FunctionId function_id) { |
+ switch (function_id) { |
+#define TO_RUNTIME_ID(name, lower_case, count) \ |
+ case Runtime::kInline##name: \ |
+ return IntrinsicId::k##name; |
+ INTRINSICS_LIST(TO_RUNTIME_ID) |
+#undef TO_RUNTIME_ID |
+ default: |
+ UNREACHABLE(); |
+ return static_cast<IntrinsicsHelper::IntrinsicId>(-1); |
+ } |
+} |
+ |
+// static |
+Runtime::FunctionId IntrinsicsHelper::ToRuntimeId( |
+ IntrinsicsHelper::IntrinsicId intrinsic_id) { |
+ switch (intrinsic_id) { |
+#define TO_INTRINSIC_ID(name, lower_case, count) \ |
+ case IntrinsicId::k##name: \ |
+ return Runtime::kInline##name; |
+ INTRINSICS_LIST(TO_INTRINSIC_ID) |
+#undef TO_INTRINSIC_ID |
+ default: |
+ UNREACHABLE(); |
+ return static_cast<Runtime::FunctionId>(-1); |
+ } |
+} |
+ |
Node* IntrinsicsHelper::InvokeIntrinsic(Node* function_id, Node* context, |
Node* first_arg_reg, Node* arg_count) { |
InterpreterAssembler::Label abort(assembler_), end(assembler_); |
@@ -42,7 +73,7 @@ Node* IntrinsicsHelper::InvokeIntrinsic(Node* function_id, Node* context, |
#undef LABEL_POINTER |
#define CASE(name, lower_case, count) \ |
- static_cast<int32_t>(Runtime::kInline##name), |
+ static_cast<int32_t>(IntrinsicId::k##name), |
int32_t cases[] = {INTRINSICS_LIST(CASE)}; |
#undef CASE |