OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 world.stringImplType.markUsed(); | 82 world.stringImplType.markUsed(); |
83 | 83 |
84 if (corejs.useIndex || corejs.useSetIndex) { | 84 if (corejs.useIndex || corejs.useSetIndex) { |
85 if (!options.disableBoundsChecks) { | 85 if (!options.disableBoundsChecks) { |
86 // These exceptions might be thrown by array bounds checks. | 86 // These exceptions might be thrown by array bounds checks. |
87 markTypeUsed(world.corelib.types['IndexOutOfRangeException']); | 87 markTypeUsed(world.corelib.types['IndexOutOfRangeException']); |
88 markTypeUsed(world.corelib.types['IllegalArgumentException']); | 88 markTypeUsed(world.corelib.types['IllegalArgumentException']); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 // Only include isolate-specific code if isolates are used. | 92 // Only wrap the app as an isolate if the isolate library was imported. |
93 if (world.corelib.types['Isolate'].isUsed | 93 if (world.isolatelib != null) { |
94 || world.coreimpl.types['ReceivePortImpl'].isUsed) { | |
95 | |
96 // Generate callbacks from JS to isolate code if needed | |
97 if (corejs.useWrap0 || corejs.useWrap1) { | |
98 genMethod(world.coreimpl.types['IsolateContext'].getMember('eval')); | |
99 genMethod(world.coreimpl.types['EventLoop'].getMember('run')); | |
100 } | |
101 | |
102 corejs.useIsolates = true; | 94 corejs.useIsolates = true; |
103 MethodMember isolateMain = | 95 MethodMember isolateMain = |
104 world.coreimpl.lookup('startRootIsolate', main.span); | 96 world.isolatelib.lookup('startRootIsolate', main.span); |
105 var isolateMainTarget = new TypeValue(world.coreimpl.topType, main.span); | 97 mainCall = isolateMain.invoke(mainContext, null, |
106 mainCall = isolateMain.invoke(mainContext, null, isolateMainTarget, | 98 new TypeValue(world.isolatelib.topType, main.span), |
107 new Arguments(null, [main._get(mainContext, main.definition, null)])); | 99 new Arguments(null, [main._get(mainContext, main.definition, null)])); |
108 } | 100 } |
109 | 101 |
110 writeTypes(world.coreimpl); | 102 writeTypes(world.coreimpl); |
111 writeTypes(world.corelib); | 103 writeTypes(world.corelib); |
112 | 104 |
113 // Write the main library. This will cause all libraries to be written in | 105 // Write the main library. This will cause all libraries to be written in |
114 // the topological sort order. | 106 // the topological sort order. |
115 writeTypes(main.declaringType.library); | 107 writeTypes(main.declaringType.library); |
116 | 108 |
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 return true; | 2450 return true; |
2459 } | 2451 } |
2460 | 2452 |
2461 } | 2453 } |
2462 | 2454 |
2463 class ReturnKind { | 2455 class ReturnKind { |
2464 static final int IGNORE = 1; | 2456 static final int IGNORE = 1; |
2465 static final int POST = 2; | 2457 static final int POST = 2; |
2466 static final int PRE = 3; | 2458 static final int PRE = 3; |
2467 } | 2459 } |
OLD | NEW |