Skip to content

Commit 3389464

Browse files
committed
Share TruffleString.EqualNode between cached specialization instances.
(cherry picked from commit fc453bd)
1 parent 493e583 commit 3389464

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/builtins/ObjectPrototypeBuiltins.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, 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
@@ -394,6 +394,12 @@ protected static TruffleString uncached(JSObject object) {
394394

395395
public abstract static class FormatCacheNode extends JavaScriptBaseNode {
396396

397+
@Child TruffleString.EqualNode equalsNode;
398+
399+
protected FormatCacheNode() {
400+
this.equalsNode = TruffleString.EqualNode.create();
401+
}
402+
397403
public abstract TruffleString execute(TruffleString name);
398404

399405
public static FormatCacheNode create() {
@@ -404,8 +410,7 @@ public static FormatCacheNode create() {
404410
@Specialization(guards = {"stringEquals(equalsNode, cachedName, name)"}, limit = "10")
405411
protected TruffleString doCached(TruffleString name,
406412
@Cached("name") TruffleString cachedName,
407-
@Cached("doUncached(name)") TruffleString cachedResult,
408-
@Cached TruffleString.EqualNode equalsNode) {
413+
@Cached("doUncached(name)") TruffleString cachedResult) {
409414
return cachedResult;
410415
}
411416

0 commit comments

Comments
 (0)