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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 ClassElement noSideEffectsClass; | 326 ClassElement noSideEffectsClass; |
327 ClassElement noThrowsClass; | 327 ClassElement noThrowsClass; |
328 ClassElement noInlineClass; | 328 ClassElement noInlineClass; |
329 ClassElement forceInlineClass; | 329 ClassElement forceInlineClass; |
330 ClassElement irRepresentationClass; | 330 ClassElement irRepresentationClass; |
331 | 331 |
332 Element getInterceptorMethod; | 332 Element getInterceptorMethod; |
333 | 333 |
334 ClassElement jsInvocationMirrorClass; | 334 ClassElement jsInvocationMirrorClass; |
335 | 335 |
336 /// If [true], the compiler will emit code that writes the name of the current | 336 /// If [true], the compiler will emit code that logs whenever a method is |
337 /// method together with its class and library to the console the first time | 337 /// called. When TRACE_METHOD is 'console' this will be logged |
338 /// the method is called. | 338 /// directly in the JavaScript console. When TRACE_METHOD is 'post' the |
339 static const bool TRACE_CALLS = false; | 339 /// information will be sent to a server via a POST request. |
| 340 static const String TRACE_METHOD = const String.fromEnvironment('traceCalls'); |
| 341 static const bool TRACE_CALLS = |
| 342 TRACE_METHOD == 'post' || TRACE_METHOD == 'console'; |
340 Element traceHelper; | 343 Element traceHelper; |
341 | 344 |
342 TypeMask get stringType => compiler.typesTask.stringType; | 345 TypeMask get stringType => compiler.typesTask.stringType; |
343 TypeMask get doubleType => compiler.typesTask.doubleType; | 346 TypeMask get doubleType => compiler.typesTask.doubleType; |
344 TypeMask get intType => compiler.typesTask.intType; | 347 TypeMask get intType => compiler.typesTask.intType; |
345 TypeMask get uint32Type => compiler.typesTask.uint32Type; | 348 TypeMask get uint32Type => compiler.typesTask.uint32Type; |
346 TypeMask get uint31Type => compiler.typesTask.uint31Type; | 349 TypeMask get uint31Type => compiler.typesTask.uint31Type; |
347 TypeMask get positiveIntType => compiler.typesTask.positiveIntType; | 350 TypeMask get positiveIntType => compiler.typesTask.positiveIntType; |
348 TypeMask get numType => compiler.typesTask.numType; | 351 TypeMask get numType => compiler.typesTask.numType; |
349 TypeMask get boolType => compiler.typesTask.boolType; | 352 TypeMask get boolType => compiler.typesTask.boolType; |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 addInterceptors(jsNullClass, world, registry); | 1156 addInterceptors(jsNullClass, world, registry); |
1154 if (compiler.enableTypeAssertions) { | 1157 if (compiler.enableTypeAssertions) { |
1155 // Unconditionally register the helper that checks if the | 1158 // Unconditionally register the helper that checks if the |
1156 // expression in an if/while/for is a boolean. | 1159 // expression in an if/while/for is a boolean. |
1157 // TODO(ngeoffray): Should we have the resolver register those instead? | 1160 // TODO(ngeoffray): Should we have the resolver register those instead? |
1158 Element e = findHelper('boolConversionCheck'); | 1161 Element e = findHelper('boolConversionCheck'); |
1159 if (e != null) enqueue(world, e, registry); | 1162 if (e != null) enqueue(world, e, registry); |
1160 } | 1163 } |
1161 | 1164 |
1162 if (TRACE_CALLS) { | 1165 if (TRACE_CALLS) { |
1163 traceHelper = findHelper('traceHelper'); | 1166 traceHelper = findHelper( |
| 1167 TRACE_METHOD == 'console' ? 'consoleTraceHelper' : 'postTraceHelper'); |
1164 assert(traceHelper != null); | 1168 assert(traceHelper != null); |
1165 enqueueInResolution(traceHelper, registry); | 1169 enqueueInResolution(traceHelper, registry); |
1166 } | 1170 } |
1167 registerCheckedModeHelpers(registry); | 1171 registerCheckedModeHelpers(registry); |
1168 } | 1172 } |
1169 | 1173 |
1170 onResolutionComplete() { | 1174 onResolutionComplete() { |
1171 super.onResolutionComplete(); | 1175 super.onResolutionComplete(); |
1172 computeMembersNeededForReflection(); | 1176 computeMembersNeededForReflection(); |
1173 rti.computeClassesNeedingRti(); | 1177 rti.computeClassesNeedingRti(); |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3069 } | 3073 } |
3070 } | 3074 } |
3071 | 3075 |
3072 /// Records that [constant] is used by the element behind [registry]. | 3076 /// Records that [constant] is used by the element behind [registry]. |
3073 class Dependency { | 3077 class Dependency { |
3074 final ConstantValue constant; | 3078 final ConstantValue constant; |
3075 final Element annotatedElement; | 3079 final Element annotatedElement; |
3076 | 3080 |
3077 const Dependency(this.constant, this.annotatedElement); | 3081 const Dependency(this.constant, this.annotatedElement); |
3078 } | 3082 } |
OLD | NEW |