Bug 1225396 part 1 - Rename *Iterator stuff to *LegacyIterator. r=jorendorff
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 09 Dec 2015 22:54:10 -0500
changeset 276055 a87be824cc8f8a0962e51908c3199330affd91cd
parent 276054 6fce35b1c9877805e071baa91136f372091ccc66
child 276056 0eb91b63bf26dd32861376a017f77bad372854d3
push id29781
push usercbook@mozilla.com
push dateThu, 10 Dec 2015 11:07:51 +0000
treeherdermozilla-central@412e4d7ce98c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1225396
milestone45.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 1225396 part 1 - Rename *Iterator stuff to *LegacyIterator. r=jorendorff
js/src/builtin/MapObject.cpp
js/src/jsapi.cpp
js/src/jsiter.cpp
js/src/jsiter.h
js/src/jsprototypes.h
js/src/vm/GlobalObject.h
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -136,17 +136,17 @@ MapIteratorObject::kind() const
     int32_t i = getSlot(KindSlot).toInt32();
     MOZ_ASSERT(i == MapObject::Keys || i == MapObject::Values || i == MapObject::Entries);
     return MapObject::IteratorKind(i);
 }
 
 bool
 GlobalObject::initMapIteratorProto(JSContext* cx, Handle<GlobalObject*> global)
 {
-    Rooted<JSObject*> base(cx, GlobalObject::getOrCreateIteratorPrototype(cx, global));
+    Rooted<JSObject*> base(cx, GlobalObject::getOrCreateLegacyIteratorPrototype(cx, global));
     if (!base)
         return false;
     Rooted<MapIteratorObject*> proto(cx,
         NewObjectWithGivenProto<MapIteratorObject>(cx, base));
     if (!proto)
         return false;
     proto->setSlot(MapIteratorObject::RangeSlot, PrivateValue(nullptr));
     if (!JS_DefineFunctions(cx, proto, MapIteratorObject::methods))
@@ -861,17 +861,17 @@ SetIteratorObject::kind() const
     int32_t i = getSlot(KindSlot).toInt32();
     MOZ_ASSERT(i == SetObject::Values || i == SetObject::Entries);
     return SetObject::IteratorKind(i);
 }
 
 bool
 GlobalObject::initSetIteratorProto(JSContext* cx, Handle<GlobalObject*> global)
 {
-    Rooted<JSObject*> base(cx, GlobalObject::getOrCreateIteratorPrototype(cx, global));
+    Rooted<JSObject*> base(cx, GlobalObject::getOrCreateLegacyIteratorPrototype(cx, global));
     if (!base)
         return false;
     Rooted<SetIteratorObject*> proto(cx,
         NewObjectWithGivenProto<SetIteratorObject>(cx, base));
     if (!proto)
         return false;
     proto->setSlot(SetIteratorObject::RangeSlot, PrivateValue(nullptr));
     if (!JS_DefineFunctions(cx, proto, SetIteratorObject::methods))
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1220,17 +1220,17 @@ JS_GetErrorPrototype(JSContext* cx)
     return GlobalObject::getOrCreateCustomErrorPrototype(cx, global, JSEXN_ERR);
 }
 
 JS_PUBLIC_API(JSObject*)
 JS_GetIteratorPrototype(JSContext* cx)
 {
     CHECK_REQUEST(cx);
     Rooted<GlobalObject*> global(cx, cx->global());
-    return GlobalObject::getOrCreateIteratorPrototype(cx, global);
+    return GlobalObject::getOrCreateLegacyIteratorPrototype(cx, global);
 }
 
 JS_PUBLIC_API(JSObject*)
 JS_GetGlobalForObject(JSContext* cx, JSObject* obj)
 {
     AssertHeapIsIdle(cx);
     assertSameCompartment(cx, obj);
     return &obj->global();
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -538,17 +538,17 @@ Compare(T* a, T* b, size_t c)
       case 3:      if (*a++ != *b++) return false;
       case 2:      if (*a++ != *b++) return false;
       case 1:      if (*a++ != *b++) return false;
               } while (--n > 0);
     }
     return true;
 }
 
