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

Side by Side Diff: src/generator.js

Issue 1053563002: Revert of Correctly compute line numbers in functions from the function constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/cpu-profiler.cc ('k') | src/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return this; 67 return this;
68 } 68 }
69 69
70 function GeneratorFunctionPrototypeConstructor(x) { 70 function GeneratorFunctionPrototypeConstructor(x) {
71 if (%_IsConstructCall()) { 71 if (%_IsConstructCall()) {
72 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']); 72 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
73 } 73 }
74 } 74 }
75 75
76 function GeneratorFunctionConstructor(arg1) { // length == 1 76 function GeneratorFunctionConstructor(arg1) { // length == 1
77 return NewFunctionFromString(arguments, 'function*'); 77 var source = NewFunctionString(arguments, 'function*');
78 var global_proxy = %GlobalProxy(global);
79 // Compile the string in the constructor and not a helper so that errors
80 // appear to come from here.
81 var f = %_CallFunction(global_proxy, %CompileString(source, true));
82 %FunctionMarkNameShouldPrintAsAnonymous(f);
83 return f;
78 } 84 }
79 85
80 86
81 function SetUpGenerators() { 87 function SetUpGenerators() {
82 %CheckIsBootstrapping(); 88 %CheckIsBootstrapping();
83 89
84 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by 90 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by
85 // neither Crankshaft nor TurboFan, disable optimization of wrappers here. 91 // neither Crankshaft nor TurboFan, disable optimization of wrappers here.
86 %NeverOptimizeFunction(GeneratorObjectNext); 92 %NeverOptimizeFunction(GeneratorObjectNext);
87 %NeverOptimizeFunction(GeneratorObjectThrow); 93 %NeverOptimizeFunction(GeneratorObjectThrow);
(...skipping 16 matching lines...) Expand all
104 %AddNamedProperty(GeneratorFunctionPrototype, 110 %AddNamedProperty(GeneratorFunctionPrototype,
105 symbolToStringTag, "GeneratorFunction", DONT_ENUM | READ_ONLY); 111 symbolToStringTag, "GeneratorFunction", DONT_ENUM | READ_ONLY);
106 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); 112 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
107 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", 113 %AddNamedProperty(GeneratorFunctionPrototype, "constructor",
108 GeneratorFunction, DONT_ENUM | READ_ONLY); 114 GeneratorFunction, DONT_ENUM | READ_ONLY);
109 %InternalSetPrototype(GeneratorFunction, $Function); 115 %InternalSetPrototype(GeneratorFunction, $Function);
110 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); 116 %SetCode(GeneratorFunction, GeneratorFunctionConstructor);
111 } 117 }
112 118
113 SetUpGenerators(); 119 SetUpGenerators();
OLDNEW
« no previous file with comments | « src/cpu-profiler.cc ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698