| 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 SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
| 8 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
| 9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
| 10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
| (...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4295 if (inputs[0].isInteger(compiler) && inputs[0] is HConstant) { | 4295 if (inputs[0].isInteger(compiler) && inputs[0] is HConstant) { |
| 4296 var constant = inputs[0]; | 4296 var constant = inputs[0]; |
| 4297 if (constant.constant.primitiveValue >= 0) canThrow = false; | 4297 if (constant.constant.primitiveValue >= 0) canThrow = false; |
| 4298 } | 4298 } |
| 4299 HForeign foreign = new HForeign( | 4299 HForeign foreign = new HForeign( |
| 4300 code, elementType, inputs, nativeBehavior: behavior, | 4300 code, elementType, inputs, nativeBehavior: behavior, |
| 4301 canThrow: canThrow); | 4301 canThrow: canThrow); |
| 4302 push(foreign); | 4302 push(foreign); |
| 4303 TypesInferrer inferrer = compiler.typesTask.typesInferrer; | 4303 TypesInferrer inferrer = compiler.typesTask.typesInferrer; |
| 4304 if (inferrer.isFixedArrayCheckedForGrowable(send)) { | 4304 if (inferrer.isFixedArrayCheckedForGrowable(send)) { |
| 4305 js.Template code = js.js.parseForeignJS(r'#.fixed$length = init'); | 4305 js.Template code = js.js.parseForeignJS(r'#.fixed$length = Array'); |
| 4306 // We set the instruction as [canThrow] to avoid it being dead code. | 4306 // We set the instruction as [canThrow] to avoid it being dead code. |
| 4307 // We need a finer grained side effect. | 4307 // We need a finer grained side effect. |
| 4308 add(new HForeign( | 4308 add(new HForeign( |
| 4309 code, backend.nullType, [stack.last], canThrow: true)); | 4309 code, backend.nullType, [stack.last], canThrow: true)); |
| 4310 } | 4310 } |
| 4311 } else if (isGrowableListConstructorCall) { | 4311 } else if (isGrowableListConstructorCall) { |
| 4312 push(buildLiteralList(<HInstruction>[])); | 4312 push(buildLiteralList(<HInstruction>[])); |
| 4313 stack.last.instructionType = elementType; | 4313 stack.last.instructionType = elementType; |
| 4314 } else { | 4314 } else { |
| 4315 ClassElement cls = constructor.enclosingClass; | 4315 ClassElement cls = constructor.enclosingClass; |
| (...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6610 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6610 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6611 unaliased.accept(this, builder); | 6611 unaliased.accept(this, builder); |
| 6612 } | 6612 } |
| 6613 | 6613 |
| 6614 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6614 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6615 JavaScriptBackend backend = builder.compiler.backend; | 6615 JavaScriptBackend backend = builder.compiler.backend; |
| 6616 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6616 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
| 6617 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6617 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
| 6618 } | 6618 } |
| 6619 } | 6619 } |
| OLD | NEW |