WebKit Bugzilla
Attachment 357806 Details for
Bug 192816
: Use idiomatic const references for equality methods in JSC::JSValue class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1 (retry EWS)
bug-192816-20181218112651-retry.patch (text/plain), 5.88 KB, created by
David Kilzer (:ddkilzer)
on 2018-12-20 04:51:26 PST
(
hide
)
Description:
Patch v1 (retry EWS)
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-12-20 04:51:26 PST
Size:
5.88 KB
patch
obsolete
>Subversion Revision: 239276 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 81819dec9ea792b35deef2303e7c19671d845727..f54b1112a766413bf72316a8c53de3e68b0d406a 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,26 @@ >+2018-12-18 David Kilzer <ddkilzer@apple.com> >+ >+ Use idiomatic const references for equality methods in JSC::JSValue class >+ <https://webkit.org/b/192816> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Only JSC::JSValue::equalSlowCaseInline() is not changed to use >+ const references because it changes the value of its parameters >+ as part of its algorithm. >+ >+ * runtime/JSCJSValue.h: >+ (JSC::operator==): >+ (JSC::operator!=): >+ * runtime/JSCJSValueInlines.h: >+ (JSC::JSValue::equal): >+ (JSC::JSValue::strictEqualSlowCaseInline): >+ (JSC::JSValue::strictEqual): >+ (JSC::JSValue::pureStrictEqual): >+ * runtime/Operations.cpp: >+ (JSC::JSValue::equalSlowCase): >+ (JSC::JSValue::strictEqualSlowCase): >+ > 2018-12-18 David Kilzer <ddkilzer@apple.com> > > clang-tidy: Use const reference for MediaTime parameter to prevent object copy >diff --git a/Source/JavaScriptCore/runtime/JSCJSValue.h b/Source/JavaScriptCore/runtime/JSCJSValue.h >index 582530d44c0f7d24e82a97dbc9513a53e2de0276..f19429e230e83ad1d4aedf1c3ad8d089a45f1381 100644 >--- a/Source/JavaScriptCore/runtime/JSCJSValue.h >+++ b/Source/JavaScriptCore/runtime/JSCJSValue.h >@@ -304,13 +304,13 @@ public: > > JSValue toThis(ExecState*, ECMAMode) const; > >- static bool equal(ExecState*, JSValue v1, JSValue v2); >- static bool equalSlowCase(ExecState*, JSValue v1, JSValue v2); >+ static bool equal(ExecState*, const JSValue& v1, const JSValue& v2); >+ static bool equalSlowCase(ExecState*, const JSValue& v1, const JSValue& v2); > static bool equalSlowCaseInline(ExecState*, JSValue v1, JSValue v2); >- static bool strictEqual(ExecState*, JSValue v1, JSValue v2); >- static bool strictEqualSlowCase(ExecState*, JSValue v1, JSValue v2); >- static bool strictEqualSlowCaseInline(ExecState*, JSValue v1, JSValue v2); >- static TriState pureStrictEqual(JSValue v1, JSValue v2); >+ static bool strictEqual(ExecState*, const JSValue& v1, const JSValue& v2); >+ static bool strictEqualSlowCase(ExecState*, const JSValue& v1, const JSValue& v2); >+ static bool strictEqualSlowCaseInline(ExecState*, const JSValue& v1, const JSValue& v2); >+ static TriState pureStrictEqual(const JSValue& v1, const JSValue& v2); > > bool isCell() const; > JSCell* asCell() const; >@@ -616,11 +616,11 @@ ALWAYS_INLINE EncodedJSValue encodedJSValue() > return JSValue::encode(JSValue()); > } > >-inline bool operator==(const JSValue a, const JSCell* b) { return a == JSValue(b); } >-inline bool operator==(const JSCell* a, const JSValue b) { return JSValue(a) == b; } >+inline bool operator==(const JSValue& a, const JSCell* b) { return a == JSValue(b); } >+inline bool operator==(const JSCell* a, const JSValue& b) { return JSValue(a) == b; } > >-inline bool operator!=(const JSValue a, const JSCell* b) { return a != JSValue(b); } >-inline bool operator!=(const JSCell* a, const JSValue b) { return JSValue(a) != b; } >+inline bool operator!=(const JSValue& a, const JSCell* b) { return a != JSValue(b); } >+inline bool operator!=(const JSCell* a, const JSValue& b) { return JSValue(a) != b; } > > > bool isThisValueAltered(const PutPropertySlot&, JSObject* baseObject); >diff --git a/Source/JavaScriptCore/runtime/JSCJSValueInlines.h b/Source/JavaScriptCore/runtime/JSCJSValueInlines.h >index 6cf3a223c2dabecd28c429bf0725415328d24d1a..643a3ebacbc06b46a9a8d4ab6dd7cc313fca6eec 100644 >--- a/Source/JavaScriptCore/runtime/JSCJSValueInlines.h >+++ b/Source/JavaScriptCore/runtime/JSCJSValueInlines.h >@@ -974,7 +974,7 @@ inline JSValue JSValue::structureOrUndefined() const > } > > // ECMA 11.9.3 >-inline bool JSValue::equal(ExecState* exec, JSValue v1, JSValue v2) >+inline bool JSValue::equal(ExecState* exec, const JSValue& v1, const JSValue& v2) > { > if (v1.isInt32() && v2.isInt32()) > return v1 == v2; >@@ -1095,7 +1095,7 @@ ALWAYS_INLINE bool JSValue::equalSlowCaseInline(ExecState* exec, JSValue v1, JSV > } > > // ECMA 11.9.3 >-ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(ExecState* exec, JSValue v1, JSValue v2) >+ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(ExecState* exec, const JSValue& v1, const JSValue& v2) > { > ASSERT(v1.isCell() && v2.isCell()); > >@@ -1106,7 +1106,7 @@ ALWAYS_INLINE bool JSValue::strictEqualSlowCaseInline(ExecState* exec, JSValue v > return v1 == v2; > } > >-inline bool JSValue::strictEqual(ExecState* exec, JSValue v1, JSValue v2) >+inline bool JSValue::strictEqual(ExecState* exec, const JSValue& v1, const JSValue& v2) > { > if (v1.isInt32() && v2.isInt32()) > return v1 == v2; >@@ -1127,7 +1127,7 @@ inline int32_t JSValue::asInt32ForArithmetic() const > return asInt32(); > } > >-inline TriState JSValue::pureStrictEqual(JSValue v1, JSValue v2) >+inline TriState JSValue::pureStrictEqual(const JSValue& v1, const JSValue& v2) > { > if (v1.isInt32() && v2.isInt32()) > return triState(v1 == v2); >diff --git a/Source/JavaScriptCore/runtime/Operations.cpp b/Source/JavaScriptCore/runtime/Operations.cpp >index 836f953c3a87c57d5c622fbf4c70509050751beb..fa04c4a6c807b77316dd12185fca22e460fde2b5 100644 >--- a/Source/JavaScriptCore/runtime/Operations.cpp >+++ b/Source/JavaScriptCore/runtime/Operations.cpp >@@ -31,12 +31,12 @@ > > namespace JSC { > >-bool JSValue::equalSlowCase(ExecState* exec, JSValue v1, JSValue v2) >+bool JSValue::equalSlowCase(ExecState* exec, const JSValue& v1, const JSValue& v2) > { > return equalSlowCaseInline(exec, v1, v2); > } > >-bool JSValue::strictEqualSlowCase(ExecState* exec, JSValue v1, JSValue v2) >+bool JSValue::strictEqualSlowCase(ExecState* exec, const JSValue& v1, const JSValue& v2) > { > return strictEqualSlowCaseInline(exec, v1, v2); > }
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 192816
:
357588
| 357806