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 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 Element element = node.element; | 2040 Element element = node.element; |
2041 world.registerStaticUse(element); | 2041 world.registerStaticUse(element); |
2042 String lazyGetter = backend.namer.isolateLazyInitializerAccess(element); | 2042 String lazyGetter = backend.namer.isolateLazyInitializerAccess(element); |
2043 js.VariableUse target = new js.VariableUse(lazyGetter); | 2043 js.VariableUse target = new js.VariableUse(lazyGetter); |
2044 js.Call call = new js.Call(target, <js.Expression>[]); | 2044 js.Call call = new js.Call(target, <js.Expression>[]); |
2045 push(call, node); | 2045 push(call, node); |
2046 } | 2046 } |
2047 | 2047 |
2048 void visitStaticStore(HStaticStore node) { | 2048 void visitStaticStore(HStaticStore node) { |
2049 world.registerStaticUse(node.element); | 2049 world.registerStaticUse(node.element); |
2050 js.VariableUse variableUse = | 2050 js.VariableUse isolate = new js.VariableUse(backend.namer.CURRENT_ISOLATE); |
2051 new js.VariableUse(backend.namer.isolateAccess(node.element)); | 2051 // Create a property access to make sure expressions and variable |
| 2052 // declarations recognizers don't see this assignment as a local |
| 2053 // assignment. |
| 2054 js.Node variable = new js.PropertyAccess.field( |
| 2055 isolate, backend.namer.getName(node.element)); |
2052 use(node.inputs[0]); | 2056 use(node.inputs[0]); |
2053 push(new js.Assignment(variableUse, pop()), node); | 2057 push(new js.Assignment(variable, pop()), node); |
2054 } | 2058 } |
2055 | 2059 |
2056 void visitStringConcat(HStringConcat node) { | 2060 void visitStringConcat(HStringConcat node) { |
2057 use(node.left); | 2061 use(node.left); |
2058 js.Expression jsLeft = pop(); | 2062 js.Expression jsLeft = pop(); |
2059 use(node.right); | 2063 use(node.right); |
2060 push(new js.Binary('+', jsLeft, pop()), node); | 2064 push(new js.Binary('+', jsLeft, pop()), node); |
2061 } | 2065 } |
2062 | 2066 |
2063 void visitStringify(HStringify node) { | 2067 void visitStringify(HStringify node) { |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3037 if (leftType.canBeNull() && rightType.canBeNull()) { | 3041 if (leftType.canBeNull() && rightType.canBeNull()) { |
3038 if (left.isConstantNull() || right.isConstantNull() || | 3042 if (left.isConstantNull() || right.isConstantNull() || |
3039 (leftType.isPrimitive() && leftType == rightType)) { | 3043 (leftType.isPrimitive() && leftType == rightType)) { |
3040 return '=='; | 3044 return '=='; |
3041 } | 3045 } |
3042 return null; | 3046 return null; |
3043 } else { | 3047 } else { |
3044 return '==='; | 3048 return '==='; |
3045 } | 3049 } |
3046 } | 3050 } |
OLD | NEW |