Skip to content

Commit 5a912d6

Browse files
committed
Avoid virtual call for array length in the uncached case.
1 parent a9b341f commit 5a912d6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/interop/ArrayElementInfoNode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -49,6 +49,7 @@
4949
import com.oracle.truffle.js.nodes.JavaScriptBaseNode;
5050
import com.oracle.truffle.js.runtime.JSRuntime;
5151
import com.oracle.truffle.js.runtime.array.ScriptArray;
52+
import com.oracle.truffle.js.runtime.builtins.JSAbstractArray;
5253
import com.oracle.truffle.js.runtime.builtins.JSArrayBase;
5354

5455
/**
@@ -99,7 +100,7 @@ static TriState doCached(JSArrayBase target, long index, int query,
99100
return TriState.UNDEFINED;
100101
}
101102
}
102-
if (index >= 0 && index < arrayType.length(target)) {
103+
if (index >= 0 && index < JSAbstractArray.arrayGetLength(target)) {
103104
if ((query & READABLE) != 0) {
104105
return TriState.TRUE;
105106
}

0 commit comments

Comments
 (0)