Line data Source code
1 : // Copyright 2017 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 : #ifndef V8_BUILTINS_BUILTINS_PROXY_GEN_H_
6 : #define V8_BUILTINS_BUILTINS_PROXY_GEN_H_
7 :
8 : #include "src/code-stub-assembler.h"
9 : #include "src/objects/js-proxy.h"
10 : #include "torque-generated/builtins-proxy-from-dsl-gen.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 : using compiler::Node;
15 :
16 504 : class ProxiesCodeStubAssembler : public CodeStubAssembler {
17 : public:
18 : explicit ProxiesCodeStubAssembler(compiler::CodeAssemblerState* state)
19 504 : : CodeStubAssembler(state) {}
20 :
21 : // ES6 section 9.5.8 [[Get]] ( P, Receiver )
22 : // name should not be an index.
23 : Node* ProxyGetProperty(Node* context, Node* proxy, Node* name,
24 : Node* receiver);
25 :
26 : // ES6 section 9.5.9 [[Set]] ( P, V, Receiver )
27 : // name should not be an index.
28 : Node* ProxySetProperty(Node* context, Node* proxy, Node* name, Node* value,
29 : Node* receiver);
30 :
31 : Node* AllocateProxy(Node* target, Node* handler, Node* context);
32 : Node* AllocateProxyRevokeFunction(Node* proxy, Node* context);
33 :
34 : // Get JSNewTarget parameter for ProxyConstructor builtin (Torque).
35 : // TODO(v8:9120): Remove this once torque support exists
36 : Node* GetProxyConstructorJSNewTarget();
37 :
38 : protected:
39 : enum ProxyRevokeFunctionContextSlot {
40 : kProxySlot = Context::MIN_CONTEXT_SLOTS,
41 : kProxyContextLength,
42 : };
43 :
44 : Node* AllocateJSArrayForCodeStubArguments(Node* context,
45 : CodeStubArguments& args, Node* argc,
46 : ParameterMode mode);
47 : void CheckHasTrapResult(Node* context, Node* target, Node* proxy, Node* name,
48 : Label* check_passed, Label* if_bailout);
49 :
50 : void CheckGetSetTrapResult(Node* context, Node* target, Node* proxy,
51 : Node* name, Node* trap_result, Label* if_not_found,
52 : JSProxy::AccessKind access_kind);
53 :
54 : private:
55 : Node* CreateProxyRevokeFunctionContext(Node* proxy, Node* native_context);
56 : };
57 :
58 : } // namespace internal
59 : } // namespace v8
60 :
61 : #endif // V8_BUILTINS_BUILTINS_PROXY_GEN_H_
|