⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283435 in webkit


Ignore:
Timestamp:
Oct 1, 2021, 11:51:34 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r283293.
https://bugs.webkit.org/show_bug.cgi?id=231116

changing print() broke a lot of random things

Reverted changeset:

"Print values in a nicer way in the jsc shell"
https://bugs.webkit.org/show_bug.cgi?id=230931
https://commits.webkit.org/r283293

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChakraCore/test/jsc-lib.js

    r283293 r283435  
    1 print = legacyPrint;
    2 
    31WScript = {
    42    _jscGC: gc,
  • trunk/JSTests/ChangeLog

    r283332 r283435  
     12021-10-01  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r283293.
     4        https://bugs.webkit.org/show_bug.cgi?id=231116
     5
     6        changing print() broke a lot of random things
     7
     8        Reverted changeset:
     9
     10        "Print values in a nicer way in the jsc shell"
     11        https://bugs.webkit.org/show_bug.cgi?id=230931
     12        https://commits.webkit.org/r283293
     13
    1142021-09-30  Saam Barati  <sbarati@apple.com>
    215
  • trunk/JSTests/exceptionFuzz/3d-cube.js

    r283293 r283435  
    359359})();
    360360} catch (e) {
    361     legacyPrint("JSC EXCEPTION FUZZ: Caught exception: " + e);
    362 }
     361    print("JSC EXCEPTION FUZZ: Caught exception: " + e);
     362}
  • trunk/JSTests/exceptionFuzz/date-format-xparb.js

    r283293 r283435  
    425425})();
    426426} catch (e) {
    427     legacyPrint("JSC EXCEPTION FUZZ: Caught exception: " + e);
    428 }
     427    print("JSC EXCEPTION FUZZ: Caught exception: " + e);
     428}
  • trunk/JSTests/exceptionFuzz/earley-boyer.js

    r283293 r283435  
    46854685})();
    46864686} catch (e) {
    4687     legacyPrint("JSC EXCEPTION FUZZ: Caught exception: " + e);
    4688 }
    4689 
     4687    print("JSC EXCEPTION FUZZ: Caught exception: " + e);
     4688}
     4689
  • trunk/LayoutTests/ChangeLog

    r283419 r283435  
     12021-10-01  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r283293.
     4        https://bugs.webkit.org/show_bug.cgi?id=231116
     5
     6        changing print() broke a lot of random things
     7
     8        Reverted changeset:
     9
     10        "Print values in a nicer way in the jsc shell"
     11        https://bugs.webkit.org/show_bug.cgi?id=230931
     12        https://commits.webkit.org/r283293
     13
    1142021-10-01  Ayumi Kojima  <ayumi_kojima@apple.com>
    215
  • trunk/LayoutTests/resources/standalone-pre.js

    r283293 r283435  
    1313didPassSomeTestsSilently = false;
    1414didFailSomeTests = false;
    15 
    16 print = legacyPrint;
    1715
    1816function description(msg)
  • trunk/Source/JavaScriptCore/ChangeLog

    r283410 r283435  
     12021-10-01  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r283293.
     4        https://bugs.webkit.org/show_bug.cgi?id=231116
     5
     6        changing print() broke a lot of random things
     7
     8        Reverted changeset:
     9
     10        "Print values in a nicer way in the jsc shell"
     11        https://bugs.webkit.org/show_bug.cgi?id=230931
     12        https://commits.webkit.org/r283293
     13
    1142021-10-01  Yusuke Suzuki  <ysuzuki@apple.com>
    215
  • trunk/Source/JavaScriptCore/jsc.cpp

    r283293 r283435  
    279279static JSC_DECLARE_HOST_FUNCTION(functionPrintStdOut);
    280280static JSC_DECLARE_HOST_FUNCTION(functionPrintStdErr);
    281 static JSC_DECLARE_HOST_FUNCTION(functionLegacyPrint);
    282281static JSC_DECLARE_HOST_FUNCTION(functionDebug);
    283282static JSC_DECLARE_HOST_FUNCTION(functionDescribe);
     
    529528        addFunction(vm, "print", functionPrintStdOut, 1);
    530529        addFunction(vm, "printErr", functionPrintStdErr, 1);
    531         addFunction(vm, "legacyPrint", functionLegacyPrint, 1);
    532530        addFunction(vm, "quit", functionQuit, 0);
    533531        addFunction(vm, "gc", functionGCAndSweep, 0);
     
    12411239}
    12421240
    1243 template <typename T>
    1244 static CString toCString(JSGlobalObject* globalObject, ThrowScope& scope, T& string)
    1245 {
    1246     Expected<CString, UTF8ConversionError> expectedString = string.tryGetUtf8();
     1241static CString cStringFromViewWithString(JSGlobalObject* globalObject, ThrowScope& scope, StringViewWithUnderlyingString& viewWithString)
     1242{
     1243    Expected<CString, UTF8ConversionError> expectedString = viewWithString.view.tryGetUtf8();
    12471244    if (expectedString)
    12481245        return expectedString.value();
     
    12631260}
    12641261
    1265 static EncodedJSValue printInternal(JSGlobalObject* globalObject, CallFrame* callFrame, FILE* out, bool legacy)
     1262static EncodedJSValue printInternal(JSGlobalObject* globalObject, CallFrame* callFrame, FILE* out)
    12661263{
    12671264    VM& vm = globalObject->vm();
     
    12811278                goto fail;
    12821279
    1283         String string = legacy ? callFrame->uncheckedArgument(i).toWTFString(globalObject) : callFrame->uncheckedArgument(i).toWTFStringForConsole(globalObject);
     1280        auto* jsString = callFrame->uncheckedArgument(i).toString(globalObject);
    12841281        RETURN_IF_EXCEPTION(scope, { });
    1285         auto cString = toCString(globalObject, scope, string);
     1282        auto viewWithString = jsString->viewWithUnderlyingString(globalObject);
    12861283        RETURN_IF_EXCEPTION(scope, { });
    1287         fwrite(cString.data(), sizeof(char), cString.length(), out);
     1284        auto string = cStringFromViewWithString(globalObject, scope, viewWithString);
     1285        RETURN_IF_EXCEPTION(scope, { });
     1286        fwrite(string.data(), sizeof(char), string.length(), out);
    12881287        if (ferror(out))
    12891288            goto fail;
     
    12981297JSC_DEFINE_HOST_FUNCTION(functionPrintStdOut, (JSGlobalObject* globalObject, CallFrame* callFrame))
    12991298{
    1300     return printInternal(globalObject, callFrame, stdout, false);
     1299    return printInternal(globalObject, callFrame, stdout);
    13011300}
    13021301
    13031302JSC_DEFINE_HOST_FUNCTION(functionPrintStdErr, (JSGlobalObject* globalObject, CallFrame* callFrame))
    13041303{
    1305     return printInternal(globalObject, callFrame, stderr, false);
    1306 }
    1307 
    1308 JSC_DEFINE_HOST_FUNCTION(functionLegacyPrint, (JSGlobalObject* globalObject, CallFrame* callFrame))
    1309 {
    1310     return printInternal(globalObject, callFrame, stdout, true);
     1304    return printInternal(globalObject, callFrame, stderr);
    13111305}
    13121306
     
    13191313    auto viewWithString = jsString->viewWithUnderlyingString(globalObject);
    13201314    RETURN_IF_EXCEPTION(scope, { });
    1321     auto string = toCString(globalObject, scope, viewWithString.view);
     1315    auto string = cStringFromViewWithString(globalObject, scope, viewWithString);
    13221316    RETURN_IF_EXCEPTION(scope, { });
    13231317    fputs("--> ", stderr);
     
    32783272            utf8 = evaluationException->value().toWTFString(globalObject).tryGetUtf8();
    32793273        } else
    3280             utf8 = returnValue.toWTFStringForConsole(globalObject).tryGetUtf8();
     3274            utf8 = returnValue.toWTFString(globalObject).tryGetUtf8();
    32813275
    32823276        CString result;
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r283293 r283435  
    472472#endif
    473473
    474 WTF::String JSValue::toWTFStringForConsole(JSGlobalObject* globalObject) const
    475 {
    476     VM& vm = globalObject->vm();
    477     auto scope = DECLARE_THROW_SCOPE(vm);
    478     JSString* string = toString(globalObject);
    479     RETURN_IF_EXCEPTION(scope, { });
    480     String result = string->value(globalObject);
    481     RETURN_IF_EXCEPTION(scope, { });
    482     if (isString())
    483         return makeString("\"", result, "\"");
    484     if (jsDynamicCast<JSArray*>(vm, *this))
    485         return makeString("[", result, "]");
    486     return result;
    487 }
    488 
    489474} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.h

    r283293 r283435  
    290290    JSValue toPropertyKeyValue(JSGlobalObject*) const;
    291291    WTF::String toWTFString(JSGlobalObject*) const;
    292     JS_EXPORT_PRIVATE WTF::String toWTFStringForConsole(JSGlobalObject*) const;
    293292    JSObject* toObject(JSGlobalObject*) const;
    294293
Note: See TracChangeset for help on using the changeset viewer.