diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-14 08:55:29 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-14 08:55:29 +0200 |
commit | ba6602b2de951beb74ef0f43a1cbae33ff0548e2 (patch) | |
tree | cd7ef9a34649d796bc0cc00bb708c7218ff5098f | |
parent | 6452e3c9785260f21c5013d31e855e7b3e0497f4 (diff) | |
download | UXP-ba6602b2de951beb74ef0f43a1cbae33ff0548e2.tar UXP-ba6602b2de951beb74ef0f43a1cbae33ff0548e2.tar.gz UXP-ba6602b2de951beb74ef0f43a1cbae33ff0548e2.tar.lz UXP-ba6602b2de951beb74ef0f43a1cbae33ff0548e2.tar.xz UXP-ba6602b2de951beb74ef0f43a1cbae33ff0548e2.zip |
Bug 1326453 - Part 5: Remove no longer used ListIterator implementation
-rw-r--r-- | js/src/builtin/Iterator.js | 41 | ||||
-rw-r--r-- | js/src/builtin/SelfHostingDefines.h | 2 | ||||
-rw-r--r-- | js/src/jit-test/tests/basic/bug1220766.js | 3 | ||||
-rw-r--r-- | js/src/jit/InlinableNatives.h | 1 | ||||
-rw-r--r-- | js/src/jit/MCallOptimize.cpp | 2 | ||||
-rw-r--r-- | js/src/jsiter.cpp | 12 | ||||
-rw-r--r-- | js/src/jsiter.h | 6 | ||||
-rw-r--r-- | js/src/vm/SelfHosting.cpp | 40 |
8 files changed, 0 insertions, 107 deletions
diff --git a/js/src/builtin/Iterator.js b/js/src/builtin/Iterator.js index 735eec7a0..e25b76156 100644 --- a/js/src/builtin/Iterator.js +++ b/js/src/builtin/Iterator.js @@ -84,44 +84,3 @@ function LegacyIteratorShim() { function LegacyGeneratorIteratorShim() { return NewLegacyIterator(ToObject(this), LegacyGeneratorIterator); } - -// 7.4.8 CreateListIterator() -function CreateListIterator(array) { - let iterator = NewListIterator(); - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_TARGET, array); - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_NEXT_INDEX, 0); - - // 7.4.8.1 ListIterator next() - // The spec requires that we use a new next function per iterator object. - let next = function() { - if (!IsObject(this) || !IsListIterator(this)) - return callFunction(CallListIteratorMethodIfWrapped, this, "ListIteratorNext"); - - if (ActiveFunction() !== UnsafeGetReservedSlot(this, ITERATOR_SLOT_NEXT_METHOD)) - ThrowTypeError(JSMSG_INCOMPATIBLE_METHOD, "next", "method", ToString(this)); - - let array = UnsafeGetObjectFromReservedSlot(this, ITERATOR_SLOT_TARGET); - let index = UnsafeGetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX); - - if (index >= ToLength(array.length)) { - UnsafeSetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX, 1/0); - return { value: undefined, done: true }; - } - - UnsafeSetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX, index + 1); - return { value: array[index], done: false }; - }; - - UnsafeSetReservedSlot(iterator, ITERATOR_SLOT_NEXT_METHOD, next); - iterator.next = next; - - iterator[std_iterator] = ListIteratorIdentity; - return iterator; -} - -function ListIteratorIdentity() { - if (!IsObject(this) || !IsListIterator(this)) - return callFunction(CallListIteratorMethodIfWrapped, this, "ListIteratorIdentity"); - - return this; -} diff --git a/js/src/builtin/SelfHostingDefines.h b/js/src/builtin/SelfHostingDefines.h index b57c17269..d676270a1 100644 --- a/js/src/builtin/SelfHostingDefines.h +++ b/js/src/builtin/SelfHostingDefines.h @@ -71,8 +71,6 @@ // Used for list, i.e. Array and String, iterators. #define ITERATOR_SLOT_NEXT_INDEX 1 #define ITERATOR_SLOT_ITEM_KIND 2 -// Used for ListIterator. -#define ITERATOR_SLOT_NEXT_METHOD 2 #define ITEM_KIND_KEY 0 #define ITEM_KIND_VALUE 1 diff --git a/js/src/jit-test/tests/basic/bug1220766.js b/js/src/jit-test/tests/basic/bug1220766.js deleted file mode 100644 index fca11eafe..000000000 --- a/js/src/jit-test/tests/basic/bug1220766.js +++ /dev/null @@ -1,3 +0,0 @@ -iter = getSelfHostedValue("CreateListIterator")([]); -iter.next(); -iter.next(); diff --git a/js/src/jit/InlinableNatives.h b/js/src/jit/InlinableNatives.h index 89c2ff0a4..15352c04f 100644 --- a/js/src/jit/InlinableNatives.h +++ b/js/src/jit/InlinableNatives.h @@ -121,7 +121,6 @@ _(IntrinsicIsMapIterator) \ _(IntrinsicIsSetIterator) \ _(IntrinsicIsStringIterator) \ - _(IntrinsicIsListIterator) \ \ _(IntrinsicGetNextMapEntryForIterator) \ \ diff --git a/js/src/jit/MCallOptimize.cpp b/js/src/jit/MCallOptimize.cpp index 202aef497..293253253 100644 --- a/js/src/jit/MCallOptimize.cpp +++ b/js/src/jit/MCallOptimize.cpp @@ -288,8 +288,6 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target) return inlineHasClass(callInfo, &SetIteratorObject::class_); case InlinableNative::IntrinsicIsStringIterator: return inlineHasClass(callInfo, &StringIteratorObject::class_); - case InlinableNative::IntrinsicIsListIterator: - return inlineHasClass(callInfo, &ListIteratorObject::class_); case InlinableNative::IntrinsicDefineDataProperty: return inlineDefineDataProperty(callInfo); case InlinableNative::IntrinsicObjectHasPrototype: diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index c1ae5dc15..59893fa98 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -1157,18 +1157,6 @@ static const JSFunctionSpec string_iterator_methods[] = { JS_FS_END }; -enum { - ListIteratorSlotIteratedObject, - ListIteratorSlotNextIndex, - ListIteratorSlotNextMethod, - ListIteratorSlotCount -}; - -const Class ListIteratorObject::class_ = { - "List Iterator", - JSCLASS_HAS_RESERVED_SLOTS(ListIteratorSlotCount) -}; - JSObject* js::ValueToIterator(JSContext* cx, unsigned flags, HandleValue vp) { diff --git a/js/src/jsiter.h b/js/src/jsiter.h index f11f09b55..a3035ddd0 100644 --- a/js/src/jsiter.h +++ b/js/src/jsiter.h @@ -151,12 +151,6 @@ class StringIteratorObject : public JSObject static const Class class_; }; -class ListIteratorObject : public JSObject -{ - public: - static const Class class_; -}; - bool GetIterator(JSContext* cx, HandleObject obj, unsigned flags, MutableHandleObject objp); diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index bf49f2268..c7e7cc863 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -841,37 +841,6 @@ intrinsic_NewStringIterator(JSContext* cx, unsigned argc, Value* vp) } static bool -intrinsic_NewListIterator(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 0); - - RootedObject proto(cx, GlobalObject::getOrCreateIteratorPrototype(cx, cx->global())); - if (!proto) - return false; - - RootedObject iterator(cx); - iterator = NewObjectWithGivenProto(cx, &ListIteratorObject::class_, proto); - if (!iterator) - return false; - - args.rval().setObject(*iterator); - return true; -} - -static bool -intrinsic_ActiveFunction(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - MOZ_ASSERT(args.length() == 0); - - ScriptFrameIter iter(cx); - MOZ_ASSERT(iter.isFunctionFrame()); - args.rval().setObject(*iter.callee(cx)); - return true; -} - -static bool intrinsic_SetCanonicalName(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -2294,11 +2263,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("CallArrayIteratorMethodIfWrapped", CallNonGenericSelfhostedMethod<Is<ArrayIteratorObject>>, 2,0), - JS_FN("NewListIterator", intrinsic_NewListIterator, 0,0), - JS_FN("CallListIteratorMethodIfWrapped", - CallNonGenericSelfhostedMethod<Is<ListIteratorObject>>, 2,0), - JS_FN("ActiveFunction", intrinsic_ActiveFunction, 0,0), - JS_FN("_SetCanonicalName", intrinsic_SetCanonicalName, 2,0), JS_INLINABLE_FN("IsArrayIterator", @@ -2313,9 +2277,6 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_INLINABLE_FN("IsStringIterator", intrinsic_IsInstanceOfBuiltin<StringIteratorObject>, 1,0, IntrinsicIsStringIterator), - JS_INLINABLE_FN("IsListIterator", - intrinsic_IsInstanceOfBuiltin<ListIteratorObject>, 1,0, - IntrinsicIsListIterator), JS_FN("_CreateMapIterationResultPair", intrinsic_CreateMapIterationResultPair, 0, 0), JS_INLINABLE_FN("_GetNextMapEntryForIterator", intrinsic_GetNextMapEntryForIterator, 2,0, @@ -2531,7 +2492,6 @@ static const JSFunctionSpec intrinsic_functions[] = { intrinsic_InstantiateModuleFunctionDeclarations, 1, 0), JS_FN("SetModuleState", intrinsic_SetModuleState, 1, 0), JS_FN("EvaluateModule", intrinsic_EvaluateModule, 1, 0), - JS_FN("IsModuleNamespace", intrinsic_IsInstanceOfBuiltin<ModuleNamespaceObject>, 1, 0), JS_FN("NewModuleNamespace", intrinsic_NewModuleNamespace, 2, 0), JS_FN("AddModuleNamespaceBinding", intrinsic_AddModuleNamespaceBinding, 4, 0), JS_FN("ModuleNamespaceExports", intrinsic_ModuleNamespaceExports, 1, 0), |