1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.internal.codegen.types;
  27 
  28 import jdk.internal.org.objectweb.asm.MethodVisitor;
  29 
  30 /**
  31  * Bitwise operations not supported by all types
  32  */
  33 interface BytecodeBitwiseOps {
  34 
  35     /**
  36      * Pop and logically shift the two values on top of the stack (steps, value)
  37      * right and push the result on the stack
  38      *
  39      * @param method method visitor
  40      * @return result type
  41      */
  42     Type shr(MethodVisitor method);
  43 
  44     /**
  45      * Pop and arithmetically shift of the two values on top of the stack
  46      * (steps, value) right and push the result on the stack
  47      *
  48      * @param method method visitor
  49      * @return result type
  50      */
  51     Type sar(MethodVisitor method);
  52 
  53     /**
  54      * Pop and logically shift of the two values on top of the stack (steps,
  55      * value) left and push the result on the stack
  56      *
  57      * @param method method visitor
  58      * @return result type
  59      */
  60     Type shl(MethodVisitor method);
  61 
  62     /**
  63      * Pop and AND the two values on top of the stack and push the result on the
  64      * stack
  65      *
  66      * @param method method visitor
  67      * @return result type
  68      */
  69     Type and(MethodVisitor method);
  70 
  71     /**
  72      * Pop and OR the two values on top of the stack and push the result on the
  73      * stack
  74      *
  75      * @param method method visitor
  76      * @return result type
  77      */
  78     Type or(MethodVisitor method);
  79 
  80     /**
  81      * Pop and XOR the two values on top of the stack and push the result on the
  82      * stack
  83      *
  84      * @param method method visitor
  85      * @return result type
  86      */
  87     Type xor(MethodVisitor method);
  88 
  89     /**
  90      * Comparison with int return value, e.g. LCMP.
  91      *
  92      * @param method the method visitor
  93      * @return int return value
  94      */
  95     Type cmp(MethodVisitor method);
  96 }