Chromium Code Reviews| 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 1977 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 // The helper uses the non-throwing helper, so we have to register that | |
| 2006 // both are used. | |
| 2007 Element nonThrowingHelper = | |
| 2008 compiler.findHelper(new SourceString(r"$throw")); | |
| 2009 world.registerStaticUse(nonThrowingHelper); | |
|
ngeoffray
2013/04/10 12:06:39
the compilation of throwExpression will figure tha
erikcorry
2013/04/10 12:52:32
Done.
| |
| 2010 | |
| 2011 js.VariableUse jsHelper = | |
| 2012 new js.VariableUse(backend.namer.isolateAccess(helper)); | |
| 2013 js.Call value = new js.Call(jsHelper, [pop()]); | |
| 2014 attachLocation(value, argument); | |
| 2015 push(value, node); | |
| 2016 } | |
| 2017 | |
| 1998 void visitSwitch(HSwitch node) { | 2018 void visitSwitch(HSwitch node) { |
| 1999 // Switches are handled using [visitSwitchInfo]. | 2019 // Switches are handled using [visitSwitchInfo]. |
| 2000 } | 2020 } |
| 2001 | 2021 |
| 2002 void visitStatic(HStatic node) { | 2022 void visitStatic(HStatic node) { |
| 2003 // Check whether this static is used for anything else than as a target in | 2023 // Check whether this static is used for anything else than as a target in |
| 2004 // a static call. | 2024 // a static call. |
| 2005 node.usedBy.forEach((HInstruction instr) { | 2025 node.usedBy.forEach((HInstruction instr) { |
| 2006 if (instr is !HInvokeStatic) { | 2026 if (instr is !HInvokeStatic) { |
| 2007 backend.registerNonCallStaticUse(node); | 2027 backend.registerNonCallStaticUse(node); |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2961 if (leftType.canBeNull() && rightType.canBeNull()) { | 2981 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2962 if (left.isConstantNull() || right.isConstantNull() || | 2982 if (left.isConstantNull() || right.isConstantNull() || |
| 2963 (leftType.isPrimitive() && leftType == rightType)) { | 2983 (leftType.isPrimitive() && leftType == rightType)) { |
| 2964 return '=='; | 2984 return '=='; |
| 2965 } | 2985 } |
| 2966 return null; | 2986 return null; |
| 2967 } else { | 2987 } else { |
| 2968 return '==='; | 2988 return '==='; |
| 2969 } | 2989 } |
| 2970 } | 2990 } |
| OLD | NEW |