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 11 namespace v8 { 12 namespace internal { 13 using compiler::Node; 14 15 class ProxiesCodeStubAssembler : public CodeStubAssembler { 16 public: ProxiesCodeStubAssembler(compiler::CodeAssemblerState * state)17 explicit ProxiesCodeStubAssembler(compiler::CodeAssemblerState* state) 18 : CodeStubAssembler(state) {} 19 20 // ES6 section 9.5.8 [[Get]] ( P, Receiver ) 21 // name should not be an index. 22 Node* ProxyGetProperty(Node* context, Node* proxy, Node* name, 23 Node* receiver); 24 25 // ES6 section 9.5.9 [[Set]] ( P, V, Receiver ) 26 // name should not be an index. 27 Node* ProxySetProperty(Node* context, Node* proxy, Node* name, Node* value, 28 Node* receiver); 29 30 protected: 31 enum ProxyRevokeFunctionContextSlot { 32 kProxySlot = Context::MIN_CONTEXT_SLOTS, 33 kProxyContextLength, 34 }; 35 36 void GotoIfRevokedProxy(Node* object, Label* if_proxy_revoked); 37 Node* AllocateProxy(Node* target, Node* handler, Node* context); 38 Node* AllocateJSArrayForCodeStubArguments(Node* context, 39 CodeStubArguments& args, Node* argc, 40 ParameterMode mode); 41 Node* AllocateProxyRevokeFunction(Node* proxy, Node* context); 42 void CheckHasTrapResult(Node* context, Node* target, Node* proxy, Node* name, 43 Label* check_passed, Label* if_bailout); 44 45 void CheckGetSetTrapResult(Node* context, Node* target, Node* proxy, 46 Node* name, Node* trap_result, Label* if_not_found, 47 JSProxy::AccessKind access_kind); 48 49 private: 50 Node* CreateProxyRevokeFunctionContext(Node* proxy, Node* native_context); 51 }; 52 53 } // namespace internal 54 } // namespace v8 55 56 #endif // V8_BUILTINS_BUILTINS_PROXY_GEN_H_ 57