Changeset 283435 in webkit
- Timestamp:
- Oct 1, 2021, 11:51:34 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
-
JSTests/ChakraCore/test/jsc-lib.js (modified) (1 diff)
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/exceptionFuzz/3d-cube.js (modified) (1 diff)
-
JSTests/exceptionFuzz/date-format-xparb.js (modified) (1 diff)
-
JSTests/exceptionFuzz/earley-boyer.js (modified) (1 diff)
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/resources/standalone-pre.js (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/jsc.cpp (modified) (8 diffs)
-
Source/JavaScriptCore/runtime/JSCJSValue.cpp (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSCJSValue.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChakraCore/test/jsc-lib.js
r283293 r283435 1 print = legacyPrint;2 3 1 WScript = { 4 2 _jscGC: gc, -
trunk/JSTests/ChangeLog
r283332 r283435 1 2021-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 1 14 2021-09-30 Saam Barati <sbarati@apple.com> 2 15 -
trunk/JSTests/exceptionFuzz/3d-cube.js
r283293 r283435 359 359 })(); 360 360 } 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 425 425 })(); 426 426 } 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 4685 4685 })(); 4686 4686 } 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 1 2021-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 1 14 2021-10-01 Ayumi Kojima <ayumi_kojima@apple.com> 2 15 -
trunk/LayoutTests/resources/standalone-pre.js
r283293 r283435 13 13 didPassSomeTestsSilently = false; 14 14 didFailSomeTests = false; 15 16 print = legacyPrint;17 15 18 16 function description(msg) -
trunk/Source/JavaScriptCore/ChangeLog
r283410 r283435 1 2021-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 1 14 2021-10-01 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/jsc.cpp
r283293 r283435 279 279 static JSC_DECLARE_HOST_FUNCTION(functionPrintStdOut); 280 280 static JSC_DECLARE_HOST_FUNCTION(functionPrintStdErr); 281 static JSC_DECLARE_HOST_FUNCTION(functionLegacyPrint);282 281 static JSC_DECLARE_HOST_FUNCTION(functionDebug); 283 282 static JSC_DECLARE_HOST_FUNCTION(functionDescribe); … … 529 528 addFunction(vm, "print", functionPrintStdOut, 1); 530 529 addFunction(vm, "printErr", functionPrintStdErr, 1); 531 addFunction(vm, "legacyPrint", functionLegacyPrint, 1);532 530 addFunction(vm, "quit", functionQuit, 0); 533 531 addFunction(vm, "gc", functionGCAndSweep, 0); … … 1241 1239 } 1242 1240 1243 template <typename T> 1244 static CString toCString(JSGlobalObject* globalObject, ThrowScope& scope, T& string) 1245 { 1246 Expected<CString, UTF8ConversionError> expectedString = string.tryGetUtf8(); 1241 static CString cStringFromViewWithString(JSGlobalObject* globalObject, ThrowScope& scope, StringViewWithUnderlyingString& viewWithString) 1242 { 1243 Expected<CString, UTF8ConversionError> expectedString = viewWithString.view.tryGetUtf8(); 1247 1244 if (expectedString) 1248 1245 return expectedString.value(); … … 1263 1260 } 1264 1261 1265 static EncodedJSValue printInternal(JSGlobalObject* globalObject, CallFrame* callFrame, FILE* out , bool legacy)1262 static EncodedJSValue printInternal(JSGlobalObject* globalObject, CallFrame* callFrame, FILE* out) 1266 1263 { 1267 1264 VM& vm = globalObject->vm(); … … 1281 1278 goto fail; 1282 1279 1283 String string = legacy ? callFrame->uncheckedArgument(i).toWTFString(globalObject) : callFrame->uncheckedArgument(i).toWTFStringForConsole(globalObject);1280 auto* jsString = callFrame->uncheckedArgument(i).toString(globalObject); 1284 1281 RETURN_IF_EXCEPTION(scope, { }); 1285 auto cString = toCString(globalObject, scope, string);1282 auto viewWithString = jsString->viewWithUnderlyingString(globalObject); 1286 1283 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); 1288 1287 if (ferror(out)) 1289 1288 goto fail; … … 1298 1297 JSC_DEFINE_HOST_FUNCTION(functionPrintStdOut, (JSGlobalObject* globalObject, CallFrame* callFrame)) 1299 1298 { 1300 return printInternal(globalObject, callFrame, stdout , false);1299 return printInternal(globalObject, callFrame, stdout); 1301 1300 } 1302 1301 1303 1302 JSC_DEFINE_HOST_FUNCTION(functionPrintStdErr, (JSGlobalObject* globalObject, CallFrame* callFrame)) 1304 1303 { 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); 1311 1305 } 1312 1306 … … 1319 1313 auto viewWithString = jsString->viewWithUnderlyingString(globalObject); 1320 1314 RETURN_IF_EXCEPTION(scope, { }); 1321 auto string = toCString(globalObject, scope, viewWithString.view);1315 auto string = cStringFromViewWithString(globalObject, scope, viewWithString); 1322 1316 RETURN_IF_EXCEPTION(scope, { }); 1323 1317 fputs("--> ", stderr); … … 3278 3272 utf8 = evaluationException->value().toWTFString(globalObject).tryGetUtf8(); 3279 3273 } else 3280 utf8 = returnValue.toWTFString ForConsole(globalObject).tryGetUtf8();3274 utf8 = returnValue.toWTFString(globalObject).tryGetUtf8(); 3281 3275 3282 3276 CString result; -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r283293 r283435 472 472 #endif 473 473 474 WTF::String JSValue::toWTFStringForConsole(JSGlobalObject* globalObject) const475 {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 489 474 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r283293 r283435 290 290 JSValue toPropertyKeyValue(JSGlobalObject*) const; 291 291 WTF::String toWTFString(JSGlobalObject*) const; 292 JS_EXPORT_PRIVATE WTF::String toWTFStringForConsole(JSGlobalObject*) const;293 292 JSObject* toObject(JSGlobalObject*) const; 294 293
Note:
See TracChangeset
for help on using the changeset viewer.