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

Side by Side Diff: src/generator.js

Issue 294073002: filter cross context eval (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « no previous file | src/runtime.cc » ('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 25 matching lines...) Expand all
36 if (%_IsConstructCall()) { 36 if (%_IsConstructCall()) {
37 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']); 37 throw MakeTypeError('not_constructor', ['GeneratorFunctionPrototype']);
38 } 38 }
39 } 39 }
40 40
41 function GeneratorFunctionConstructor(arg1) { // length == 1 41 function GeneratorFunctionConstructor(arg1) { // length == 1
42 var source = NewFunctionString(arguments, 'function*'); 42 var source = NewFunctionString(arguments, 'function*');
43 var global_receiver = %GlobalReceiver(global); 43 var global_receiver = %GlobalReceiver(global);
44 // Compile the string in the constructor and not a helper so that errors 44 // Compile the string in the constructor and not a helper so that errors
45 // appear to come from here. 45 // appear to come from here.
46 var f = %_CallFunction(global_receiver, %CompileString(source, true)); 46 var f = %CompileString(source, true);
47 if (!IS_FUNCTION(f)) return f;
48 f = %_CallFunction(global_receiver, f);
47 %FunctionMarkNameShouldPrintAsAnonymous(f); 49 %FunctionMarkNameShouldPrintAsAnonymous(f);
48 return f; 50 return f;
49 } 51 }
50 52
51 53
52 function SetUpGenerators() { 54 function SetUpGenerators() {
53 %CheckIsBootstrapping(); 55 %CheckIsBootstrapping();
54 var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype; 56 var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
55 InstallFunctions(GeneratorObjectPrototype, 57 InstallFunctions(GeneratorObjectPrototype,
56 DONT_ENUM | DONT_DELETE | READ_ONLY, 58 DONT_ENUM | DONT_DELETE | READ_ONLY,
57 ["next", GeneratorObjectNext, 59 ["next", GeneratorObjectNext,
58 "throw", GeneratorObjectThrow]); 60 "throw", GeneratorObjectThrow]);
59 %SetProperty(GeneratorObjectPrototype, "constructor", 61 %SetProperty(GeneratorObjectPrototype, "constructor",
60 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY); 62 GeneratorFunctionPrototype, DONT_ENUM | DONT_DELETE | READ_ONLY);
61 %SetPrototype(GeneratorFunctionPrototype, $Function.prototype); 63 %SetPrototype(GeneratorFunctionPrototype, $Function.prototype);
62 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor); 64 %SetCode(GeneratorFunctionPrototype, GeneratorFunctionPrototypeConstructor);
63 %SetProperty(GeneratorFunctionPrototype, "constructor", 65 %SetProperty(GeneratorFunctionPrototype, "constructor",
64 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY); 66 GeneratorFunction, DONT_ENUM | DONT_DELETE | READ_ONLY);
65 %SetPrototype(GeneratorFunction, $Function); 67 %SetPrototype(GeneratorFunction, $Function);
66 %SetCode(GeneratorFunction, GeneratorFunctionConstructor); 68 %SetCode(GeneratorFunction, GeneratorFunctionConstructor);
67 } 69 }
68 70
69 SetUpGenerators(); 71 SetUpGenerators();
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698