OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.full_emitter; | 5 library dart2js.js_emitter.full_emitter; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'dart:collection' show HashMap; | 8 import 'dart:collection' show HashMap; |
9 | 9 |
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 body.add(buildCspPrecompiledFunctionFor(outputUnit)); | 1975 body.add(buildCspPrecompiledFunctionFor(outputUnit)); |
1976 } | 1976 } |
1977 body.add( | 1977 body.add( |
1978 js.statement('$setupProgramName(dart, ${typesAccess}.length);')); | 1978 js.statement('$setupProgramName(dart, ${typesAccess}.length);')); |
1979 } | 1979 } |
1980 | 1980 |
1981 body..add(buildMetadata(program, outputUnit)) | 1981 body..add(buildMetadata(program, outputUnit)) |
1982 ..add(js.statement('${typesAccess}.push.apply(${typesAccess}, ' | 1982 ..add(js.statement('${typesAccess}.push.apply(${typesAccess}, ' |
1983 '${namer.deferredTypesName});')); | 1983 '${namer.deferredTypesName});')); |
1984 | 1984 |
1985 // Sets the static state variable to the state of the current isolate | |
1986 // (which is provided as second argument). | |
1987 body.add(js.statement("${namer.staticStateHolder} = arguments[1];")); | |
1988 | |
1989 body.add(buildCompileTimeConstants(fragment.constants, | 1985 body.add(buildCompileTimeConstants(fragment.constants, |
1990 isMainFragment: false)); | 1986 isMainFragment: false)); |
1991 body.add(buildStaticNonFinalFieldInitializations(outputUnit)); | 1987 body.add(buildStaticNonFinalFieldInitializations(outputUnit)); |
1992 | 1988 |
1993 List<jsAst.Statement> statements = <jsAst.Statement>[]; | 1989 List<jsAst.Statement> statements = <jsAst.Statement>[]; |
1994 | 1990 |
1995 statements | 1991 statements |
1996 ..add(buildGeneratedBy()) | 1992 ..add(buildGeneratedBy()) |
1997 ..add(js.statement('${deferredInitializers}.current = ' | 1993 ..add(js.statement('${deferredInitializers}.current = ' |
1998 """function (#) { | 1994 """function (#, ${namer.staticStateHolder}) { |
1999 # | 1995 # |
2000 } | 1996 } |
2001 """, [globalsHolder, body])); | 1997 """, [globalsHolder, body])); |
2002 | 1998 |
2003 result[outputUnit] = new jsAst.Program(statements); | 1999 result[outputUnit] = new jsAst.Program(statements); |
2004 } | 2000 } |
2005 | 2001 |
2006 return result; | 2002 return result; |
2007 } | 2003 } |
2008 | 2004 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2118 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
2123 if (element.isInstanceMember) { | 2119 if (element.isInstanceMember) { |
2124 cachedClassBuilders.remove(element.enclosingClass); | 2120 cachedClassBuilders.remove(element.enclosingClass); |
2125 | 2121 |
2126 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2122 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
2127 | 2123 |
2128 } | 2124 } |
2129 } | 2125 } |
2130 } | 2126 } |
2131 } | 2127 } |
OLD | NEW |