Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: src/js/generator.js

Issue 1865833002: [generators] Decouple generator resume from fullcodegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/js/generator.js
diff --git a/src/js/generator.js b/src/js/generator.js
deleted file mode 100644
index 3dcdcc0ffa1aeafee85384f345a4c4bd5587fefa..0000000000000000000000000000000000000000
--- a/src/js/generator.js
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function(global, utils) {
-
-"use strict";
-
-%CheckIsBootstrapping();
-
-// -------------------------------------------------------------------
-// Imports
-
-var GeneratorFunctionPrototype = utils.ImportNow("GeneratorFunctionPrototype");
-var GeneratorFunction = utils.ImportNow("GeneratorFunction");
-var GlobalFunction = global.Function;
-var MakeTypeError;
-var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
-
-utils.Import(function(from) {
- MakeTypeError = from.MakeTypeError;
-});
-
-// ----------------------------------------------------------------------------
-
-// Generator functions and objects are specified by ES6, sections 15.19.3 and
-// 15.19.4.
-
-function GeneratorObjectNext(value) {
- if (!IS_GENERATOR(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- '[Generator].prototype.next', this);
- }
-
- var continuation = %GeneratorGetContinuation(this);
- if (continuation > 0) {
- // Generator is suspended.
- DEBUG_PREPARE_STEP_IN_IF_STEPPING(this);
- return %_GeneratorNext(this, value);
- } else if (continuation == 0) {
- // Generator is already closed.
- 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);
- }
-}
-
-
-function GeneratorObjectThrow(exn) {
- if (!IS_GENERATOR(this)) {
- throw MakeTypeError(kIncompatibleMethodReceiver,
- '[Generator].prototype.throw', this);
- }
-
- var continuation = %GeneratorGetContinuation(this);
- if (continuation > 0) {
- // Generator is suspended.
- DEBUG_PREPARE_STEP_IN_IF_STEPPING(this);
- return %_GeneratorThrow(this, exn);
- } else if (continuation == 0) {
- // Generator is already closed.
- throw exn;
- } else {
- // Generator is running.
- throw MakeTypeError(kGeneratorRunning);
- }
-}
-
-// ----------------------------------------------------------------------------
-
-// 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.
-var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
-utils.InstallFunctions(GeneratorObjectPrototype,
- DONT_ENUM,
- ["next", GeneratorObjectNext,
- "return", GeneratorObjectReturn,
- "throw", GeneratorObjectThrow]);
-
-%AddNamedProperty(GeneratorObjectPrototype, "constructor",
- GeneratorFunctionPrototype, DONT_ENUM | READ_ONLY);
-%AddNamedProperty(GeneratorObjectPrototype,
- toStringTagSymbol, "Generator", DONT_ENUM | READ_ONLY);
-%InternalSetPrototype(GeneratorFunctionPrototype, GlobalFunction.prototype);
-%AddNamedProperty(GeneratorFunctionPrototype,
- toStringTagSymbol, "GeneratorFunction", DONT_ENUM | READ_ONLY);
-%AddNamedProperty(GeneratorFunctionPrototype, "constructor",
- GeneratorFunction, DONT_ENUM | READ_ONLY);
-%InternalSetPrototype(GeneratorFunction, GlobalFunction);
-
-})
« src/deoptimizer.cc ('K') | « src/interface-descriptors.h ('k') | src/js/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698