Skip to content

Commit

Permalink
Avoid virtual call for array length in the uncached case.
Browse files Browse the repository at this point in the history
  • Loading branch information
woess committed Jan 30, 2024
1 parent a9b341f commit 5a912d6
Showing 1 changed file with 3 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -49,6 +49,7 @@
import com.oracle.truffle.js.nodes.JavaScriptBaseNode;
import com.oracle.truffle.js.runtime.JSRuntime;
import com.oracle.truffle.js.runtime.array.ScriptArray;
import com.oracle.truffle.js.runtime.builtins.JSAbstractArray;
import com.oracle.truffle.js.runtime.builtins.JSArrayBase;

/**
Expand Down Expand Up @@ -99,7 +100,7 @@ static TriState doCached(JSArrayBase target, long index, int query,
return TriState.UNDEFINED;
}
}
if (index >= 0 && index < arrayType.length(target)) {
if (index >= 0 && index < JSAbstractArray.arrayGetLength(target)) {
if ((query & READABLE) != 0) {
return TriState.TRUE;
}
Expand Down

0 comments on commit 5a912d6

Please sign in to comment.