| Index: src/generator.js
|
| diff --git a/test/mjsunit/compiler/multiply-sub.js b/src/generator.js
|
| similarity index 63%
|
| copy from test/mjsunit/compiler/multiply-sub.js
|
| copy to src/generator.js
|
| index 4793181d47a2b4a2b2390f5049758e651ef1ec1c..c04e8e6c4cdc8958d80205745c16b5e560a1e44f 100644
|
| --- a/test/mjsunit/compiler/multiply-sub.js
|
| +++ b/src/generator.js
|
| @@ -25,32 +25,35 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --allow-natives-syntax
|
| -// Test expressions that can be computed with a multiply-add instruction.
|
| +// TODO(wingo): Give link to specification. For now, the following diagram is
|
| +// the spec:
|
| +// http://wiki.ecmascript.org/lib/exe/fetch.php?cache=cache&media=harmony:es6_generator_object_model_3-29-13.png
|
|
|
| -function f(a, b, c) {
|
| - return a - b * c;
|
| +function GeneratorObjectNext() {
|
| + // TODO(wingo): Implement.
|
| }
|
|
|
| -function g(a, b, c) {
|
| - return a * b - c;
|
| +function GeneratorObjectSend(value) {
|
| + // TODO(wingo): Implement.
|
| }
|
|
|
| -function h(a, b, c, d) {
|
| - return a * b - c * d;
|
| +function GeneratorObjectThrow(exn) {
|
| + // TODO(wingo): Implement.
|
| }
|
|
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| -%OptimizeFunctionOnNextCall(f);
|
| -assertEquals(-5.41, f(1.1, 2.1, 3.1));
|
| +function GeneratorObjectClose() {
|
| + // TODO(wingo): Implement.
|
| +}
|
|
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| -%OptimizeFunctionOnNextCall(g);
|
| -assertEquals(8.36, g(2.2, 3.3, -1.1));
|
| +function SetUpGenerators() {
|
| + %CheckIsBootstrapping();
|
| + var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
|
| + InstallFunctions(GeneratorObjectPrototype,
|
| + DONT_ENUM | DONT_DELETE | READ_ONLY,
|
| + ["next", GeneratorObjectNext,
|
| + "send", GeneratorObjectSend,
|
| + "throw", GeneratorObjectThrow,
|
| + "close", GeneratorObjectClose]);
|
| +}
|
|
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| -%OptimizeFunctionOnNextCall(h);
|
| -assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
|
| +SetUpGenerators();
|
|
|