Skip to content

Commit 00641ba

Browse files
committed
Skip always-valid prototype assumption check for %Object.prototype%.
1 parent f3ffeaf commit 00641ba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/nodes/access/PropertyCacheNode.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static AbstractShapeCheckNode create(Shape shape, JSDynamicObject thisObj, Objec
373373
JSDynamicObject depthProto = thisObj;
374374
for (int i = 0; i < depth; i++) {
375375
Assumption stablePrototypeAssumption = i == 0 ? null : JSShape.getPrototypeAssumption(depthShape);
376-
if (stablePrototypeAssumption != null) {
376+
if (stablePrototypeAssumption != null && stablePrototypeAssumption != Assumption.ALWAYS_VALID) {
377377
ass[pos++] = stablePrototypeAssumption;
378378
}
379379
depthProto = JSObject.getPrototype(depthProto);
@@ -466,7 +466,9 @@ static AbstractShapeCheckNode create(Shape shape, JSDynamicObject thisObj, Objec
466466
JSDynamicObject depthProto = thisObj;
467467
for (int i = 0; i < depth; i++) {
468468
Assumption stablePrototypeAssumption = JSShape.getPrototypeAssumption(depthShape);
469-
ass[pos++] = stablePrototypeAssumption;
469+
if (stablePrototypeAssumption != Assumption.ALWAYS_VALID) {
470+
ass[pos++] = stablePrototypeAssumption;
471+
}
470472
depthProto = JSObject.getPrototype(depthProto);
471473
depthShape = depthProto.getShape();
472474
if (depthProto != Null.instance) {
@@ -666,7 +668,7 @@ static AbstractShapeCheckNode create(Class<?> valueClass, Shape shape, JSDynamic
666668
JSDynamicObject depthProto = thisObj;
667669
for (int i = 0; i < depth; i++) {
668670
Assumption stablePrototypeAssumption = i == 0 ? null : JSShape.getPrototypeAssumption(depthShape);
669-
if (stablePrototypeAssumption != null) {
671+
if (stablePrototypeAssumption != null && stablePrototypeAssumption != Assumption.ALWAYS_VALID) {
670672
ass[pos++] = stablePrototypeAssumption;
671673
}
672674
depthProto = JSObject.getPrototype(depthProto);

0 commit comments

Comments
 (0)