OLD | NEW |
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/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace interpreter { | 12 namespace interpreter { |
13 | 13 |
14 // 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 |
15 // expected number of arguments (-1 denoting argument count is variable). | 15 // expected number of arguments (-1 denoting argument count is variable). |
16 #define INTRINSICS_LIST(V) \ | 16 #define INTRINSICS_LIST(V) \ |
17 V(AsyncGeneratorGetAwaitInputOrDebugPos, \ | 17 V(AsyncGeneratorGetAwaitInputOrDebugPos, \ |
18 async_generator_get_await_input_or_debug_pos, 1) \ | 18 async_generator_get_await_input_or_debug_pos, 1) \ |
19 V(AsyncGeneratorReject, async_generator_reject, 2) \ | 19 V(AsyncGeneratorReject, async_generator_reject, 2) \ |
20 V(AsyncGeneratorResolve, async_generator_resolve, 3) \ | 20 V(AsyncGeneratorResolve, async_generator_resolve, 3) \ |
21 V(CreateJSGeneratorObject, create_js_generator_object, 2) \ | 21 V(CreateJSGeneratorObject, create_js_generator_object, 2) \ |
22 V(Call, call, -1) \ | 22 V(GeneratorGetContext, generator_get_context, 1) \ |
23 V(ClassOf, class_of, 1) \ | 23 V(GeneratorGetResumeMode, generator_get_resume_mode, 1) \ |
24 V(CreateIterResultObject, create_iter_result_object, 2) \ | 24 V(GeneratorGetInputOrDebugPos, generator_get_input_or_debug_pos, 1) \ |
25 V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \ | 25 V(Call, call, -1) \ |
26 V(HasProperty, has_property, 2) \ | 26 V(ClassOf, class_of, 1) \ |
27 V(IsArray, is_array, 1) \ | 27 V(CreateIterResultObject, create_iter_result_object, 2) \ |
28 V(IsJSMap, is_js_map, 1) \ | 28 V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \ |
29 V(IsJSMapIterator, is_js_map_iterator, 1) \ | 29 V(HasProperty, has_property, 2) \ |
30 V(IsJSProxy, is_js_proxy, 1) \ | 30 V(IsArray, is_array, 1) \ |
31 V(IsJSReceiver, is_js_receiver, 1) \ | 31 V(IsJSMap, is_js_map, 1) \ |
32 V(IsJSSet, is_js_set, 1) \ | 32 V(IsJSMapIterator, is_js_map_iterator, 1) \ |
33 V(IsJSSetIterator, is_js_set_iterator, 1) \ | 33 V(IsJSProxy, is_js_proxy, 1) \ |
34 V(IsJSWeakMap, is_js_weak_map, 1) \ | 34 V(IsJSReceiver, is_js_receiver, 1) \ |
35 V(IsJSWeakSet, is_js_weak_set, 1) \ | 35 V(IsJSSet, is_js_set, 1) \ |
36 V(IsSmi, is_smi, 1) \ | 36 V(IsJSSetIterator, is_js_set_iterator, 1) \ |
37 V(IsTypedArray, is_typed_array, 1) \ | 37 V(IsJSWeakMap, is_js_weak_map, 1) \ |
38 V(SubString, sub_string, 3) \ | 38 V(IsJSWeakSet, is_js_weak_set, 1) \ |
39 V(ToString, to_string, 1) \ | 39 V(IsSmi, is_smi, 1) \ |
40 V(ToLength, to_length, 1) \ | 40 V(IsTypedArray, is_typed_array, 1) \ |
41 V(ToInteger, to_integer, 1) \ | 41 V(SubString, sub_string, 3) \ |
42 V(ToNumber, to_number, 1) \ | 42 V(ToString, to_string, 1) \ |
| 43 V(ToLength, to_length, 1) \ |
| 44 V(ToInteger, to_integer, 1) \ |
| 45 V(ToNumber, to_number, 1) \ |
43 V(ToObject, to_object, 1) | 46 V(ToObject, to_object, 1) |
44 | 47 |
45 class IntrinsicsHelper { | 48 class IntrinsicsHelper { |
46 public: | 49 public: |
47 enum class IntrinsicId { | 50 enum class IntrinsicId { |
48 #define DECLARE_INTRINSIC_ID(name, lower_case, count) k##name, | 51 #define DECLARE_INTRINSIC_ID(name, lower_case, count) k##name, |
49 INTRINSICS_LIST(DECLARE_INTRINSIC_ID) | 52 INTRINSICS_LIST(DECLARE_INTRINSIC_ID) |
50 #undef DECLARE_INTRINSIC_ID | 53 #undef DECLARE_INTRINSIC_ID |
51 kIdCount | 54 kIdCount |
52 }; | 55 }; |
53 STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8); | 56 STATIC_ASSERT(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8); |
54 | 57 |
55 static bool IsSupported(Runtime::FunctionId function_id); | 58 static bool IsSupported(Runtime::FunctionId function_id); |
56 static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id); | 59 static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id); |
57 static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id); | 60 static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id); |
58 | 61 |
59 private: | 62 private: |
60 DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper); | 63 DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper); |
61 }; | 64 }; |
62 | 65 |
63 } // namespace interpreter | 66 } // namespace interpreter |
64 } // namespace internal | 67 } // namespace internal |
65 } // namespace v8 | 68 } // namespace v8 |
66 | 69 |
67 #endif | 70 #endif |
OLD | NEW |