-static bool iterator_next(JSContext* cx, unsigned argc, Value* vp);
+static bool legacy_iterator_next(JSContext* cx, unsigned argc, Value* vp);
 
 static inline PropertyIteratorObject*
 NewPropertyIteratorObject(JSContext* cx, unsigned flags)
 {
     if (flags & JSITER_ENUMERATE) {
         RootedObjectGroup group(cx, ObjectGroup::defaultNewGroup(cx, &PropertyIteratorObject::class_,
                                                                  TaggedProto(nullptr)));
         if (!group)
@@ -575,17 +575,17 @@ NewPropertyIteratorObject(JSContext* cx,
     if (!res)
         return nullptr;
 
     if (flags == 0) {
         // Redefine next as an own property. This ensure that deleting the
         // next method on the prototype doesn't break cross-global for .. in.
         // We don't have to do this for JSITER_ENUMERATE because that object always
         // takes an optimized path.
-        RootedFunction next(cx, NewNativeFunction(cx, iterator_next, 0,
+        RootedFunction next(cx, NewNativeFunction(cx, legacy_iterator_next, 0,
                                                   HandlePropertyName(cx->names().next)));
         if (!next)
             return nullptr;
 
         RootedValue value(cx, ObjectValue(*next));
         if (!DefineProperty(cx, res, cx->names().next, value))
             return nullptr;
     }
@@ -1012,17 +1012,17 @@ NativeIteratorNext(JSContext* cx, Native
 
 MOZ_ALWAYS_INLINE bool
 IsIterator(HandleValue v)
 {
     return v.isObject() && v.toObject().hasClass(&PropertyIteratorObject::class_);
 }
 
 MOZ_ALWAYS_INLINE bool
-iterator_next_impl(JSContext* cx, const CallArgs& args)
+legacy_iterator_next_impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(IsIterator(args.thisv()));
 
     RootedObject thisObj(cx, &args.thisv().toObject());
 
     NativeIterator* ni = thisObj.as<PropertyIteratorObject>()->getNativeIterator();
     RootedValue value(cx);
     bool done;
@@ -1035,25 +1035,25 @@ iterator_next_impl(JSContext* cx, const 
         return false;
     }
 
     args.rval().set(value);
     return true;
 }
 
 static bool
-iterator_next(JSContext* cx, unsigned argc, Value* vp)
+legacy_iterator_next(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
-    return CallNonGenericMethod<IsIterator, iterator_next_impl>(cx, args);
+    return CallNonGenericMethod<IsIterator, legacy_iterator_next_impl>(cx, args);
 }
 
-static const JSFunctionSpec iterator_methods[] = {
+static const JSFunctionSpec legacy_iterator_methods[] = {
     JS_SELF_HOSTED_SYM_FN(iterator, "LegacyIteratorShim", 0, 0),
-    JS_FN("next",      iterator_next,       0, 0),
+    JS_FN("next",      legacy_iterator_next,       0, 0),
     JS_FS_END
 };
 
 size_t
 PropertyIteratorObject::sizeOfMisc(mozilla::MallocSizeOf mallocSizeOf) const
 {
     return mallocSizeOf(getPrivate());
 }
@@ -1463,17 +1463,17 @@ const Class StopIterationObject::class_ 
 };
 
 /* static */ bool
 GlobalObject::initArrayIteratorProto(JSContext* cx, Handle<GlobalObject*> global)
 {
     if (global->getReservedSlot(ARRAY_ITERATOR_PROTO).isObject())
         return true;
 
-    RootedObject iteratorProto(cx, GlobalObject::getOrCreateIteratorPrototype(cx, global));
+    RootedObject iteratorProto(cx, GlobalObject::getOrCreateLegacyIteratorPrototype(cx, global));
     if (!iteratorProto)
         return false;
 
     const Class* cls = &ArrayIteratorPrototypeClass;
     RootedObject proto(cx, global->createBlankPrototypeInheriting(cx, cls, iteratorProto));
     if (!proto || !DefinePropertiesAndFunctions(cx, proto, nullptr, array_iterator_methods))
         return false;
 
@@ -1492,17 +1492,17 @@ GlobalObject::initStringIteratorProto(JS
     if (!proto || !DefinePropertiesAndFunctions(cx, proto, nullptr, string_iterator_methods))
         return false;
 
     global->setReservedSlot(STRING_ITERATOR_PROTO, ObjectValue(*proto));
     return true;
 }
 
 JSObject*
-js::InitIteratorClass(JSContext* cx, HandleObject obj)
+js::InitLegacyIteratorClass(JSContext* cx, HandleObject obj)
 {
     Handle<GlobalObject*> global = obj.as<GlobalObject>();
 
     if (global->getPrototype(JSProto_Iterator).isObject())
         return &global->getPrototype(JSProto_Iterator).toObject();
 
     RootedObject iteratorProto(cx);
     iteratorProto = global->createBlankPrototype(cx, &PropertyIteratorObject::class_);
@@ -1518,17 +1518,17 @@ js::InitIteratorClass(JSContext* cx, Han
     iteratorProto->as<PropertyIteratorObject>().setNativeIterator(ni);
 
     Rooted<JSFunction*> ctor(cx);
     ctor = global->createConstructor(cx, IteratorConstructor, cx->names().Iterator, 2);
     if (!ctor)
         return nullptr;
     if (!LinkConstructorAndPrototype(cx, ctor, iteratorProto))
         return nullptr;
-    if (!DefinePropertiesAndFunctions(cx, iteratorProto, nullptr, iterator_methods))
+    if (!DefinePropertiesAndFunctions(cx, iteratorProto, nullptr, legacy_iterator_methods))
         return nullptr;
     if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_Iterator,
                                               ctor, iteratorProto))
     {
         return nullptr;
     }
 
     return &global->getPrototype(JSProto_Iterator).toObject();
--- a/js/src/jsiter.h
+++ b/js/src/jsiter.h
@@ -209,16 +209,16 @@ ThrowStopIteration(JSContext* cx);
 /*
  * Create an object of the form { value: VALUE, done: DONE }.
  * ES6 draft from 2013-09-05, section 25.4.3.4.
  */
 extern JSObject*
 CreateItrResultObject(JSContext* cx, HandleValue value, bool done);
 
 extern JSObject*
-InitIteratorClass(JSContext* cx, HandleObject obj);
+InitLegacyIteratorClass(JSContext* cx, HandleObject obj);
 
 extern JSObject*
 InitStopIterationClass(JSContext* cx, HandleObject obj);
 
 } /* namespace js */
 
 #endif /* jsiter_h */
--- a/js/src/jsprototypes.h
+++ b/js/src/jsprototypes.h
@@ -70,17 +70,17 @@
     real(Error,                 11,     InitViaClassSpec,       ERROR_CLASP(JSEXN_ERR)) \
     real(InternalError,         12,     InitViaClassSpec,       ERROR_CLASP(JSEXN_INTERNALERR)) \
     real(EvalError,             13,     InitViaClassSpec,       ERROR_CLASP(JSEXN_EVALERR)) \
     real(RangeError,            14,     InitViaClassSpec,       ERROR_CLASP(JSEXN_RANGEERR)) \
     real(ReferenceError,        15,     InitViaClassSpec,       ERROR_CLASP(JSEXN_REFERENCEERR)) \
     real(SyntaxError,           16,     InitViaClassSpec,       ERROR_CLASP(JSEXN_SYNTAXERR)) \
     real(TypeError,             17,     InitViaClassSpec,       ERROR_CLASP(JSEXN_TYPEERR)) \
     real(URIError,              18,     InitViaClassSpec,       ERROR_CLASP(JSEXN_URIERR)) \
-    real(Iterator,              19,     InitIteratorClass,      OCLASP(PropertyIterator)) \
+    real(Iterator,              19,     InitLegacyIteratorClass,OCLASP(PropertyIterator)) \
     real(StopIteration,         20,     InitStopIterationClass, OCLASP(StopIteration)) \
     real(ArrayBuffer,           21,     InitArrayBufferClass,   &js::ArrayBufferObject::protoClass) \
     real(Int8Array,             22,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int8)) \
     real(Uint8Array,            23,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8)) \
     real(Int16Array,            24,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int16)) \
     real(Uint16Array,           25,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint16)) \
     real(Int32Array,            26,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Int32)) \
     real(Uint32Array,           27,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint32)) \
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -448,17 +448,17 @@ class GlobalObject : public NativeObject
             return nullptr;
         const Value& slot = globalSimdObject->as<NativeObject>().getReservedSlot(uint32_t(T::type));
         MOZ_ASSERT(slot.isObject());
         return &slot.toObject().as<SimdTypeDescr>();
     }
 
     TypedObjectModuleObject& getTypedObjectModule() const;
 
