Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/src/js/generator.js b/src/js/generator.js
index 7f43656..3dcdcc0 100644
--- a/src/js/generator.js
+++ b/src/js/generator.js
@@ -36,15 +36,31 @@
if (continuation > 0) {
// Generator is suspended.
DEBUG_PREPARE_STEP_IN_IF_STEPPING(this);
- try {
- return %_GeneratorNext(this, value);
- } catch (e) {
- %GeneratorClose(this);
- throw e;
- }
+ return %_GeneratorNext(this, value);
} else if (continuation == 0) {
// Generator is already closed.
- return { value: void 0, done: true };
+ return %_CreateIterResultObject(UNDEFINED, true);
+ } else {
+ // Generator is running.
+ throw MakeTypeError(kGeneratorRunning);
+ }
+}
+
+
+function GeneratorObjectReturn(value) {
+ if (!IS_GENERATOR(this)) {
+ throw MakeTypeError(kIncompatibleMethodReceiver,
+ '[Generator].prototype.return', this);
+ }
+
+ var continuation = %GeneratorGetContinuation(this);
+ if (continuation > 0) {
+ // Generator is suspended.
+ DEBUG_PREPARE_STEP_IN_IF_STEPPING(this);
+ return %_GeneratorReturn(this, value);
+ } else if (continuation == 0) {
+ // Generator is already closed.
+ return %_CreateIterResultObject(value, true);
} else {
// Generator is running.
throw MakeTypeError(kGeneratorRunning);
@@ -61,12 +77,8 @@
var continuation = %GeneratorGetContinuation(this);
if (continuation > 0) {
// Generator is suspended.
- try {
- return %_GeneratorThrow(this, exn);
- } catch (e) {
- %GeneratorClose(this);
- throw e;
- }
+ DEBUG_PREPARE_STEP_IN_IF_STEPPING(this);
+ return %_GeneratorThrow(this, exn);
} else if (continuation == 0) {
// Generator is already closed.
throw exn;
@@ -78,9 +90,11 @@
// ----------------------------------------------------------------------------
-// Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by
-// neither Crankshaft nor TurboFan, disable optimization of wrappers here.
+// None of the three resume operations (Runtime_GeneratorNext,
+// Runtime_GeneratorReturn, Runtime_GeneratorThrow) is supported by
+// Crankshaft or TurboFan. Disable optimization of wrappers here.
%NeverOptimizeFunction(GeneratorObjectNext);
+%NeverOptimizeFunction(GeneratorObjectReturn);
%NeverOptimizeFunction(GeneratorObjectThrow);
// Set up non-enumerable functions on the generator prototype object.
@@ -88,6 +102,7 @@
utils.InstallFunctions(GeneratorObjectPrototype,
DONT_ENUM,
["next", GeneratorObjectNext,
+ "return", GeneratorObjectReturn,
"throw", GeneratorObjectThrow]);
%AddNamedProperty(GeneratorObjectPrototype, "constructor",