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 3 // found in the LICENSE file. 4 5 #include "src/interpreter/interpreter-intrinsics.h" 6 7 #include "src/base/logging.h" 8 9 namespace v8 { 10 namespace internal { 11 namespace interpreter { 12 13 // static IsSupported(Runtime::FunctionId function_id)14bool IntrinsicsHelper::IsSupported(Runtime::FunctionId function_id) { 15 switch (function_id) { 16 #define SUPPORTED(name, lower_case, count) case Runtime::kInline##name: 17 INTRINSICS_LIST(SUPPORTED) 18 return true; 19 #undef SUPPORTED 20 default: 21 return false; 22 } 23 } 24 25 // static FromRuntimeId(Runtime::FunctionId function_id)26IntrinsicsHelper::IntrinsicId IntrinsicsHelper::FromRuntimeId( 27 Runtime::FunctionId function_id) { 28 switch (function_id) { 29 #define TO_RUNTIME_ID(name, lower_case, count) \ 30 case Runtime::kInline##name: \ 31 return IntrinsicId::k##name; 32 INTRINSICS_LIST(TO_RUNTIME_ID) 33 #undef TO_RUNTIME_ID 34 default: 35 UNREACHABLE(); 36 } 37 } 38 39 // static ToRuntimeId(IntrinsicsHelper::IntrinsicId intrinsic_id)40Runtime::FunctionId IntrinsicsHelper::ToRuntimeId( 41 IntrinsicsHelper::IntrinsicId intrinsic_id) { 42 switch (intrinsic_id) { 43 #define TO_INTRINSIC_ID(name, lower_case, count) \ 44 case IntrinsicId::k##name: \ 45 return Runtime::kInline##name; 46 INTRINSICS_LIST(TO_INTRINSIC_ID) 47 #undef TO_INTRINSIC_ID 48 default: 49 UNREACHABLE(); 50 } 51 } 52 53 } // namespace interpreter 54 } // namespace internal 55 } // namespace v8 56