-    JSObject* getIteratorPrototype() {
+    JSObject* getLegacyIteratorPrototype() {
         return &getPrototype(JSProto_Iterator).toObject();
     }
 
     JSObject* getOrCreateCollatorPrototype(JSContext* cx) {
         return getOrCreateObject(cx, COLLATOR_PROTO, initCollatorProto);
     }
 
     JSObject* getOrCreateNumberFormatPrototype(JSContext* cx) {
@@ -504,18 +504,18 @@ class GlobalObject : public NativeObject
             return &v.toObject();
         RootedGlobalObject self(cx, this);
         if (!init(cx, self))
             return nullptr;
         return &self->getSlot(slot).toObject();
     }
 
   public:
-    static NativeObject* getOrCreateIteratorPrototype(JSContext* cx,
-                                                      Handle<GlobalObject*> global)
+    static NativeObject* getOrCreateLegacyIteratorPrototype(JSContext* cx,
+                                                            Handle<GlobalObject*> global)
     {
         if (!ensureConstructor(cx, global, JSProto_Iterator))
             return nullptr;
         size_t slot = APPLICATION_SLOTS + JSProto_LIMIT + JSProto_Iterator;
         return &global->getSlot(slot).toObject().as<NativeObject>();
     }
 
     static NativeObject* getOrCreateArrayIteratorPrototype(JSContext* cx, Handle<GlobalObject*> global)
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -443,17 +443,17 @@ intrinsic_IsPackedArray(JSContext* cx, u
 }
 
 static bool
 intrinsic_GetIteratorPrototype(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 0);
 
-    JSObject* obj = GlobalObject::getOrCreateIteratorPrototype(cx, cx->global());
+    JSObject* obj = GlobalObject::getOrCreateLegacyIteratorPrototype(cx, cx->global());
     if (!obj)
         return false;
 
     args.rval().setObject(*obj);
     return true;
 }
 
 static bool
@@ -508,17 +508,17 @@ intrinsic_NewStringIterator(JSContext* c
 }
 
 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()));
+    RootedObject proto(cx, GlobalObject::getOrCreateLegacyIteratorPrototype(cx, cx->global()));
     if (!proto)
         return false;
 
     RootedObject iterator(cx);
     iterator = NewObjectWithGivenProto(cx, &ListIteratorObject::class_, proto);
     if (!iterator)
         return false;