blob: 294ba647f03df943b73af6bfdaf3a210789c5d7f [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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/**
6 * This header contains a set of experimental V8 APIs. We hope these will
7 * become a part of standard V8, but they may also be removed if we deem the
8 * experiment to not be successul.
9 */
10#ifndef V8_INCLUDE_V8_EXPERIMENTAL_H_
11#define V8_INCLUDE_V8_EXPERIMENTAL_H_
12
Ben Murdochda12d292016-06-02 14:46:10 +010013#include "v8.h" // NOLINT(build/include)
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000014
15namespace v8 {
16namespace experimental {
17
18// Allow the embedder to construct accessors that V8 can compile and use
19// directly, without jumping into the runtime.
20class V8_EXPORT FastAccessorBuilder {
21 public:
22 struct ValueId {
23 size_t value_id;
24 };
25 struct LabelId {
26 size_t label_id;
27 };
28
29 static FastAccessorBuilder* New(Isolate* isolate);
30
31 ValueId IntegerConstant(int int_constant);
32 ValueId GetReceiver();
33 ValueId LoadInternalField(ValueId value_id, int field_no);
34 ValueId LoadValue(ValueId value_id, int offset);
35 ValueId LoadObject(ValueId value_id, int offset);
36 void ReturnValue(ValueId value_id);
37 void CheckFlagSetOrReturnNull(ValueId value_id, int mask);
38 void CheckNotZeroOrReturnNull(ValueId value_id);
39 LabelId MakeLabel();
40 void SetLabel(LabelId label_id);
41 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id);
Ben Murdoch097c5b22016-05-18 11:27:45 +010042 ValueId Call(v8::FunctionCallback callback, ValueId value_id);
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000043
44 private:
45 FastAccessorBuilder() = delete;
46 FastAccessorBuilder(const FastAccessorBuilder&) = delete;
47 ~FastAccessorBuilder() = delete;
48 void operator=(const FastAccessorBuilder&) = delete;
49};
50
51} // namespace experimental
52} // namespace v8
53
54#endif // V8_INCLUDE_V8_EXPERIMENTAL_H_