• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/codegen/code-stub-assembler.h"
9 #include "src/objects/js-proxy.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 class ProxiesCodeStubAssembler : public CodeStubAssembler {
15  public:
ProxiesCodeStubAssembler(compiler::CodeAssemblerState * state)16   explicit ProxiesCodeStubAssembler(compiler::CodeAssemblerState* state)
17       : CodeStubAssembler(state) {}
18 
19   TNode<JSProxy> AllocateProxy(TNode<Context> context, TNode<JSReceiver> target,
20                                TNode<JSReceiver> handler);
21   TNode<JSFunction> AllocateProxyRevokeFunction(TNode<Context> context,
22                                                 TNode<JSProxy> proxy);
23 
24   void CheckGetSetTrapResult(TNode<Context> context, TNode<JSReceiver> target,
25                              TNode<JSProxy> proxy, TNode<Name> name,
26                              TNode<Object> trap_result,
27                              JSProxy::AccessKind access_kind);
28 
29   void CheckHasTrapResult(TNode<Context> context, TNode<JSReceiver> target,
30                           TNode<JSProxy> proxy, TNode<Name> name);
31 
32   void CheckDeleteTrapResult(TNode<Context> context, TNode<JSReceiver> target,
33                              TNode<JSProxy> proxy, TNode<Name> name);
34 
35   enum ProxyRevokeFunctionContextSlot {
36     kProxySlot = Context::MIN_CONTEXT_SLOTS,
37     kProxyContextLength,
38   };
39 
40  private:
41   TNode<Context> CreateProxyRevokeFunctionContext(
42       TNode<JSProxy> proxy, TNode<NativeContext> native_context);
43 };
44 
45 }  // namespace internal
46 }  // namespace v8
47 
48 #endif  // V8_BUILTINS_BUILTINS_PROXY_GEN_H_
49