| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 throw MakeTypeError(kGeneratorRunning); | 77 throw MakeTypeError(kGeneratorRunning); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 function GeneratorFunctionConstructor(arg1) { // length == 1 | 82 function GeneratorFunctionConstructor(arg1) { // length == 1 |
| 83 var source = NewFunctionString(arguments, 'function*'); | 83 var source = NewFunctionString(arguments, 'function*'); |
| 84 var global_proxy = %GlobalProxy(GeneratorFunctionConstructor); | 84 var global_proxy = %GlobalProxy(GeneratorFunctionConstructor); |
| 85 // Compile the string in the constructor and not a helper so that errors | 85 // Compile the string in the constructor and not a helper so that errors |
| 86 // appear to come from here. | 86 // appear to come from here. |
| 87 var func = %_CallFunction(global_proxy, %CompileString(source, true)); | 87 var func = %_Call(%CompileString(source, true), global_proxy); |
| 88 // Set name-should-print-as-anonymous flag on the ShareFunctionInfo and | 88 // Set name-should-print-as-anonymous flag on the ShareFunctionInfo and |
| 89 // ensure that |func| uses correct initial map from |new.target| if | 89 // ensure that |func| uses correct initial map from |new.target| if |
| 90 // it's available. | 90 // it's available. |
| 91 return %CompleteFunctionConstruction(func, GeneratorFunction, new.target); | 91 return %CompleteFunctionConstruction(func, GeneratorFunction, new.target); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // ---------------------------------------------------------------------------- | 94 // ---------------------------------------------------------------------------- |
| 95 | 95 |
| 96 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by | 96 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by |
| 97 // neither Crankshaft nor TurboFan, disable optimization of wrappers here. | 97 // neither Crankshaft nor TurboFan, disable optimization of wrappers here. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 111 toStringTagSymbol, "Generator", DONT_ENUM | READ_ONLY); | 111 toStringTagSymbol, "Generator", DONT_ENUM | READ_ONLY); |
| 112 %InternalSetPrototype(GeneratorFunctionPrototype, GlobalFunction.prototype); | 112 %InternalSetPrototype(GeneratorFunctionPrototype, GlobalFunction.prototype); |
| 113 %AddNamedProperty(GeneratorFunctionPrototype, | 113 %AddNamedProperty(GeneratorFunctionPrototype, |
| 114 toStringTagSymbol, "GeneratorFunction", DONT_ENUM | READ_ONLY); | 114 toStringTagSymbol, "GeneratorFunction", DONT_ENUM | READ_ONLY); |
| 115 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", | 115 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", |
| 116 GeneratorFunction, DONT_ENUM | READ_ONLY); | 116 GeneratorFunction, DONT_ENUM | READ_ONLY); |
| 117 %InternalSetPrototype(GeneratorFunction, GlobalFunction); | 117 %InternalSetPrototype(GeneratorFunction, GlobalFunction); |
| 118 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); | 118 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); |
| 119 | 119 |
| 120 }) | 120 }) |
| OLD | NEW |