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 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declarations have been made | 7 // This file relies on the fact that the following declarations have been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Function = global.Function; | 9 // var $Function = global.Function; |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 var f = %CompileString(source, true); | 50 var f = %CompileString(source, true); |
51 if (!IS_FUNCTION(f)) return f; | 51 if (!IS_FUNCTION(f)) return f; |
52 f = %_CallFunction(global_proxy, f); | 52 f = %_CallFunction(global_proxy, f); |
53 %FunctionMarkNameShouldPrintAsAnonymous(f); | 53 %FunctionMarkNameShouldPrintAsAnonymous(f); |
54 return f; | 54 return f; |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 function SetUpGenerators() { | 58 function SetUpGenerators() { |
59 %CheckIsBootstrapping(); | 59 %CheckIsBootstrapping(); |
| 60 |
| 61 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by |
| 62 // neither Crankshaft nor TurboFan, disable optimization of wrappers here. |
| 63 %NeverOptimizeFunction(GeneratorObjectNext); |
| 64 %NeverOptimizeFunction(GeneratorObjectThrow); |
| 65 |
| 66 // Set up non-enumerable functions on the generator prototype object. |
60 var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype; | 67 var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype; |
61 InstallFunctions(GeneratorObjectPrototype, | 68 InstallFunctions(GeneratorObjectPrototype, |
62 DONT_ENUM | DONT_DELETE | READ_ONLY, | 69 DONT_ENUM | DONT_DELETE | READ_ONLY, |
63 ["next", GeneratorObjectNext, | 70 ["next", GeneratorObjectNext, |
64 "throw", GeneratorObjectThrow]); | 71 "throw", GeneratorObjectThrow]); |
| 72 |
65 %FunctionSetName(GeneratorObjectIterator, '[Symbol.iterator]'); | 73 %FunctionSetName(GeneratorObjectIterator, '[Symbol.iterator]'); |
66 %AddNamedProperty(GeneratorObjectPrototype, symbolIterator, | 74 %AddNamedProperty(GeneratorObjectPrototype, symbolIterator, |
67 GeneratorObjectIterator, DONT_ENUM | DONT_DELETE | READ_ONLY); | 75 GeneratorObjectIterator, DONT_ENUM | DONT_DELETE | READ_ONLY); |
68 %AddNamedProperty(GeneratorObjectPrototype, "constructor", | 76 %AddNamedProperty(GeneratorObjectPrototype, "constructor", |
69 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); | 77 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); |
70 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype); | 78 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype); |
71 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); | 79 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); |
72 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", | 80 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", |
73 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); | 81 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); |
74 %InternalSetPrototype(GeneratorFunction, $Function); | 82 %InternalSetPrototype(GeneratorFunction, $Function); |
75 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); | 83 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); |
76 } | 84 } |
77 | 85 |
78 SetUpGenerators(); | 86 SetUpGenerators(); |
OLD | NEW |