| 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 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 | 1910 |
| 1911 visitThis(HThis node) { | 1911 visitThis(HThis node) { |
| 1912 push(new js.This()); | 1912 push(new js.This()); |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 visitThrow(HThrow node) { | 1915 visitThrow(HThrow node) { |
| 1916 if (node.isRethrow) { | 1916 if (node.isRethrow) { |
| 1917 use(node.inputs[0]); | 1917 use(node.inputs[0]); |
| 1918 pushStatement(new js.Throw(pop()), node); | 1918 pushStatement(new js.Throw(pop()), node); |
| 1919 } else { | 1919 } else { |
| 1920 generateThrowWithHelper(r'$throw', node.inputs[0]); | 1920 generateThrowWithHelper('wrapException', node.inputs[0]); |
| 1921 } | 1921 } |
| 1922 } | 1922 } |
| 1923 | 1923 |
| 1924 visitRangeConversion(HRangeConversion node) { | 1924 visitRangeConversion(HRangeConversion node) { |
| 1925 // Range conversion instructions are removed by the value range | 1925 // Range conversion instructions are removed by the value range |
| 1926 // analyzer. | 1926 // analyzer. |
| 1927 assert(false); | 1927 assert(false); |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 visitBoundsCheck(HBoundsCheck node) { | 1930 visitBoundsCheck(HBoundsCheck node) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 js.VariableUse jsHelper = | 1988 js.VariableUse jsHelper = |
| 1989 new js.VariableUse(backend.namer.isolateAccess(helper)); | 1989 new js.VariableUse(backend.namer.isolateAccess(helper)); |
| 1990 js.Call value = new js.Call(jsHelper, visitArguments([null, argument])); | 1990 js.Call value = new js.Call(jsHelper, visitArguments([null, argument])); |
| 1991 attachLocation(value, argument); | 1991 attachLocation(value, argument); |
| 1992 // BUG(4906): Using throw here adds to the size of the generated code | 1992 // BUG(4906): Using throw here adds to the size of the generated code |
| 1993 // but it has the advantage of explicitly telling the JS engine that | 1993 // but it has the advantage of explicitly telling the JS engine that |
| 1994 // this code path will terminate abruptly. Needs more work. | 1994 // this code path will terminate abruptly. Needs more work. |
| 1995 pushStatement(new js.Throw(value)); | 1995 pushStatement(new js.Throw(value)); |
| 1996 } | 1996 } |
| 1997 | 1997 |
| 1998 visitThrowExpression(HThrowExpression node) { |
| 1999 HInstruction argument = node.inputs[0]; |
| 2000 use(argument); |
| 2001 |
| 2002 Element helper = compiler.findHelper(new SourceString("throwExpression")); |
| 2003 world.registerStaticUse(helper); |
| 2004 |
| 2005 js.VariableUse jsHelper = |
| 2006 new js.VariableUse(backend.namer.isolateAccess(helper)); |
| 2007 js.Call value = new js.Call(jsHelper, [pop()]); |
| 2008 attachLocation(value, argument); |
| 2009 push(value, node); |
| 2010 } |
| 2011 |
| 1998 void visitSwitch(HSwitch node) { | 2012 void visitSwitch(HSwitch node) { |
| 1999 // Switches are handled using [visitSwitchInfo]. | 2013 // Switches are handled using [visitSwitchInfo]. |
| 2000 } | 2014 } |
| 2001 | 2015 |
| 2002 void visitStatic(HStatic node) { | 2016 void visitStatic(HStatic node) { |
| 2003 // Check whether this static is used for anything else than as a target in | 2017 // Check whether this static is used for anything else than as a target in |
| 2004 // a static call. | 2018 // a static call. |
| 2005 node.usedBy.forEach((HInstruction instr) { | 2019 node.usedBy.forEach((HInstruction instr) { |
| 2006 if (instr is !HInvokeStatic) { | 2020 if (instr is !HInvokeStatic) { |
| 2007 backend.registerNonCallStaticUse(node); | 2021 backend.registerNonCallStaticUse(node); |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2961 if (leftType.canBeNull() && rightType.canBeNull()) { | 2975 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2962 if (left.isConstantNull() || right.isConstantNull() || | 2976 if (left.isConstantNull() || right.isConstantNull() || |
| 2963 (leftType.isPrimitive() && leftType == rightType)) { | 2977 (leftType.isPrimitive() && leftType == rightType)) { |
| 2964 return '=='; | 2978 return '=='; |
| 2965 } | 2979 } |
| 2966 return null; | 2980 return null; |
| 2967 } else { | 2981 } else { |
| 2968 return '==='; | 2982 return '==='; |
| 2969 } | 2983 } |
| 2970 } | 2984 } |
| OLD | NEW |