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

Side by Side Diff: src/generator.js

Issue 701093003: Correctly compute line numbers in functions from the function constructor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 26 matching lines...) Expand all
37 return this; 37 return this;
38 } 38 }
39 39
40 function GeneratorFunctionPrototypeConstructor(x) { 40 function GeneratorFunctionPrototypeConstructor(x) {
41 if (%_IsConstructCall()) { 41 if (%_IsConstructCall()) {
42 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']); 42 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
43 } 43 }
44 } 44 }
45 45
46 function GeneratorFunctionConstructor(arg1) { // length == 1 46 function GeneratorFunctionConstructor(arg1) { // length == 1
47 var source = NewFunctionString(arguments, 'function*'); 47 return NewFunctionFromString(arguments, 'function*');
48 var global_proxy = %GlobalProxy(global);
49 // Compile the string in the constructor and not a helper so that errors
50 // appear to come from here.
51 var f = %_CallFunction(global_proxy, %CompileString(source, true));
52 %FunctionMarkNameShouldPrintAsAnonymous(f);
53 return f;
54 } 48 }
55 49
56 50
57 function SetUpGenerators() { 51 function SetUpGenerators() {
58 %CheckIsBootstrapping(); 52 %CheckIsBootstrapping();
59 53
60 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by 54 // Both Runtime_GeneratorNext and Runtime_GeneratorThrow are supported by
61 // neither Crankshaft nor TurboFan, disable optimization of wrappers here. 55 // neither Crankshaft nor TurboFan, disable optimization of wrappers here.
62 %NeverOptimizeFunction(GeneratorObjectNext); 56 %NeverOptimizeFunction(GeneratorObjectNext);
63 %NeverOptimizeFunction(GeneratorObjectThrow); 57 %NeverOptimizeFunction(GeneratorObjectThrow);
(...skipping 14 matching lines...) Expand all
78 symbolToStringTag, "Generator", DONT_ENUM | READ_ONLY); 72 symbolToStringTag, "Generator", DONT_ENUM | READ_ONLY);
79 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype); 73 %InternalSetPrototype(GeneratorFunctionPrototype, $Function.prototype);
80 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); 74 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
81 %AddNamedProperty(GeneratorFunctionPrototype, "constructor", 75 %AddNamedProperty(GeneratorFunctionPrototype, "constructor",
82 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); 76 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
83 %InternalSetPrototype(GeneratorFunction, $Function); 77 %InternalSetPrototype(GeneratorFunction, $Function);
84 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); 78 %SetCode(GeneratorFunction, GeneratorFunctionConstructor);
85 } 79 }
86 80
87 SetUpGenerators(); 81 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