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

Side by Side Diff: frog/gen.dart

Issue 8577003: Convert most of the javascript isolate code into Dart, inject JS code only when (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Top level generator object for writing code and keeping track of 6 * Top level generator object for writing code and keeping track of
7 * dependencies. 7 * dependencies.
8 * 8 *
9 * Should have two compilation models, but only one implemented so far. 9 * Should have two compilation models, but only one implemented so far.
10 * 10 *
(...skipping 19 matching lines...) Expand all
30 30
31 // TODO(jimhug): Better way to capture hidden control flow. 31 // TODO(jimhug): Better way to capture hidden control flow.
32 world.corelib.types['BadNumberFormatException'].markUsed(); 32 world.corelib.types['BadNumberFormatException'].markUsed();
33 world.coreimpl.types['NumImplementation'].markUsed(); 33 world.coreimpl.types['NumImplementation'].markUsed();
34 world.coreimpl.types['StringImplementation'].markUsed(); 34 world.coreimpl.types['StringImplementation'].markUsed();
35 world.coreimpl.types['MatchImplementation'].markUsed(); 35 world.coreimpl.types['MatchImplementation'].markUsed();
36 genMethod(world.coreimpl.types['MatchImplementation'].getConstructor('')); 36 genMethod(world.coreimpl.types['MatchImplementation'].getConstructor(''));
37 genMethod( 37 genMethod(
38 world.coreimpl.types['StringImplementation'].getMember('contains')); 38 world.coreimpl.types['StringImplementation'].getMember('contains'));
39 39
40 // Only include isolate-specific code if isolates are used.
41 if (world.corelib.types['Isolate'].isUsed
42 || world.coreimpl.types['ReceivePortImpl'].isUsed) {
43 corejs.useIsolates = true;
44 MethodMember isolateMain =
45 world.coreimpl.topType.resolveMember('startAsIsolate').members[0];
46 mainCall = isolateMain.invoke(metaGen, null, null,
47 new Arguments(null, [main._get(metaGen, main.definition, null)]));
48 }
49
40 writeTypes(world.coreimpl); 50 writeTypes(world.coreimpl);
41 writeTypes(world.corelib); 51 writeTypes(world.corelib);
42 52
43 // Write the main library. This will cause all libraries to be written in 53 // Write the main library. This will cause all libraries to be written in
44 // the topographic sort order. 54 // the topographic sort order.
45 writeTypes(main.declaringType.library); 55 writeTypes(main.declaringType.library);
46 56
47 _writeGlobals(); 57 _writeGlobals();
48 writer.writeln('RunEntry(function() {${mainCall.code};}, []);'); 58 writer.writeln('${mainCall.code};');
49 } 59 }
50 60
51 GlobalValue globalForStaticField(FieldMember field, Value fieldValue, 61 GlobalValue globalForStaticField(FieldMember field, Value fieldValue,
52 List<Value> dependencies) { 62 List<Value> dependencies) {
53 var fullname = "${field.declaringType.jsname}.${field.jsname}"; 63 var fullname = "${field.declaringType.jsname}.${field.jsname}";
54 if (!globals.containsKey(fullname)) { 64 if (!globals.containsKey(fullname)) {
55 globals[fullname] = new GlobalValue.fromStatic( 65 globals[fullname] = new GlobalValue.fromStatic(
56 field, fieldValue, dependencies); 66 field, fieldValue, dependencies);
57 } 67 }
58 return globals[fullname]; 68 return globals[fullname];
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); 2248 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false));
2239 } 2249 }
2240 for (int i = bareCount; i < length; i++) { 2250 for (int i = bareCount; i < length; i++) {
2241 var name = getName(i); 2251 var name = getName(i);
2242 if (name == null) name = '\$$i'; 2252 if (name == null) name = '\$$i';
2243 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); 2253 result.add(new Value(world.varType, name, null, /*needsTemp:*/false));
2244 } 2254 }
2245 return new Arguments(nodes, result); 2255 return new Arguments(nodes, result);
2246 } 2256 }
2247 } 2257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698