Skip to content

Commit 70214f0

Browse files
committed
add BranchProfile
1 parent 7815b24 commit 70214f0

File tree

1 file changed

+4
-0
lines changed
  • graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins

1 file changed

+4
-0
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins/JSCollator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import com.oracle.truffle.api.object.LocationModifier;
6363
import com.oracle.truffle.api.object.Property;
6464
import com.oracle.truffle.api.object.Shape;
65+
import com.oracle.truffle.api.profiles.BranchProfile;
6566
import com.oracle.truffle.js.builtins.intl.CollatorFunctionBuiltins;
6667
import com.oracle.truffle.js.builtins.intl.CollatorPrototypeBuiltins;
6768
import com.oracle.truffle.js.lang.JavaScriptLanguage;
@@ -348,6 +349,7 @@ private static CallTarget createGetCompareCallTarget(JSContext context) {
348349

349350
@CompilationFinal private ContextReference<JSRealm> realmRef;
350351
@Child private PropertySetNode setBoundObjectNode = PropertySetNode.createSetHidden(BOUND_OBJECT_KEY, context);
352+
private final BranchProfile errorBranch = BranchProfile.create();
351353

352354
@Override
353355
public Object execute(VirtualFrame frame) {
@@ -360,6 +362,7 @@ public Object execute(VirtualFrame frame) {
360362
InternalState state = getInternalState((DynamicObject) collatorObj);
361363

362364
if (state == null || !state.initializedCollator) {
365+
errorBranch.enter();
363366
throw Errors.createTypeErrorMethodCalledOnNonObjectOrWrongType("compare");
364367
}
365368

@@ -385,6 +388,7 @@ public Object execute(VirtualFrame frame) {
385388

386389
return state.boundCompareFunction;
387390
}
391+
errorBranch.enter();
388392
throw Errors.createTypeErrorTypeXExpected(CLASS_NAME);
389393
}
390394
});

0 commit comments

Comments
 (0)