Bug 927649: Use object literal syntax in for-of iterator. r=jorendorff
authorBen Kelly <ben@wanderview.com>
Wed, 16 Oct 2013 16:44:00 +0200
changeset 165881 9c8ab7e9ae419e7dec2025c2584eeb565b17accc
parent 165880 883941b3f9278f59e3b50629434dd7244c51a62a
child 165882 a417424f9213c410910cbd85fd41d3ddb3162eed
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs927649
milestone27.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 927649: Use object literal syntax in for-of iterator. r=jorendorff
js/src/builtin/Iterator.js
--- a/js/src/builtin/Iterator.js
+++ b/js/src/builtin/Iterator.js
@@ -3,41 +3,34 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function IteratorIdentity() {
     return this;
 }
 
 var LegacyIteratorWrapperMap = new std_WeakMap();
 
-function IteratorResult(value, done) {
-    var result = std_Object_create(null);
-    result.value = value;
-    result.done = done;
-    return result;
-}
-
 function LegacyIteratorNext(arg) {
     var iter = callFunction(std_WeakMap_get, LegacyIteratorWrapperMap, this);
     try {
-        return IteratorResult(iter.next(arg), false);
+        return { value: iter.next(arg), done: false };
     } catch (e) {
         if (e instanceof std_StopIteration)
-            return IteratorResult(undefined, true);
+            return { value: undefined, done: true };
         throw e;
     }
 }
 
 function LegacyIteratorThrow(exn) {
     var iter = callFunction(std_WeakMap_get, LegacyIteratorWrapperMap, this);
     try {
-        return IteratorResult(iter.throw(exn), false);
+        return { value: iter.throw(exn), done: false };
     } catch (e) {
         if (e instanceof std_StopIteration)
-            return IteratorResult(undefined, true);
+            return { value: undefined, done: true };
         throw e;
     }
 }
 
 function LegacyIterator(iter) {
     callFunction(std_WeakMap_set, LegacyIteratorWrapperMap, this, iter);
 }