| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 final JavaScriptBackend backend; | 6 final JavaScriptBackend backend; |
| 7 SsaCodeGeneratorTask(JavaScriptBackend backend) | 7 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 8 : this.backend = backend, | 8 : this.backend = backend, |
| 9 super(backend.compiler); | 9 super(backend.compiler); |
| 10 String get name() => 'SSA code generator'; | 10 String get name() => 'SSA code generator'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // $.staticFun = function() { | 28 // $.staticFun = function() { |
| 29 // ... | 29 // ... |
| 30 // }; | 30 // }; |
| 31 if (element.isInstanceMember() || | 31 if (element.isInstanceMember() || |
| 32 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { | 32 element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { |
| 33 extraSpace = " "; | 33 extraSpace = " "; |
| 34 } | 34 } |
| 35 | 35 |
| 36 String code = 'function($parameters) {\n$body$extraSpace}'; | 36 String code = 'function($parameters) {\n$body$extraSpace}'; |
| 37 List<SourceMappingEntry> sourceMappings = new List<SourceMappingEntry>(); | 37 List<SourceMappingEntry> sourceMappings = new List<SourceMappingEntry>(); |
| 38 SourceFile sourceFile = element.getCompilationUnit().script.file; | 38 SourceFile sourceFile = element.getScript().file; |
| 39 FunctionExpression expression = element.cachedNode; | 39 FunctionExpression expression = element.cachedNode; |
| 40 sourceMappings.add(new SourceMappingEntry( | 40 sourceMappings.add(new SourceMappingEntry( |
| 41 sourceFile, expression.getBeginToken().charOffset, 0)); | 41 sourceFile, expression.getBeginToken().charOffset, 0)); |
| 42 sourceMappings.add(new SourceMappingEntry( | 42 sourceMappings.add(new SourceMappingEntry( |
| 43 sourceFile, expression.getEndToken().charOffset, code.length - 1)); | 43 sourceFile, expression.getEndToken().charOffset, code.length - 1)); |
| 44 return new CodeBlock(code, sourceMappings); | 44 return new CodeBlock(code, sourceMappings); |
| 45 } | 45 } |
| 46 | 46 |
| 47 CodeBlock generateMethod(WorkItem work, HGraph graph) { | 47 CodeBlock generateMethod(WorkItem work, HGraph graph) { |
| 48 return measure(() { | 48 return measure(() { |
| (...skipping 3062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3111 if (leftType.canBeNull() && rightType.canBeNull()) { | 3111 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 3112 if (left.isConstantNull() || right.isConstantNull() || | 3112 if (left.isConstantNull() || right.isConstantNull() || |
| 3113 (leftType.isPrimitive() && leftType == rightType)) { | 3113 (leftType.isPrimitive() && leftType == rightType)) { |
| 3114 return '=='; | 3114 return '=='; |
| 3115 } | 3115 } |
| 3116 return null; | 3116 return null; |
| 3117 } else { | 3117 } else { |
| 3118 return '==='; | 3118 return '==='; |
| 3119 } | 3119 } |
| 3120 } | 3120 } |
| OLD | NEW |