author | hannesw |
Mon, 18 Feb 2013 10:36:18 +0100 | |
changeset 16244 | 12f06c992c3a |
parent 16240 | e1468b33e201 |
child 24719 | f726e9d67629 |
permissions | -rw-r--r-- |
16240
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
1 |
/* |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
4 |
* |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
10 |
* |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
15 |
* accompanied this code). |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
16 |
* |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
20 |
* |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
23 |
* questions. |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
24 |
*/ |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
25 |
|
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
26 |
package jdk.nashorn.internal.codegen; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
27 |
|
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
28 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFEQ; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
29 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFGE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
30 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFGT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
31 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFLE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
32 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFLT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
33 |
import static jdk.internal.org.objectweb.asm.Opcodes.IFNE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
34 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ACMPEQ; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
35 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ACMPNE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
36 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPEQ; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
37 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPGE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
38 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPGT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
39 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPLE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
40 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPLT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
41 |
import static jdk.internal.org.objectweb.asm.Opcodes.IF_ICMPNE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
42 |
|
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
43 |
/** |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
44 |
* Condition enum used for all kinds of jumps, regardless of type |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
45 |
*/ |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
46 |
enum Condition { |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
47 |
EQ, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
48 |
NE, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
49 |
LE, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
50 |
LT, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
51 |
GE, |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
52 |
GT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
53 |
|
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
54 |
static int toUnary(final Condition c) { |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
55 |
switch (c) { |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
56 |
case EQ: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
57 |
return IFEQ; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
58 |
case NE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
59 |
return IFNE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
60 |
case LE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
61 |
return IFLE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
62 |
case LT: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
63 |
return IFLT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
64 |
case GE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
65 |
return IFGE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
66 |
case GT: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
67 |
return IFGT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
68 |
default: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
69 |
assert false; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
70 |
return -1; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
71 |
} |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
72 |
} |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
73 |
|
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
74 |
static int toBinary(final Condition c, final boolean isObject) { |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
75 |
switch (c) { |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
76 |
case EQ: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
77 |
return isObject ? IF_ACMPEQ : IF_ICMPEQ; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
78 |
case NE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
79 |
return isObject ? IF_ACMPNE : IF_ICMPNE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
80 |
case LE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
81 |
return IF_ICMPLE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
82 |
case LT: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
83 |
return IF_ICMPLT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
84 |
case GE: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
85 |
return IF_ICMPGE; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
86 |
case GT: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
87 |
return IF_ICMPGT; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
88 |
default: |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
89 |
assert false; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
90 |
return -1; |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
91 |
} |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
92 |
} |
e1468b33e201
8008239: Unpublicized parts of the code generator package that were only package internal.
lagergren
parents:
diff
changeset
|
93 |
} |