interpreter-intrinsics.h 2.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// 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 {
12 13
namespace interpreter {

14 15
// List of supported intrisics, with upper case name, lower case name and
// expected number of arguments (-1 denoting argument count is variable).
16
#define INTRINSICS_LIST(V)                                           \
17 18 19 20
  V(AsyncGeneratorGetAwaitInputOrDebugPos,                           \
    async_generator_get_await_input_or_debug_pos, 1)                 \
  V(AsyncGeneratorReject, async_generator_reject, 2)                 \
  V(AsyncGeneratorResolve, async_generator_resolve, 3)               \
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  V(Call, call, -1)                                                  \
  V(ClassOf, class_of, 1)                                            \
  V(CreateIterResultObject, create_iter_result_object, 2)            \
  V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \
  V(HasProperty, has_property, 2)                                    \
  V(IsArray, is_array, 1)                                            \
  V(IsJSProxy, is_js_proxy, 1)                                       \
  V(IsJSReceiver, is_js_receiver, 1)                                 \
  V(IsSmi, is_smi, 1)                                                \
  V(IsTypedArray, is_typed_array, 1)                                 \
  V(SubString, sub_string, 3)                                        \
  V(ToString, to_string, 1)                                          \
  V(ToLength, to_length, 1)                                          \
  V(ToInteger, to_integer, 1)                                        \
  V(ToNumber, to_number, 1)                                          \
36
  V(ToObject, to_object, 1)
37 38 39

class IntrinsicsHelper {
 public:
40 41 42 43 44 45 46 47
  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);

48
  static bool IsSupported(Runtime::FunctionId function_id);
49 50
  static IntrinsicId FromRuntimeId(Runtime::FunctionId function_id);
  static Runtime::FunctionId ToRuntimeId(IntrinsicId intrinsic_id);
51 52

 private:
53
  DISALLOW_IMPLICIT_CONSTRUCTORS(IntrinsicsHelper);
54 55 56 57 58 59 60
};

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

#endif