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

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

Issue 2306203002: Rename HForeignNew -> HCreate (Closed)
Patch Set: Created 4 years, 3 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
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 18 matching lines...) Expand all
29 R visitAwait(HAwait node); 29 R visitAwait(HAwait node);
30 R visitBitAnd(HBitAnd node); 30 R visitBitAnd(HBitAnd node);
31 R visitBitNot(HBitNot node); 31 R visitBitNot(HBitNot node);
32 R visitBitOr(HBitOr node); 32 R visitBitOr(HBitOr node);
33 R visitBitXor(HBitXor node); 33 R visitBitXor(HBitXor node);
34 R visitBoolify(HBoolify node); 34 R visitBoolify(HBoolify node);
35 R visitBoundsCheck(HBoundsCheck node); 35 R visitBoundsCheck(HBoundsCheck node);
36 R visitBreak(HBreak node); 36 R visitBreak(HBreak node);
37 R visitConstant(HConstant node); 37 R visitConstant(HConstant node);
38 R visitContinue(HContinue node); 38 R visitContinue(HContinue node);
39 R visitCreate(HCreate node);
39 R visitDivide(HDivide node); 40 R visitDivide(HDivide node);
40 R visitExit(HExit node); 41 R visitExit(HExit node);
41 R visitExitTry(HExitTry node); 42 R visitExitTry(HExitTry node);
42 R visitFieldGet(HFieldGet node); 43 R visitFieldGet(HFieldGet node);
43 R visitFieldSet(HFieldSet node); 44 R visitFieldSet(HFieldSet node);
44 R visitForeignCode(HForeignCode node); 45 R visitForeignCode(HForeignCode node);
45 R visitForeignNew(HForeignNew node);
46 R visitGoto(HGoto node); 46 R visitGoto(HGoto node);
47 R visitGreater(HGreater node); 47 R visitGreater(HGreater node);
48 R visitGreaterEqual(HGreaterEqual node); 48 R visitGreaterEqual(HGreaterEqual node);
49 R visitIdentity(HIdentity node); 49 R visitIdentity(HIdentity node);
50 R visitIf(HIf node); 50 R visitIf(HIf node);
51 R visitIndex(HIndex node); 51 R visitIndex(HIndex node);
52 R visitIndexAssign(HIndexAssign node); 52 R visitIndexAssign(HIndexAssign node);
53 R visitInterceptor(HInterceptor node); 53 R visitInterceptor(HInterceptor node);
54 R visitInvokeClosure(HInvokeClosure node); 54 R visitInvokeClosure(HInvokeClosure node);
55 R visitInvokeDynamicGetter(HInvokeDynamicGetter node); 55 R visitInvokeDynamicGetter(HInvokeDynamicGetter node);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 visitBitAnd(HBitAnd node) => visitBinaryBitOp(node); 321 visitBitAnd(HBitAnd node) => visitBinaryBitOp(node);
322 visitBitNot(HBitNot node) => visitInvokeUnary(node); 322 visitBitNot(HBitNot node) => visitInvokeUnary(node);
323 visitBitOr(HBitOr node) => visitBinaryBitOp(node); 323 visitBitOr(HBitOr node) => visitBinaryBitOp(node);
324 visitBitXor(HBitXor node) => visitBinaryBitOp(node); 324 visitBitXor(HBitXor node) => visitBinaryBitOp(node);
325 visitBoolify(HBoolify node) => visitInstruction(node); 325 visitBoolify(HBoolify node) => visitInstruction(node);
326 visitBoundsCheck(HBoundsCheck node) => visitCheck(node); 326 visitBoundsCheck(HBoundsCheck node) => visitCheck(node);
327 visitBreak(HBreak node) => visitJump(node); 327 visitBreak(HBreak node) => visitJump(node);
328 visitContinue(HContinue node) => visitJump(node); 328 visitContinue(HContinue node) => visitJump(node);
329 visitCheck(HCheck node) => visitInstruction(node); 329 visitCheck(HCheck node) => visitInstruction(node);
330 visitConstant(HConstant node) => visitInstruction(node); 330 visitConstant(HConstant node) => visitInstruction(node);
331 visitCreate(HCreate node) => visitInstruction(node);
331 visitDivide(HDivide node) => visitBinaryArithmetic(node); 332 visitDivide(HDivide node) => visitBinaryArithmetic(node);
332 visitExit(HExit node) => visitControlFlow(node); 333 visitExit(HExit node) => visitControlFlow(node);
333 visitExitTry(HExitTry node) => visitControlFlow(node); 334 visitExitTry(HExitTry node) => visitControlFlow(node);
334 visitFieldGet(HFieldGet node) => visitFieldAccess(node); 335 visitFieldGet(HFieldGet node) => visitFieldAccess(node);
335 visitFieldSet(HFieldSet node) => visitFieldAccess(node); 336 visitFieldSet(HFieldSet node) => visitFieldAccess(node);
336 visitForeignCode(HForeignCode node) => visitInstruction(node); 337 visitForeignCode(HForeignCode node) => visitInstruction(node);
337 visitForeignNew(HForeignNew node) => visitInstruction(node);
338 visitGoto(HGoto node) => visitControlFlow(node); 338 visitGoto(HGoto node) => visitControlFlow(node);
339 visitGreater(HGreater node) => visitRelational(node); 339 visitGreater(HGreater node) => visitRelational(node);
340 visitGreaterEqual(HGreaterEqual node) => visitRelational(node); 340 visitGreaterEqual(HGreaterEqual node) => visitRelational(node);
341 visitIdentity(HIdentity node) => visitRelational(node); 341 visitIdentity(HIdentity node) => visitRelational(node);
342 visitIf(HIf node) => visitConditionalBranch(node); 342 visitIf(HIf node) => visitConditionalBranch(node);
343 visitIndex(HIndex node) => visitInstruction(node); 343 visitIndex(HIndex node) => visitInstruction(node);
344 visitIndexAssign(HIndexAssign node) => visitInstruction(node); 344 visitIndexAssign(HIndexAssign node) => visitInstruction(node);
345 visitInterceptor(HInterceptor node) => visitInstruction(node); 345 visitInterceptor(HInterceptor node) => visitInstruction(node);
346 visitInvokeClosure(HInvokeClosure node) => visitInvokeDynamic(node); 346 visitInvokeClosure(HInvokeClosure node) => visitInvokeDynamic(node);
347 visitInvokeConstructorBody(HInvokeConstructorBody node) => 347 visitInvokeConstructorBody(HInvokeConstructorBody node) =>
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 HBasicBlock get trueBranch => block.successors[0]; 1487 HBasicBlock get trueBranch => block.successors[0];
1488 HBasicBlock get falseBranch => block.successors[1]; 1488 HBasicBlock get falseBranch => block.successors[1];
1489 } 1489 }
1490 1490
1491 abstract class HControlFlow extends HInstruction { 1491 abstract class HControlFlow extends HInstruction {
1492 HControlFlow(inputs) : super(inputs, const TypeMask.nonNullEmpty()); 1492 HControlFlow(inputs) : super(inputs, const TypeMask.nonNullEmpty());
1493 bool isControlFlow() => true; 1493 bool isControlFlow() => true;
1494 bool isJsStatement() => true; 1494 bool isJsStatement() => true;
1495 } 1495 }
1496 1496
1497 // Allocates and initializes an instance.
1498 class HCreate extends HInstruction {
1499 final ClassElement element;
1500
1501 /// If this field is not `null`, this call is from an inlined constructor and
1502 /// we have to register the instantiated type in the code generator. The
1503 /// [instructionType] of this node is not enough, because we also need the
1504 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1505 List<DartType> instantiatedTypes;
1506
1507 HCreate(this.element, List<HInstruction> inputs, TypeMask type,
1508 [this.instantiatedTypes])
1509 : super(inputs, type);
1510
1511 accept(HVisitor visitor) => visitor.visitCreate(this);
1512
1513 bool get isAllocation => true;
1514
1515 String toString() => 'HCreate($element)';
1516 }
1517
1497 abstract class HInvoke extends HInstruction { 1518 abstract class HInvoke extends HInstruction {
1498 /** 1519 /**
1499 * The first argument must be the target: either an [HStatic] node, or 1520 * The first argument must be the target: either an [HStatic] node, or
1500 * the receiver of a method-call. The remaining inputs are the arguments 1521 * the receiver of a method-call. The remaining inputs are the arguments
1501 * to the invocation. 1522 * to the invocation.
1502 */ 1523 */
1503 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) { 1524 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) {
1504 sideEffects.setAllSideEffects(); 1525 sideEffects.setAllSideEffects();
1505 sideEffects.setDependsOnSomething(); 1526 sideEffects.setDependsOnSomething();
1506 } 1527 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 canBeNull() ? throwBehavior.canThrow : throwBehavior.onNonNull.canThrow; 1900 canBeNull() ? throwBehavior.canThrow : throwBehavior.onNonNull.canThrow;
1880 1901
1881 bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard; 1902 bool onlyThrowsNSM() => throwBehavior.isOnlyNullNSMGuard;
1882 1903
1883 bool get isAllocation => 1904 bool get isAllocation =>
1884 nativeBehavior != null && nativeBehavior.isAllocation && !canBeNull(); 1905 nativeBehavior != null && nativeBehavior.isAllocation && !canBeNull();
1885 1906
1886 String toString() => 'HForeignCode("${codeTemplate.source}",$inputs)'; 1907 String toString() => 'HForeignCode("${codeTemplate.source}",$inputs)';
1887 } 1908 }
1888 1909
1889 class HForeignNew extends HForeign {
1890 ClassElement element;
1891
1892 /// If this field is not `null`, this call is from an inlined constructor and
1893 /// we have to register the instantiated type in the code generator. The
1894 /// [instructionType] of this node is not enough, because we also need the
1895 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1896 List<DartType> instantiatedTypes;
1897
1898 HForeignNew(this.element, TypeMask type, List<HInstruction> inputs,
1899 [this.instantiatedTypes])
1900 : super(type, inputs);
1901
1902 accept(HVisitor visitor) => visitor.visitForeignNew(this);
1903
1904 bool get isAllocation => true;
1905
1906 String toString() => 'HForeignNew($element)';
1907 }
1908
1909 abstract class HInvokeBinary extends HInstruction { 1910 abstract class HInvokeBinary extends HInstruction {
1910 final Selector selector; 1911 final Selector selector;
1911 HInvokeBinary( 1912 HInvokeBinary(
1912 HInstruction left, HInstruction right, this.selector, TypeMask type) 1913 HInstruction left, HInstruction right, this.selector, TypeMask type)
1913 : super(<HInstruction>[left, right], type) { 1914 : super(<HInstruction>[left, right], type) {
1914 sideEffects.clearAllSideEffects(); 1915 sideEffects.clearAllSideEffects();
1915 sideEffects.clearAllDependencies(); 1916 sideEffects.clearAllDependencies();
1916 setUseGvn(); 1917 setUseGvn();
1917 } 1918 }
1918 1919
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 /// 3274 ///
3274 /// class Foo<T> { 3275 /// class Foo<T> {
3275 /// ... new Set<List<T>>() 3276 /// ... new Set<List<T>>()
3276 /// } 3277 /// }
3277 /// class Set<E1> { 3278 /// class Set<E1> {
3278 /// factory Set() => new _LinkedHashSet<E1>(); 3279 /// factory Set() => new _LinkedHashSet<E1>();
3279 /// } 3280 /// }
3280 /// class List<E2> { ... } 3281 /// class List<E2> { ... }
3281 /// class _LinkedHashSet<E3> { ... } 3282 /// class _LinkedHashSet<E3> { ... }
3282 /// 3283 ///
3283 /// After inlining the factory constructor for `Set<E1>`, the HForeignNew 3284 /// After inlining the factory constructor for `Set<E1>`, the HCreate should
3284 /// should have type `_LinkedHashSet<List<T>>` and the TypeExpression should be 3285 /// have type `_LinkedHashSet<List<T>>` and the TypeExpression should be a tree:
3285 /// a tree:
3286 /// 3286 ///
3287 /// HForeignNew(dartType: _LinkedHashSet<List<T>>, 3287 /// HCreate(dartType: _LinkedHashSet<List<T>>,
3288 /// [], // No arguments 3288 /// [], // No arguments
3289 /// HTypeInfoExpression(INSTANCE, 3289 /// HTypeInfoExpression(INSTANCE,
3290 /// dartType: _LinkedHashSet<E3>, // _LinkedHashSet's thisType 3290 /// dartType: _LinkedHashSet<E3>, // _LinkedHashSet's thisType
3291 /// HTypeInfoExpression(COMPLETE, // E3 = List<T> 3291 /// HTypeInfoExpression(COMPLETE, // E3 = List<T>
3292 /// dartType: List<E2>, 3292 /// dartType: List<E2>,
3293 /// HTypeInfoReadVariable(this, T)))) // E2 = T 3293 /// HTypeInfoReadVariable(this, T)))) // E2 = T
3294 3294
3295 // TODO(sra): The INSTANCE form requires the actual instance for full 3295 // TODO(sra): The INSTANCE form requires the actual instance for full
3296 // interpretation. If the COMPLETE form was used on instances, then we could 3296 // interpretation. If the COMPLETE form was used on instances, then we could
3297 // simplify HTypeInfoReadVariable without an object. 3297 // simplify HTypeInfoReadVariable without an object.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 class HDynamicType extends HRuntimeType { 3423 class HDynamicType extends HRuntimeType {
3424 HDynamicType(DynamicType dartType, TypeMask instructionType) 3424 HDynamicType(DynamicType dartType, TypeMask instructionType)
3425 : super(const <HInstruction>[], dartType, instructionType); 3425 : super(const <HInstruction>[], dartType, instructionType);
3426 3426
3427 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3427 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3428 3428
3429 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3429 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3430 3430
3431 bool typeEquals(HInstruction other) => other is HDynamicType; 3431 bool typeEquals(HInstruction other) => other is HDynamicType;
3432 } 3432 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698