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 ssa; | 5 part of ssa; |
6 | 6 |
7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
8 | 8 |
9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
10 | 10 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 SsaVariableAllocator allocator = new SsaVariableAllocator( | 366 SsaVariableAllocator allocator = new SsaVariableAllocator( |
367 compiler, | 367 compiler, |
368 intervalBuilder.liveInstructions, | 368 intervalBuilder.liveInstructions, |
369 intervalBuilder.liveIntervals, | 369 intervalBuilder.liveIntervals, |
370 generateAtUseSite, | 370 generateAtUseSite, |
371 parameterNames); | 371 parameterNames); |
372 allocator.visitGraph(graph); | 372 allocator.visitGraph(graph); |
373 variableNames = allocator.names; | 373 variableNames = allocator.names; |
374 shouldGroupVarDeclarations = allocator.names.numberOfVariables > 1; | 374 shouldGroupVarDeclarations = allocator.names.numberOfVariables > 1; |
375 | 375 |
376 // Don't register a return type for lazily initialized variables. | |
Søren Gjesse
2012/11/20 08:40:27
Maybe assert that work.element is either FunctionE
| |
377 if (work.element is! FunctionElement) return; | |
378 | |
376 // Register return types to the backend. | 379 // Register return types to the backend. |
377 graph.exit.predecessors.forEach((HBasicBlock block) { | 380 graph.exit.predecessors.forEach((HBasicBlock block) { |
378 HInstruction last = block.last; | 381 HInstruction last = block.last; |
379 assert(last is HGoto || last is HReturn); | 382 assert(last is HGoto || last is HReturn); |
380 if (last is HReturn) { | 383 if (last is HReturn) { |
381 backend.registerReturnType(work.element, types[last.inputs[0]]); | 384 backend.registerReturnType(work.element, types[last.inputs[0]]); |
382 } else { | 385 } else { |
383 backend.registerReturnType(work.element, HType.NULL); | 386 backend.registerReturnType(work.element, HType.NULL); |
384 } | 387 } |
385 }); | 388 }); |
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3105 if (leftType.canBeNull() && rightType.canBeNull()) { | 3108 if (leftType.canBeNull() && rightType.canBeNull()) { |
3106 if (left.isConstantNull() || right.isConstantNull() || | 3109 if (left.isConstantNull() || right.isConstantNull() || |
3107 (leftType.isPrimitive() && leftType == rightType)) { | 3110 (leftType.isPrimitive() && leftType == rightType)) { |
3108 return '=='; | 3111 return '=='; |
3109 } | 3112 } |
3110 return null; | 3113 return null; |
3111 } else { | 3114 } else { |
3112 return '==='; | 3115 return '==='; |
3113 } | 3116 } |
3114 } | 3117 } |
OLD | NEW |