 Chromium Code Reviews
 Chromium Code Reviews Issue 10825386:
  Use JavaScript runtime semantics when constant folding.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 10825386:
  Use JavaScript runtime semantics when constant folding.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| 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 /** | 6 /** | 
| 7 * If true, print a warning for each method that was resolved, but not | 7 * If true, print a warning for each method that was resolved, but not | 
| 8 * compiled. | 8 * compiled. | 
| 9 */ | 9 */ | 
| 10 const bool REPORT_EXCESS_RESOLUTION = false; | 10 const bool REPORT_EXCESS_RESOLUTION = false; | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 int phase; | 175 int phase; | 
| 176 | 176 | 
| 177 bool compilationFailed = false; | 177 bool compilationFailed = false; | 
| 178 | 178 | 
| 179 bool hasCrashed = false; | 179 bool hasCrashed = false; | 
| 180 | 180 | 
| 181 Compiler([this.tracer = const Tracer(), | 181 Compiler([this.tracer = const Tracer(), | 
| 182 this.enableTypeAssertions = false, | 182 this.enableTypeAssertions = false, | 
| 183 this.enableUserAssertions = false, | 183 this.enableUserAssertions = false, | 
| 184 this.enableMinification = false, | 184 this.enableMinification = false, | 
| 185 bool emitJavascript = true, | 185 bool emitJavaScript = true, | 
| 186 bool generateSourceMap = true, | 186 bool generateSourceMap = true, | 
| 187 bool cutDeclarationTypes = false]) | 187 bool cutDeclarationTypes = false]) | 
| 188 : libraries = new Map<String, LibraryElement>(), | 188 : libraries = new Map<String, LibraryElement>(), | 
| 189 world = new World(), | 189 world = new World(), | 
| 190 progress = new Stopwatch.start() { | 190 progress = new Stopwatch.start() { | 
| 191 namer = new Namer(this); | 191 namer = new Namer(this); | 
| 192 constantHandler = new ConstantHandler(this); | 192 constantHandler = | 
| 193 new ConstantHandler(this, | |
| 194 emitJavaScript | |
| 
kasperl
2012/09/04 05:57:30
I would definitely compute the constant system and
 
floitsch
2012/09/04 13:10:42
Done.
 | |
| 195 ? const JavaScriptConstantSystem() | |
| 
kasperl
2012/09/04 05:57:30
JAVA_SCRIPT_CONSTANT_SYSTEM?
 
floitsch
2012/09/04 13:10:42
Done.
 | |
| 196 : const DartConstantSystem()); | |
| 
kasperl
2012/09/04 05:57:30
DART_CONSTANT_SYSTEM?
 
floitsch
2012/09/04 13:10:42
Done.
 | |
| 193 scanner = new ScannerTask(this); | 197 scanner = new ScannerTask(this); | 
| 194 dietParser = new DietParserTask(this); | 198 dietParser = new DietParserTask(this); | 
| 195 parser = new ParserTask(this); | 199 parser = new ParserTask(this); | 
| 196 patchParser = new PatchParserTask(this); | 200 patchParser = new PatchParserTask(this); | 
| 197 validator = new TreeValidatorTask(this); | 201 validator = new TreeValidatorTask(this); | 
| 198 resolver = new ResolverTask(this); | 202 resolver = new ResolverTask(this); | 
| 199 closureToClassMapper = new closureMapping.ClosureTask(this); | 203 closureToClassMapper = new closureMapping.ClosureTask(this); | 
| 200 checker = new TypeCheckerTask(this); | 204 checker = new TypeCheckerTask(this); | 
| 201 typesTask = new ti.TypesTask(this); | 205 typesTask = new ti.TypesTask(this); | 
| 202 backend = emitJavascript ? | 206 backend = emitJavaScript ? | 
| 203 new js_backend.JavaScriptBackend(this, generateSourceMap) : | 207 new js_backend.JavaScriptBackend(this, generateSourceMap) : | 
| 204 new dart_backend.DartBackend(this, cutDeclarationTypes); | 208 new dart_backend.DartBackend(this, cutDeclarationTypes); | 
| 205 enqueuer = new EnqueueTask(this); | 209 enqueuer = new EnqueueTask(this); | 
| 206 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, | 210 tasks = [scanner, dietParser, parser, resolver, closureToClassMapper, | 
| 207 checker, typesTask, constantHandler, enqueuer]; | 211 checker, typesTask, constantHandler, enqueuer]; | 
| 208 tasks.addAll(backend.tasks); | 212 tasks.addAll(backend.tasks); | 
| 209 } | 213 } | 
| 210 | 214 | 
| 211 Universe get resolverWorld => enqueuer.resolution.universe; | 215 Universe get resolverWorld => enqueuer.resolution.universe; | 
| 212 Universe get codegenWorld => enqueuer.codegen.universe; | 216 Universe get codegenWorld => enqueuer.codegen.universe; | 
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 908 final endOffset = end.charOffset + end.slowCharCount; | 912 final endOffset = end.charOffset + end.slowCharCount; | 
| 909 | 913 | 
| 910 // [begin] and [end] might be the same for the same empty token. This | 914 // [begin] and [end] might be the same for the same empty token. This | 
| 911 // happens for instance when scanning '$$'. | 915 // happens for instance when scanning '$$'. | 
| 912 assert(endOffset >= beginOffset); | 916 assert(endOffset >= beginOffset); | 
| 913 return f(beginOffset, endOffset); | 917 return f(beginOffset, endOffset); | 
| 914 } | 918 } | 
| 915 | 919 | 
| 916 String toString() => 'SourceSpan($uri, $begin, $end)'; | 920 String toString() => 'SourceSpan($uri, $begin, $end)'; | 
| 917 } | 921 } | 
| OLD | NEW |