Remove unneeded exception check from String.fromCharCode
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 21:38:26 +0000 (21:38 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2018 21:38:26 +0000 (21:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185083

Reviewed by Mark Lam.

* runtime/StringConstructor.cpp:
(JSC::stringFromCharCode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231171 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/StringConstructor.cpp

index f633215..fc19048 100644 (file)
@@ -1,5 +1,15 @@
 2018-04-30  Keith Miller  <keith_miller@apple.com>
 
+        Remove unneeded exception check from String.fromCharCode
+        https://bugs.webkit.org/show_bug.cgi?id=185083
+
+        Reviewed by Mark Lam.
+
+        * runtime/StringConstructor.cpp:
+        (JSC::stringFromCharCode):
+
+2018-04-30  Keith Miller  <keith_miller@apple.com>
+
         Move StructureIsImmortal to out of line flags.
         https://bugs.webkit.org/show_bug.cgi?id=185101
 
index 10abc76..0b10d8f 100644 (file)
@@ -77,9 +77,9 @@ static EncodedJSValue JSC_HOST_CALL stringFromCharCode(ExecState* exec)
 
     unsigned length = exec->argumentCount();
     if (LIKELY(length == 1)) {
-        unsigned code = exec->uncheckedArgument(0).toUInt32(exec);
-        RETURN_IF_EXCEPTION(scope, encodedJSValue());
         scope.release();
+        unsigned code = exec->uncheckedArgument(0).toUInt32(exec);
+        // Not checking for an exception here is ok because jsSingleCharacterString will just fetch an unused string if there's an exception.
         return JSValue::encode(jsSingleCharacterString(exec, code));
     }