1 /* |
1 /* |
2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
213 @Override |
212 @Override |
214 public Type sub(final MethodVisitor method, final int programPoint) { |
213 public Type sub(final MethodVisitor method, final int programPoint) { |
215 if(programPoint == INVALID_PROGRAM_POINT) { |
214 if(programPoint == INVALID_PROGRAM_POINT) { |
216 method.visitInsn(ISUB); |
215 method.visitInsn(ISUB); |
217 } else { |
216 } else { |
218 ldc(method, programPoint); |
217 method.visitInvokeDynamicInsn("isub", "(II)I", MATHBOOTSTRAP, programPoint); |
219 JSType.SUB_EXACT.invoke(method); |
|
220 } |
218 } |
221 return INT; |
219 return INT; |
222 } |
220 } |
223 |
221 |
224 @Override |
222 @Override |
225 public Type mul(final MethodVisitor method, final int programPoint) { |
223 public Type mul(final MethodVisitor method, final int programPoint) { |
226 if(programPoint == INVALID_PROGRAM_POINT) { |
224 if(programPoint == INVALID_PROGRAM_POINT) { |
227 method.visitInsn(IMUL); |
225 method.visitInsn(IMUL); |
228 } else { |
226 } else { |
229 ldc(method, programPoint); |
227 method.visitInvokeDynamicInsn("imul", "(II)I", MATHBOOTSTRAP, programPoint); |
230 JSType.MUL_EXACT.invoke(method); |
|
231 } |
228 } |
232 return INT; |
229 return INT; |
233 } |
230 } |
234 |
231 |
235 @Override |
232 @Override |
236 public Type div(final MethodVisitor method, final int programPoint) { |
233 public Type div(final MethodVisitor method, final int programPoint) { |
237 if (programPoint == INVALID_PROGRAM_POINT) { |
234 if (programPoint == INVALID_PROGRAM_POINT) { |
238 JSType.DIV_ZERO.invoke(method); |
235 JSType.DIV_ZERO.invoke(method); |
239 } else { |
236 } else { |
240 ldc(method, programPoint); |
237 method.visitInvokeDynamicInsn("idiv", "(II)I", MATHBOOTSTRAP, programPoint); |
241 JSType.DIV_EXACT.invoke(method); |
|
242 } |
238 } |
243 return INT; |
239 return INT; |
244 } |
240 } |
245 |
241 |
246 @Override |
242 @Override |
247 public Type rem(final MethodVisitor method, final int programPoint) { |
243 public Type rem(final MethodVisitor method, final int programPoint) { |
248 if (programPoint == INVALID_PROGRAM_POINT) { |
244 if (programPoint == INVALID_PROGRAM_POINT) { |
249 JSType.REM_ZERO.invoke(method); |
245 JSType.REM_ZERO.invoke(method); |
250 } else { |
246 } else { |
251 ldc(method, programPoint); |
247 method.visitInvokeDynamicInsn("irem", "(II)I", MATHBOOTSTRAP, programPoint); |
252 JSType.REM_EXACT.invoke(method); |
|
253 } |
248 } |
254 return INT; |
249 return INT; |
255 } |
250 } |
256 |
251 |
257 @Override |
252 @Override |
258 public Type neg(final MethodVisitor method, final int programPoint) { |
253 public Type neg(final MethodVisitor method, final int programPoint) { |
259 if(programPoint == INVALID_PROGRAM_POINT) { |
254 if(programPoint == INVALID_PROGRAM_POINT) { |
260 method.visitInsn(INEG); |
255 method.visitInsn(INEG); |
261 } else { |
256 } else { |
262 ldc(method, programPoint); |
257 method.visitInvokeDynamicInsn("ineg", "(I)I", MATHBOOTSTRAP, programPoint); |
263 JSType.NEGATE_EXACT.invoke(method); |
|
264 } |
258 } |
265 return INT; |
259 return INT; |
266 } |
260 } |
267 |
261 |
268 @Override |
262 @Override |