author | Eric Faust <efaustbmo@gmail.com> |
Tue, 09 Sep 2014 12:09:46 -0700 | |
changeset 204326 | ae18d60bbd2a85840ece1a3914a6bbbc252b80e1 |
parent 204325 | abd86c308ffe8e162e2625b0bc7cf261eff05030 |
child 204327 | dbe4506596429ffc2542fac7f452ed872638be6f |
push id | 48890 |
push user | efaustbmo@gmail.com |
push date | Tue, 09 Sep 2014 19:11:46 +0000 |
treeherder | mozilla-inbound@af39f6ba880b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bholley |
bugs | 1031092 |
milestone | 35.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/src/moz.build | file | annotate | diff | comparison | revisions | |
js/src/proxy/Proxy.cpp | file | annotate | diff | comparison | revisions | |
js/src/proxy/Proxy.h | file | annotate | diff | comparison | revisions | |
js/src/proxy/jsproxy.cpp | file | annotate | diff | comparison | revisions | |
js/src/proxy/jsproxy.h | file | annotate | diff | comparison | revisions | |
js/src/vm/CallNonGenericMethod.cpp | file | annotate | diff | comparison | revisions | |
js/src/vm/ObjectImpl-inl.h | file | annotate | diff | comparison | revisions | |
js/src/vm/RegExpObject.h | file | annotate | diff | comparison | revisions |
--- a/js/src/moz.build +++ b/js/src/moz.build @@ -228,17 +228,17 @@ UNIFIED_SOURCES += [ 'jsstr.cpp', 'jswatchpoint.cpp', 'jsweakmap.cpp', 'jswrapper.cpp', 'perf/jsperf.cpp', 'prmjtime.cpp', 'proxy/BaseProxyHandler.cpp', 'proxy/DirectProxyHandler.cpp', - 'proxy/jsproxy.cpp', + 'proxy/Proxy.cpp', 'proxy/ScriptedDirectProxyHandler.cpp', 'proxy/ScriptedIndirectProxyHandler.cpp', 'vm/ArgumentsObject.cpp', 'vm/ArrayBufferObject.cpp', 'vm/CallNonGenericMethod.cpp', 'vm/CharacterEncoding.cpp', 'vm/Compression.cpp', 'vm/DateTime.cpp',
new file mode 100644 --- /dev/null +++ b/js/src/proxy/Proxy.h @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sts=4 et sw=4 tw=99: + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef proxy_Proxy_h +#define proxy_Proxy_h + +#include "NamespaceImports.h" + +#include "js/Class.h" + +namespace js { + +class RegExpGuard; + +/* + * Dispatch point for handlers that executes the appropriate C++ or scripted traps. + * + * Important: All proxy traps need either (a) an AutoEnterPolicy in their + * Proxy::foo entry point below or (b) an override in SecurityWrapper. See bug + * 945826 comment 0. + */ +class Proxy +{ + public: + /* ES5 Harmony fundamental proxy traps. */ + static bool preventExtensions(JSContext *cx, HandleObject proxy); + static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + MutableHandle<JSPropertyDescriptor> desc); + static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + MutableHandleValue vp); + static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + MutableHandle<JSPropertyDescriptor> desc); + static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + MutableHandleValue vp); + static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, + MutableHandle<JSPropertyDescriptor> desc); + static bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props); + static bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + static bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props); + + /* ES5 Harmony derived proxy traps. */ + static bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + static bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); + static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, + MutableHandleValue vp); + static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, + bool strict, MutableHandleValue vp); + static bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props); + static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); + + /* Spidermonkey extensions. */ + static bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible); + static bool call(JSContext *cx, HandleObject proxy, const CallArgs &args); + static bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args); + static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); + static bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); + static bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx); + static const char *className(JSContext *cx, HandleObject proxy); + static JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); + static bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); + static bool boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp); + static bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); + static bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); + static bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); + + static bool watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable); + static bool unwatch(JSContext *cx, HandleObject proxy, HandleId id); + + static bool slice(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end, + HandleObject result); + + /* IC entry path for handling __noSuchMethod__ on access. */ + static bool callProp(JSContext *cx, HandleObject proxy, HandleObject reveiver, HandleId id, + MutableHandleValue vp); +}; + +} /* namespace js */ + +#endif /* proxy_Proxy_h */
--- a/js/src/proxy/jsproxy.h +++ b/js/src/proxy/jsproxy.h @@ -303,78 +303,16 @@ class JS_PUBLIC_API(DirectProxyHandler) virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent) const MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual bool boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp) const; virtual JSObject *weakmapKeyDelegate(JSObject *proxy) const MOZ_OVERRIDE; }; -/* - * Dispatch point for handlers that executes the appropriate C++ or scripted traps. - * - * Important: All proxy traps need either (a) an AutoEnterPolicy in their - * Proxy::foo entry point below or (b) an override in SecurityWrapper. See bug - * 945826 comment 0. - */ -class Proxy -{ - public: - /* ES5 Harmony fundamental proxy traps. */ - static bool preventExtensions(JSContext *cx, HandleObject proxy); - static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle<JSPropertyDescriptor> desc); - static bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandleValue vp); - static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle<JSPropertyDescriptor> desc); - static bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandleValue vp); - static bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, - MutableHandle<JSPropertyDescriptor> desc); - static bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props); - static bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); - static bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props); - - /* ES5 Harmony derived proxy traps. */ - static bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); - static bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp); - static bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - MutableHandleValue vp); - static bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, - bool strict, MutableHandleValue vp); - static bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props); - static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); - - /* Spidermonkey extensions. */ - static bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible); - static bool call(JSContext *cx, HandleObject proxy, const CallArgs &args); - static bool construct(JSContext *cx, HandleObject proxy, const CallArgs &args); - static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); - static bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); - static bool objectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx); - static const char *className(JSContext *cx, HandleObject proxy); - static JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); - static bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); - static bool boxedValue_unbox(JSContext *cx, HandleObject proxy, MutableHandleValue vp); - static bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); - static bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - static bool setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp); - - static bool watch(JSContext *cx, HandleObject proxy, HandleId id, HandleObject callable); - static bool unwatch(JSContext *cx, HandleObject proxy, HandleId id); - - static bool slice(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end, - HandleObject result); - - /* IC entry path for handling __noSuchMethod__ on access. */ - static bool callProp(JSContext *cx, HandleObject proxy, HandleObject reveiver, HandleId id, - MutableHandleValue vp); -}; - // Use these in places where you don't want to #include vm/ProxyObject.h. extern JS_FRIEND_DATA(const js::Class* const) CallableProxyClassPtr; extern JS_FRIEND_DATA(const js::Class* const) UncallableProxyClassPtr; inline bool IsProxy(JSObject *obj) { return GetObjectClass(obj)->isProxy(); }
--- a/js/src/vm/CallNonGenericMethod.cpp +++ b/js/src/vm/CallNonGenericMethod.cpp @@ -4,16 +4,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "js/CallNonGenericMethod.h" #include "jsfun.h" #include "jsobj.h" +#include "proxy/Proxy.h" #include "vm/ProxyObject.h" using namespace js; bool JS::detail::CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) {
--- a/js/src/vm/ObjectImpl-inl.h +++ b/js/src/vm/ObjectImpl-inl.h @@ -5,18 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef vm_ObjectImpl_inl_h #define vm_ObjectImpl_inl_h #include "vm/ObjectImpl.h" #include "jscntxt.h" -#include "jsproxy.h" +#include "proxy/Proxy.h" #include "vm/ProxyObject.h" #include "vm/TypedArrayObject.h" namespace js { /* static */ inline bool ObjectImpl::isExtensible(ExclusiveContext *cx, Handle<ObjectImpl*> obj, bool *extensible) {
--- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -6,20 +6,20 @@ #ifndef vm_RegExpObject_h #define vm_RegExpObject_h #include "mozilla/Attributes.h" #include "mozilla/MemoryReporting.h" #include "jscntxt.h" -#include "jsproxy.h" #include "gc/Marking.h" #include "gc/Zone.h" +#include "proxy/Proxy.h" #include "vm/Shape.h" /* * JavaScript Regular Expressions * * There are several engine concepts associated with a single logical regexp: * * RegExpObject - The JS-visible object whose .[[Class]] equals "RegExp"