WebKit Bugzilla
Attachment 340290 Details for
Bug 185601
: [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185601-20180514142905.patch (text/plain), 3.79 KB, created by
Yusuke Suzuki
on 2018-05-13 22:29:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-05-13 22:29:06 PDT
Size:
3.79 KB
patch
obsolete
>Subversion Revision: 231744 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 9236b46544dfd53012c6077d2bb79c3f681035a6..d9b24d8d71aea87e4cf54367b065a446b9ee9c18 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,28 @@ >+2018-05-13 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [JSC] Check TypeOfShouldCallGetCallData before calling getCallData when we would like to check whether a given object is callable >+ https://bugs.webkit.org/show_bug.cgi?id=185601 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check TypeOfShouldCallGetCallData before calling getCallData when we would like to check >+ whether a given object is callable since getCallData is a virtual call. When we call >+ the object anyway, directly calling getCallData is fine. But if we would like to check >+ whether the object is callable, we can have non callable objects frequently. In that case, >+ we should not call getCallData if we can avoid it. >+ >+ We found that this virtual call exists in JSON.stringify's critial path. Checking >+ TypeOfShouldCallGetCallData improves Kraken/json-stringify-tinderbox by 2-3%. >+ >+ baseline patched >+ >+ json-stringify-tinderbox 38.814+-0.503 ^ 37.530+-0.581 ^ definitely 1.0342x faster >+ >+ * runtime/JSONObject.cpp: >+ (JSC::Stringifier::appendStringifiedValue): >+ * runtime/Operations.cpp: >+ (JSC::jsIsObjectTypeOrNull): >+ > 2018-05-12 Filip Pizlo <fpizlo@apple.com> > > CachedCall::call() should be faster >diff --git a/Source/JavaScriptCore/runtime/JSONObject.cpp b/Source/JavaScriptCore/runtime/JSONObject.cpp >index b3a7808b64fe36a86a28134fe79ab1ddcdfd3a01..6fd89876a1d1e7b38f2720ac7e7e491f76863929 100644 >--- a/Source/JavaScriptCore/runtime/JSONObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSONObject.cpp >@@ -381,13 +381,15 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& > > JSObject* object = asObject(value); > >- CallData callData; >- if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) { >- if (holder.isArray()) { >- builder.appendLiteral("null"); >- return StringifySucceeded; >+ if (object->inlineTypeFlags() & TypeOfShouldCallGetCallData) { >+ CallData callData; >+ if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) { >+ if (holder.isArray()) { >+ builder.appendLiteral("null"); >+ return StringifySucceeded; >+ } >+ return StringifyFailedDueToUndefinedOrSymbolValue; > } >- return StringifyFailedDueToUndefinedOrSymbolValue; > } > > // Handle cycle detection, and put the holder on the stack. >diff --git a/Source/JavaScriptCore/runtime/Operations.cpp b/Source/JavaScriptCore/runtime/Operations.cpp >index 97cfa07a9694022256c9c38a66c76433517cd65e..d28bc8fbf0e34597b16b47d1447630e71e28250b 100644 >--- a/Source/JavaScriptCore/runtime/Operations.cpp >+++ b/Source/JavaScriptCore/runtime/Operations.cpp >@@ -119,10 +119,12 @@ bool jsIsObjectTypeOrNull(CallFrame* callFrame, JSValue v) > if (type >= ObjectType) { > if (asObject(v)->structure(vm)->masqueradesAsUndefined(callFrame->lexicalGlobalObject())) > return false; >- CallData callData; > JSObject* object = asObject(v); >- if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) >- return false; >+ if (object->inlineTypeFlags() & TypeOfShouldCallGetCallData) { >+ CallData callData; >+ if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) >+ return false; >+ } > } > return true; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185601
:
340290
|
340291
|
340292
|
340294
|
340295
|
340323
|
340329
|
340331
|
340333
|
340393