55
56 import jdk.internal.org.objectweb.asm.MethodVisitor;
57 import jdk.nashorn.internal.codegen.CompilerConstants;
58 import jdk.nashorn.internal.runtime.JSType;
59
60 /**
61 * Type class: INT
62 */
63 class IntType extends BitwiseType {
64 private static final long serialVersionUID = 1L;
65
66 private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Integer.class, "toString", String.class, int.class);
67 private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Integer.class, "valueOf", Integer.class, int.class);
68
69 protected IntType() {
70 super("int", int.class, 2, 1);
71 }
72
73 @Override
74 public Type nextWider() {
75 return LONG;
76 }
77
78 @Override
79 public Class<?> getBoxedType() {
80 return Integer.class;
81 }
82
83 @Override
84 public char getBytecodeStackType() {
85 return 'I';
86 }
87
88 @Override
89 public Type ldc(final MethodVisitor method, final Object c) {
90 assert c instanceof Integer;
91
92 final int value = ((Integer) c).intValue();
93
94 switch (value) {
95 case -1:
|
55
56 import jdk.internal.org.objectweb.asm.MethodVisitor;
57 import jdk.nashorn.internal.codegen.CompilerConstants;
58 import jdk.nashorn.internal.runtime.JSType;
59
60 /**
61 * Type class: INT
62 */
63 class IntType extends BitwiseType {
64 private static final long serialVersionUID = 1L;
65
66 private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Integer.class, "toString", String.class, int.class);
67 private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Integer.class, "valueOf", Integer.class, int.class);
68
69 protected IntType() {
70 super("int", int.class, 2, 1);
71 }
72
73 @Override
74 public Type nextWider() {
75 return NUMBER;
76 }
77
78 @Override
79 public Class<?> getBoxedType() {
80 return Integer.class;
81 }
82
83 @Override
84 public char getBytecodeStackType() {
85 return 'I';
86 }
87
88 @Override
89 public Type ldc(final MethodVisitor method, final Object c) {
90 assert c instanceof Integer;
91
92 final int value = ((Integer) c).intValue();
93
94 switch (value) {
95 case -1:
|