mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
7d2b02d5fd
- Bug 1233109 - Refactor module parsing to instantiate ModuleBuilder earlier r=shu (ae6693165a) - Bug 1233109 - Call into the ModuleBuilder as we parse rather than traversing the AST again afterwards r=shu (c28f785d33) - Bug 1233109 - Check for duplicate exported names using the data in the ModuleBuilder and remove ModuleBox::exportNames r=shu (03999c3ebf) - Bug 1233109 - Make the getters in Import/ExportEntryObject const r=shu (ed6c2e5dca) - Bug 1228211 (part 1) - Rearrange nsDisplayCanvasBackgroundImage::Paint(). r=dholbert. (00f3aacb07) - Bug 1228211 (part 2) - Remove unused functions in nsRenderingContext. r=dholbert. (86d9983e82) - Bug 1231550 - Use DrawTarget instead of gfxContext and/or nsRenderingContext in many places in font/text code. r=jfkthame. (b0962c9b17) - Bug 1234418 - Not trust glyph run starts from a cluster start character. r=jfkthame (b0920d8072) - more of Bug 1222166 - use gcc/clang warning f (690640c6c7) - Bug 1064843 part 1 - Make nsImageFrame inherit nsContainerFrame. r=dholbert (bd5efe0a93) - Bug 1238660 part 1 - Make mWinsInCascade initially false; r=hiro (8420017e68) - Bug 1238660 part 2 - Preserve "wins in cascade" state when updating animations; r=hiro (348a8ef769) - Bug 1230408 - Move suppress line break check out from control of SkipParentDisplayBasedStyleFixup. r=dbaron (ca853b3162) - Bug 1238660 part 3 - Add crashtest; r=hiro (ab4daba520) - Bug 1230005: Factor out relocation style decision; r=jolesen (03ea0e9ba0) - Bug 1230005: Hide specifics of the LDR instruction; r=jolesen (92b0396f81) - Bug 1230005: Flush the assembler buffer at the end of asm.js compilation; r=luke (06e0911bfb) - Bug 1230005: Delay buffer flushing in asm.js until the last minute; r=luke (d3be91cca5) - Bug 1233111 - Share method lists for SIMD types. r=bbouvier (70ec039259) - Bug 1229642 - Fix unified build duplicate static name error (rs=jandem) (eb05c13fec) - Bug 1231338 - SAB gating test cases. r=luke (a8c6740745) - Bug 1233111 - Remove geometry altering SIMD conversions. r=bbouvier (a9c93d7694) - Bug 1233111 - Add unsigned SIMD types to interpreter. r=bbouvier (6187dc7a1e) - Bug 1233111 - Add ecma_7 shift tests. r=bbouvier (17c612dac5) - Bug 1233111 - Implement SIMD shiftRightByScalar(). r=bbouvie (b9b0c848b7) - Bug 1233111 - Add a new ToUint8() function. r=efaust (f1bc50a229) - ug 1233111 - Implement saturating arithmetic for SIMD. r=bbouvier (42a98a07d6) - Bug 1229642 - Factor out StringToNewUTF8CharsZ (r=jandem) (3c4f71214b) - revert PM modification to setProfilingEnabled (4a05202975) - Bug 1229642 - Split wasm::Module out of AsmJSModule (r=bbouvier) (75a1832b1a) - Bug 1229642 - change to AsmJSActivation to WasmActivation (r=bbouvier) (a2e8513369) - Bug 1229642 - Factor AsmJSLink.cpp into wasm/asm.js and consolidate AsmJS* into AsmJS.cpp (r=bbouvier) (3a489c6410)
183 lines
5.4 KiB
C++
183 lines
5.4 KiB
C++
/* -*- 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/. */
|
|
|
|
#include "builtin/WeakSetObject.h"
|
|
|
|
#include "jsapi.h"
|
|
#include "jscntxt.h"
|
|
#include "jsiter.h"
|
|
|
|
#include "builtin/SelfHostingDefines.h"
|
|
#include "builtin/WeakMapObject.h"
|
|
#include "vm/GlobalObject.h"
|
|
#include "vm/SelfHosting.h"
|
|
|
|
#include "jsobjinlines.h"
|
|
|
|
#include "vm/Interpreter-inl.h"
|
|
#include "vm/NativeObject-inl.h"
|
|
|
|
using namespace js;
|
|
|
|
using mozilla::UniquePtr;
|
|
|
|
const Class WeakSetObject::class_ = {
|
|
"WeakSet",
|
|
JSCLASS_HAS_CACHED_PROTO(JSProto_WeakSet) |
|
|
JSCLASS_HAS_RESERVED_SLOTS(WeakSetObject::RESERVED_SLOTS)
|
|
};
|
|
|
|
const JSPropertySpec WeakSetObject::properties[] = {
|
|
JS_PS_END
|
|
};
|
|
|
|
const JSFunctionSpec WeakSetObject::methods[] = {
|
|
JS_SELF_HOSTED_FN("add", "WeakSet_add", 1, 0),
|
|
JS_SELF_HOSTED_FN("clear", "WeakSet_clear", 0, 0),
|
|
JS_SELF_HOSTED_FN("delete", "WeakSet_delete", 1, 0),
|
|
JS_SELF_HOSTED_FN("has", "WeakSet_has", 1, 0),
|
|
JS_FS_END
|
|
};
|
|
|
|
JSObject*
|
|
WeakSetObject::initClass(JSContext* cx, JSObject* obj)
|
|
{
|
|
Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
|
|
RootedPlainObject proto(cx, NewBuiltinClassInstance<PlainObject>(cx));
|
|
if (!proto)
|
|
return nullptr;
|
|
|
|
Rooted<JSFunction*> ctor(cx, global->createConstructor(cx, construct, ClassName(JSProto_WeakSet, cx), 0));
|
|
if (!ctor ||
|
|
!LinkConstructorAndPrototype(cx, ctor, proto) ||
|
|
!DefinePropertiesAndFunctions(cx, proto, properties, methods) ||
|
|
!GlobalObject::initBuiltinConstructor(cx, global, JSProto_WeakSet, ctor, proto))
|
|
{
|
|
return nullptr;
|
|
}
|
|
return proto;
|
|
}
|
|
|
|
WeakSetObject*
|
|
WeakSetObject::create(JSContext* cx, HandleObject proto /* = nullptr */)
|
|
{
|
|
RootedObject map(cx, NewBuiltinClassInstance<WeakMapObject>(cx));
|
|
if (!map)
|
|
return nullptr;
|
|
|
|
WeakSetObject* obj = NewObjectWithClassProto<WeakSetObject>(cx, proto);
|
|
if (!obj)
|
|
return nullptr;
|
|
|
|
obj->setReservedSlot(WEAKSET_MAP_SLOT, ObjectValue(*map));
|
|
return obj;
|
|
}
|
|
|
|
bool
|
|
WeakSetObject::construct(JSContext* cx, unsigned argc, Value* vp)
|
|
{
|
|
// Based on our "Set" implementation instead of the more general ES6 steps.
|
|
CallArgs args = CallArgsFromVp(argc, vp);
|
|
|
|
if (!ThrowIfNotConstructing(cx, args, "WeakSet"))
|
|
return false;
|
|
|
|
RootedObject proto(cx);
|
|
RootedObject newTarget(cx, &args.newTarget().toObject());
|
|
if (!GetPrototypeFromConstructor(cx, newTarget, &proto))
|
|
return false;
|
|
|
|
Rooted<WeakSetObject*> obj(cx, WeakSetObject::create(cx, proto));
|
|
if (!obj)
|
|
return false;
|
|
|
|
if (!args.get(0).isNullOrUndefined()) {
|
|
RootedObject map(cx, &obj->getReservedSlot(WEAKSET_MAP_SLOT).toObject());
|
|
|
|
RootedValue adderVal(cx);
|
|
if (!GetProperty(cx, obj, obj, cx->names().add, &adderVal))
|
|
return false;
|
|
|
|
if (!IsCallable(adderVal))
|
|
return ReportIsNotFunction(cx, adderVal);
|
|
|
|
JSFunction* adder;
|
|
bool isOriginalAdder = IsFunctionObject(adderVal, &adder) &&
|
|
IsSelfHostedFunctionWithName(adder, cx->names().WeakSet_add);
|
|
RootedValue setVal(cx, ObjectValue(*obj));
|
|
FastInvokeGuard fig(cx, adderVal);
|
|
InvokeArgs& args2 = fig.args();
|
|
|
|
JS::ForOfIterator iter(cx);
|
|
if (!iter.init(args[0]))
|
|
return false;
|
|
|
|
RootedValue keyVal(cx);
|
|
RootedObject keyObject(cx);
|
|
RootedValue placeholder(cx, BooleanValue(true));
|
|
while (true) {
|
|
bool done;
|
|
if (!iter.next(&keyVal, &done))
|
|
return false;
|
|
if (done)
|
|
break;
|
|
|
|
if (isOriginalAdder) {
|
|
if (keyVal.isPrimitive()) {
|
|
UniquePtr<char[], JS::FreePolicy> bytes =
|
|
DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, keyVal, nullptr);
|
|
if (!bytes)
|
|
return false;
|
|
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT, bytes.get());
|
|
return false;
|
|
}
|
|
|
|
keyObject = &keyVal.toObject();
|
|
if (!SetWeakMapEntry(cx, map, keyObject, placeholder))
|
|
return false;
|
|
} else {
|
|
if (!args2.init(1))
|
|
return false;
|
|
|
|
args2.setCallee(adderVal);
|
|
args2.setThis(setVal);
|
|
args2[0].set(keyVal);
|
|
|
|
if (!fig.invoke(cx))
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
args.rval().setObject(*obj);
|
|
return true;
|
|
}
|
|
|
|
|
|
JSObject*
|
|
js::InitWeakSetClass(JSContext* cx, HandleObject obj)
|
|
{
|
|
return WeakSetObject::initClass(cx, obj);
|
|
}
|
|
|
|
JS_FRIEND_API(bool)
|
|
JS_NondeterministicGetWeakSetKeys(JSContext* cx, HandleObject objArg, MutableHandleObject ret)
|
|
{
|
|
RootedObject obj(cx, objArg);
|
|
obj = UncheckedUnwrap(obj);
|
|
if (!obj || !obj->is<WeakSetObject>()) {
|
|
ret.set(nullptr);
|
|
return true;
|
|
}
|
|
|
|
Rooted<WeakSetObject*> weakset(cx, &obj->as<WeakSetObject>());
|
|
if (!weakset)
|
|
return false;
|
|
|
|
RootedObject map(cx, &weakset->getReservedSlot(WEAKSET_MAP_SLOT).toObject());
|
|
return JS_NondeterministicGetWeakMapKeys(cx, map, ret);
|
|
}
|