Bug 1508255 - Wrap ES Spec reference comments r=jorendorff
authorTed Campbell <tcampbell@mozilla.com>
Tue, 20 Nov 2018 10:53:32 +0000
changeset 506452 fa3eaa0d2cde35eb9435f6f8455148f9eec5ff4f
parent 506451 5219139e6d0f9fb6c9effc4df73244b8f9dd418c
child 506453 d437391bafa1ec497443aedac9500cbfa172ec26
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1508255
milestone65.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
Bug 1508255 - Wrap ES Spec reference comments r=jorendorff Depends on D12389 Differential Revision: https://phabricator.services.mozilla.com/D12390
js/src/proxy/ScriptedProxyHandler.cpp
js/src/vm/Interpreter.cpp
js/src/vm/Interpreter.h
--- a/js/src/proxy/ScriptedProxyHandler.cpp
+++ b/js/src/proxy/ScriptedProxyHandler.cpp
@@ -159,19 +159,19 @@ IsCompatiblePropertyDescriptor(JSContext
 // Get the [[ProxyHandler]] of a scripted proxy.
 /* static */ JSObject*
 ScriptedProxyHandler::handlerObject(const JSObject* proxy)
 {
     MOZ_ASSERT(proxy->as<ProxyObject>().handler() == &ScriptedProxyHandler::singleton);
     return proxy->as<ProxyObject>().reservedSlot(ScriptedProxyHandler::HANDLER_EXTRA).toObjectOrNull();
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 7.3.9 GetMethod,
-// reimplemented for proxy handler trap-getting to produce better error
-// messages.
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 7.3.9 GetMethod, reimplemented for proxy handler trap-getting to produce
+// better error messages.
 static bool
 GetProxyTrap(JSContext* cx, HandleObject handler, HandlePropertyName name, MutableHandleValue func)
 {
     // Steps 2, 5.
     if (!GetProperty(cx, handler, handler, name, func)) {
         return false;
     }
 
@@ -194,17 +194,18 @@ GetProxyTrap(JSContext* cx, HandleObject
 
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_TRAP, bytes.get());
         return false;
     }
 
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.1 Proxy.[[GetPrototypeOf]].
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.1 Proxy.[[GetPrototypeOf]].
 bool
 ScriptedProxyHandler::getPrototype(JSContext* cx, HandleObject proxy,
                                    MutableHandleObject protop) const
 {
     // Steps 1-3.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -272,17 +273,18 @@ ScriptedProxyHandler::getPrototype(JSCon
         return false;
     }
 
     // Step 13.
     protop.set(handlerProto.toObjectOrNull());
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.2 Proxy.[[SetPrototypeOf]].
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.2 Proxy.[[SetPrototypeOf]].
 bool
 ScriptedProxyHandler::setPrototype(JSContext* cx, HandleObject proxy, HandleObject proto,
                                    ObjectOpResult& result) const
 {
     // Steps 1-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -371,17 +373,18 @@ ScriptedProxyHandler::setImmutableProtot
     if (!target) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
     }
 
     return SetImmutablePrototype(cx, target, succeeded);
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.4 Proxy.[[PreventExtensions]]()
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.4 Proxy.[[PreventExtensions]]()
 bool
 ScriptedProxyHandler::preventExtensions(JSContext* cx, HandleObject proxy,
                                         ObjectOpResult& result) const
 {
     // Steps 1-3.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -432,17 +435,18 @@ ScriptedProxyHandler::preventExtensions(
         // Step 9.
         return result.succeed();
     }
 
     // Also step 9.
     return result.fail(JSMSG_PROXY_PREVENTEXTENSIONS_RETURNED_FALSE);
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.3 Proxy.[[IsExtensible]]()
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.3 Proxy.[[IsExtensible]]()
 bool
 ScriptedProxyHandler::isExtensible(JSContext* cx, HandleObject proxy, bool* extensible) const
 {
     // Steps 1-3.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
@@ -487,17 +491,18 @@ ScriptedProxyHandler::isExtensible(JSCon
        return false;
     }
 
     // Step 10.
     *extensible = booleanTrapResult;
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.5 Proxy.[[GetOwnProperty]](P)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.5 Proxy.[[GetOwnProperty]](P)
 bool
 ScriptedProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id,
                                                MutableHandle<PropertyDescriptor> desc) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -609,17 +614,18 @@ ScriptedProxyHandler::getOwnPropertyDesc
     }
 
     // Step 18.
     desc.set(resultDesc);
     desc.object().set(proxy);
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.6 Proxy.[[DefineOwnProperty]](P, Desc)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.6 Proxy.[[DefineOwnProperty]](P, Desc)
 bool
 ScriptedProxyHandler::defineProperty(JSContext* cx, HandleObject proxy, HandleId id,
                                      Handle<PropertyDescriptor> desc, ObjectOpResult& result) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -909,17 +915,18 @@ ScriptedProxyHandler::ownPropertyKeys(JS
         RootedId id(cx, uncheckedResultKeys.all().front());
         return js::Throw(cx, id, JSMSG_CANT_REPORT_NEW);
     }
 
     // Step 23.
     return props.appendAll(trapResult);
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.10 Proxy.[[Delete]](P)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.10 Proxy.[[Delete]](P)
 bool
 ScriptedProxyHandler::delete_(JSContext* cx, HandleObject proxy, HandleId id,
                               ObjectOpResult& result) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -979,17 +986,18 @@ ScriptedProxyHandler::delete_(JSContext*
         JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_CANT_DELETE, bytes.get());
         return false;
     }
 
     // Steps 11,13.
     return result.succeed();
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.7 Proxy.[[HasProperty]](P)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.7 Proxy.[[HasProperty]](P)
 bool
 ScriptedProxyHandler::has(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
         return false;
@@ -1052,17 +1060,18 @@ ScriptedProxyHandler::has(JSContext* cx,
         }
     }
 
     // Step 10.
     *bp = booleanTrapResult;
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.8 Proxy.[[GetP]](P, Receiver)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.8 Proxy.[[GetP]](P, Receiver)
 bool
 ScriptedProxyHandler::get(JSContext* cx, HandleObject proxy, HandleValue receiver, HandleId id,
                           MutableHandleValue vp) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -1133,17 +1142,18 @@ ScriptedProxyHandler::get(JSContext* cx,
         }
     }
 
     // Step 11.
     vp.set(trapResult);
     return true;
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.9 Proxy.[[Set]](P, V, Receiver)
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.9 Proxy.[[Set]](P, V, Receiver)
 bool
 ScriptedProxyHandler::set(JSContext* cx, HandleObject proxy, HandleId id, HandleValue v,
                           HandleValue receiver, ObjectOpResult& result) const
 {
     // Steps 2-4.
     RootedObject handler(cx, ScriptedProxyHandler::handlerObject(proxy));
     if (!handler) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_PROXY_REVOKED);
