Skip to content

Commit 87f3c1e

Browse files
committed
[GR-22467] CI: add cmake dependency.
PullRequest: js/1459
2 parents 77e978f + a478488 commit 87f3c1e

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

common.jsonnet

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
packages+: {
5050
'apache/ab': '==2.3',
5151
binutils: '==2.23.2',
52+
cmake: '==3.6.1',
5253
gcc: '==8.3.0',
5354
git: '>=1.8.3',
5455
maven: '==3.3.9',

graal-js/mx.graal-js/suite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{
2525
"name" : "regex",
2626
"subdir" : True,
27-
"version" : "9d8d3e8667938a5d10fdac10e5f6ccfd697094d7",
27+
"version" : "b2ec61658947a4276148438d403ae266345d6ce5",
2828
"urls" : [
2929
{"url" : "https://github.com/oracle/graal.git", "kind" : "git"},
3030
{"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},

graal-js/src/com.oracle.truffle.js.test.instrumentation/src/com/oracle/truffle/js/test/instrumentation/UnaryOperationTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ public void voidMethod() {
9393
}
9494

9595
@Test
96-
public void toInt() {
97-
// 'true' is converted to '1' before the binary operation.
98-
assertBasicUnaryOperation("var x = true; var b = ~x;", true, 1, -2, "~");
96+
public void bitwiseNot() {
97+
assertBasicUnaryOperation("var x = true; var b = ~x;", true, true, -2, "~");
9998
}
10099

101100
@Test

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/JSNodeUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,8 @@ public static JavaScriptNode getWrappedNode(JavaScriptNode node) {
176176
public static boolean isTaggedNode(Node node) {
177177
return node instanceof JSTaggedExecutionNode || (node instanceof WrapperNode && ((WrapperNode) node).getDelegateNode() instanceof JSTaggedExecutionNode);
178178
}
179+
180+
public static boolean isInputGeneratingNode(Node node) {
181+
return node instanceof JSInputGeneratingNodeWrapper || (node instanceof WrapperNode && ((WrapperNode) node).getDelegateNode() instanceof JSInputGeneratingNodeWrapper);
182+
}
179183
}

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/function/JSNewNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import com.oracle.truffle.api.library.CachedLibrary;
6262
import com.oracle.truffle.api.object.DynamicObject;
6363
import com.oracle.truffle.api.profiles.ConditionProfile;
64+
import com.oracle.truffle.js.nodes.JSNodeUtil;
6465
import com.oracle.truffle.js.nodes.JavaScriptNode;
6566
import com.oracle.truffle.js.nodes.instrumentation.JSInputGeneratingNodeWrapper;
6667
import com.oracle.truffle.js.nodes.instrumentation.JSTags;
@@ -134,7 +135,7 @@ public InstrumentableNode materializeInstrumentableNodes(Set<Class<? extends Tag
134135

135136
private boolean materializationNeeded(Set<Class<? extends Tag>> materializedTags) {
136137
if (materializedTags.contains(ObjectAllocationTag.class)) {
137-
return (!getTarget().hasSourceSection() && !(getTarget() instanceof JSInputGeneratingNodeWrapper));
138+
return (!getTarget().hasSourceSection() && !JSNodeUtil.isInputGeneratingNode(getTarget()));
138139
}
139140
return false;
140141
}

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/unary/JSComplementNode.java

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@
4444

4545
import com.oracle.truffle.api.dsl.Cached;
4646
import com.oracle.truffle.api.dsl.Specialization;
47-
import com.oracle.truffle.api.instrumentation.InstrumentableNode;
47+
import com.oracle.truffle.api.frame.VirtualFrame;
4848
import com.oracle.truffle.api.instrumentation.Tag;
4949
import com.oracle.truffle.api.nodes.NodeInfo;
5050
import com.oracle.truffle.js.nodes.JavaScriptNode;
5151
import com.oracle.truffle.js.nodes.Truncatable;
5252
import com.oracle.truffle.js.nodes.cast.JSToInt32Node;
5353
import com.oracle.truffle.js.nodes.cast.JSToNumericNode;
54-
import com.oracle.truffle.js.nodes.instrumentation.JSInputGeneratingNodeWrapper;
5554
import com.oracle.truffle.js.nodes.instrumentation.JSTags.UnaryOperationTag;
5655
import com.oracle.truffle.js.runtime.BigInt;
56+
import com.oracle.truffle.js.runtime.SafeInteger;
5757

5858
@NodeInfo(shortName = "~")
5959
public abstract class JSComplementNode extends JSUnaryNode {
@@ -64,7 +64,7 @@ protected JSComplementNode(JavaScriptNode operand) {
6464

6565
public static JSComplementNode create(JavaScriptNode operand) {
6666
Truncatable.truncate(operand);
67-
return JSComplementNodeGen.create(JSToNumericNode.create(operand));
67+
return JSComplementNodeGen.create(operand);
6868
}
6969

7070
@Override
@@ -76,25 +76,19 @@ public boolean hasTag(Class<? extends Tag> tag) {
7676
}
7777
}
7878

79-
@Override
80-
public InstrumentableNode materializeInstrumentableNodes(Set<Class<? extends Tag>> materializedTags) {
81-
if (materializedTags.contains(UnaryOperationTag.class) && !(getOperand() instanceof JSInputGeneratingNodeWrapper)) {
82-
JSComplementNode materialized = JSComplementNodeGen.create(JSInputGeneratingNodeWrapper.create(cloneUninitialized(getOperand(), materializedTags)));
83-
transferSourceSectionAddExpressionTag(this, materialized);
84-
return materialized;
85-
}
86-
return this;
87-
}
88-
8979
@Specialization
9080
protected int doInteger(int a) {
9181
return ~a;
9282
}
9383

84+
@Specialization
85+
protected int doSafeInteger(SafeInteger a) {
86+
return ~a.intValue();
87+
}
88+
9489
@Specialization
9590
protected int doDouble(double a,
9691
@Cached("create()") JSToInt32Node toInt32Node) {
97-
9892
return doInteger(toInt32Node.executeInt(a));
9993
}
10094

@@ -103,6 +97,18 @@ protected BigInt doBigInt(BigInt a) {
10397
return a.not();
10498
}
10599

100+
@Specialization(replaces = {"doInteger", "doSafeInteger", "doDouble", "doBigInt"})
101+
protected Object doGeneric(VirtualFrame frame, Object value,
102+
@Cached JSToNumericNode toNumericNode,
103+
@Cached("createInner()") JSComplementNode recursive) {
104+
Object number = toNumericNode.execute(value);
105+
return recursive.execute(frame, number);
106+
}
107+
108+
static JSComplementNode createInner() {
109+
return JSComplementNodeGen.create(null);
110+
}
111+
106112
@Override
107113
public boolean isResultAlwaysOfType(Class<?> clazz) {
108114
return clazz == Number.class;

0 commit comments

Comments
 (0)