Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 2396323004: Bug fix - use type of input, not type of result, for throw-on-null check (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/js_spec_optimization_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 HForeignCode.statement(js.Template codeTemplate, List<HInstruction> inputs, 1906 HForeignCode.statement(js.Template codeTemplate, List<HInstruction> inputs,
1907 SideEffects effects, native.NativeBehavior nativeBehavior, TypeMask type) 1907 SideEffects effects, native.NativeBehavior nativeBehavior, TypeMask type)
1908 : this(codeTemplate, type, inputs, 1908 : this(codeTemplate, type, inputs,
1909 isStatement: true, 1909 isStatement: true,
1910 effects: effects, 1910 effects: effects,
1911 nativeBehavior: nativeBehavior); 1911 nativeBehavior: nativeBehavior);
1912 1912
1913 accept(HVisitor visitor) => visitor.visitForeignCode(this); 1913 accept(HVisitor visitor) => visitor.visitForeignCode(this);
1914 1914
1915 bool isJsStatement() => isStatement; 1915 bool isJsStatement() => isStatement;
1916 bool canThrow() => 1916 bool canThrow() {
1917 canBeNull() ? throwBehavior.canThrow : throwBehavior.onNonNull.canThrow; 1917 if (inputs.length > 0) {
1918 return inputs.first.canBeNull()
1919 ? throwBehavior.canThrow
1920 : throwBehavior.onNonNull.canThrow;
1921 }
1922 return throwBehavior.canThrow;
1923 }
1918 1924
1919 bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard; 1925 bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard;
1920 1926
1921 bool get isAllocation => 1927 bool get isAllocation =>
1922 nativeBehavior != null && nativeBehavior.isAllocation && !canBeNull(); 1928 nativeBehavior != null && nativeBehavior.isAllocation && !canBeNull();
1923 1929
1924 String toString() => 'HForeignCode("${codeTemplate.source}",$inputs)'; 1930 String toString() => 'HForeignCode("${codeTemplate.source}",$inputs)';
1925 } 1931 }
1926 1932
1927 abstract class HInvokeBinary extends HInstruction { 1933 abstract class HInvokeBinary extends HInstruction {
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3448 class HDynamicType extends HRuntimeType { 3454 class HDynamicType extends HRuntimeType {
3449 HDynamicType(DynamicType dartType, TypeMask instructionType) 3455 HDynamicType(DynamicType dartType, TypeMask instructionType)
3450 : super(const <HInstruction>[], dartType, instructionType); 3456 : super(const <HInstruction>[], dartType, instructionType);
3451 3457
3452 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3458 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3453 3459
3454 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3460 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3455 3461
3456 bool typeEquals(HInstruction other) => other is HDynamicType; 3462 bool typeEquals(HInstruction other) => other is HDynamicType;
3457 } 3463 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/js_spec_optimization_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698