@@ -1423,17 +1433,18 @@ const ScriptedProxyHandler ScriptedProxy
 
 bool
 IsRevokedScriptedProxy(JSObject* obj)
 {
     obj = CheckedUnwrap(obj);
     return obj && IsScriptedProxy(obj) && !obj->as<ProxyObject>().target();
 }
 
-// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 9.5.14 ProxyCreate.
+// ES8 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 9.5.14 ProxyCreate.
 static bool
 ProxyCreate(JSContext* cx, CallArgs& args, const char* callerName)
 {
     if (args.length() < 2) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                                   callerName, "1", "s");
         return false;
     }
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -615,17 +615,18 @@ InternalCall(JSContext* cx, const AnyInv
 }
 
 bool
 js::CallFromStack(JSContext* cx, const CallArgs& args)
 {
     return InternalCall(cx, static_cast<const AnyInvokeArgs&>(args));
 }
 
-// ES7 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 7.3.12 Call.
+// ES7 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 7.3.12 Call.
 bool
 js::Call(JSContext* cx, HandleValue fval, HandleValue thisv, const AnyInvokeArgs& args,
          MutableHandleValue rval)
 {
     // Explicitly qualify these methods to bypass AnyInvokeArgs's deliberate
     // shadowing.
     args.CallArgs::setCallee(fval);
     args.CallArgs::setThis(thisv);
--- a/js/src/vm/Interpreter.h
+++ b/js/src/vm/Interpreter.h
@@ -63,17 +63,18 @@ InternalCallOrConstruct(JSContext* cx, c
  * getter/setter calls.
  */
 extern bool
 CallGetter(JSContext* cx, HandleValue thisv, HandleValue getter, MutableHandleValue rval);
 
 extern bool
 CallSetter(JSContext* cx, HandleValue thisv, HandleValue setter, HandleValue rval);
 
-// ES7 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93 7.3.12 Call(F, V, argumentsList).
+// ES7 rev 0c1bd3004329336774cbc90de727cd0cf5f11e93
+// 7.3.12 Call(F, V, argumentsList).
 // All parameters are required, hopefully forcing callers to be careful not to
 // (say) blindly pass callee as |newTarget| when a different value should have
 // been passed.  Behavior is unspecified if any element of |args| isn't initialized.
 //
 // |rval| is written to *only* after |fval| and |thisv| have been consumed, so
 // |rval| *may* alias either argument.
 extern bool
 Call(JSContext* cx, HandleValue fval, HandleValue thisv, const AnyInvokeArgs& args,