summaryrefslogtreecommitdiff
path: root/deps/v8/src/interpreter/interpreter-intrinsics.h
blob: 94ff5e88bbbfb5ce0c33a4b8bc1889ced7c251ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
#define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_

#include "src/runtime/runtime.h"

namespace v8 {
namespace internal {
namespace interpreter {

// List of supported intrisics, with upper case name, lower case name and
// expected number of arguments (-1 denoting argument count is variable).
#define INTRINSICS_LIST(V)                                          \
  V(AsyncFunctionAwaitCaught, async_function_await_caught, 2)       \
  V(AsyncFunctionAwaitUncaught, async_function_await_uncaught, 2)   \
  V(AsyncFunctionEnter, async_function_enter, 2)                    \
  V(AsyncFunctionReject, async_function_reject, 2)                  \
  V(AsyncFunctionResolve, async_function_resolve, 2)                \
  V(AsyncGeneratorAwaitCaught, async_generator_await_caught, 2)     \
  V(AsyncGeneratorAwaitUncaught, async_generator_await_uncaught, 2) \
  V(AsyncGeneratorReject, async_generator_reject, 2)                \
  V(AsyncGeneratorResolve, async_generator_resolve, 3)              \
  V(AsyncGeneratorYield, async_generator_yield, 3)                  \
  V(CreateJSGeneratorObject, create_js_generator_object, 2)         \
  V(GeneratorGetResumeMode, generator_get_resume_mode, 1)           \
  V(GeneratorClose, generator_close, 1)                             \
  V(GetImportMetaObject, get_import_meta_object, 0)                 \
  V(CopyDataProperties, copy_data_properties, 2)                    \
  V(CopyDataPropertiesWithExcludedPropertiesOnStack,                \
    copy_data_properties_with_excluded_properties_on_stack, -1)     \
  V(CreateIterResultObject, create_iter_result_object, 2)           \
  V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1)

class IntrinsicsHelper {
 public:
  enum class IntrinsicId {
#define DECLARE_INTRINSIC_ID(name, lower_case, count) k##name,
    INTRINSICS_LIST(DECLARE_INTRINSIC_ID)
#undef DECLARE_INTRINSIC_ID
        kIdCount
  };
  static_assert(static_cast<uint32_t>(IntrinsicId::kIdCount) <= kMaxUInt8);

  V8_EXPORT_PRIVATE static bool IsSupported(Runtime::FunctionId function_id);
  static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id);
  static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id);

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper);
};

}  // namespace interpreter
}  // namespace internal
}  // namespace v8

#endif  // V8_INTERPRETER_INTERPRETER_INTRINSICS_H_