Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Unified Diff: src/runtime.js

Issue 1337993005: [runtime] Replace the EQUALS builtin with proper Object::Equals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michi's nit. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 6df7faa719b3dcbccd5b5168bea6789c07330e35..fcb9471cd476add7cc2be893a996ac41142033c3 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -42,68 +42,6 @@ var isConcatSpreadableSymbol =
-----------------------------------
*/
-// ECMA-262 Section 11.9.3.
-function EQUALS(y) {
- if (IS_STRING(this) && IS_STRING(y)) return %StringEquals(this, y);
- var x = this;
-
- while (true) {
- if (IS_NUMBER(x)) {
- while (true) {
- if (IS_NUMBER(y)) return %NumberEquals(x, y);
- if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
- if (!IS_SPEC_OBJECT(y)) {
- if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal
- // String or boolean.
- return %NumberEquals(x, %to_number_fun(y));
- }
- y = %to_primitive(y, NO_HINT);
- }
- } else if (IS_STRING(x)) {
- while (true) {
- if (IS_STRING(y)) return %StringEquals(x, y);
- if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y);
- if (IS_BOOLEAN(y)) {
- return %NumberEquals(%to_number_fun(x), %to_number_fun(y));
- }
- if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
- if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal
- y = %to_primitive(y, NO_HINT);
- }
- } else if (IS_SYMBOL(x)) {
- if (IS_SYMBOL(y)) return %_ObjectEquals(x, y) ? 0 : 1;
- return 1; // not equal
- } else if (IS_BOOLEAN(x)) {
- if (IS_BOOLEAN(y)) return %_ObjectEquals(x, y) ? 0 : 1;
- if (IS_NULL_OR_UNDEFINED(y)) return 1;
- if (IS_NUMBER(y)) return %NumberEquals(%to_number_fun(x), y);
- if (IS_STRING(y)) {
- return %NumberEquals(%to_number_fun(x), %to_number_fun(y));
- }
- if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) return 1; // not equal
- // y is object.
- x = %to_number_fun(x);
- y = %to_primitive(y, NO_HINT);
- } else if (IS_NULL_OR_UNDEFINED(x)) {
- return IS_NULL_OR_UNDEFINED(y) ? 0 : 1;
- } else if (IS_SIMD_VALUE(x)) {
- if (!IS_SIMD_VALUE(y)) return 1; // not equal
- return %SimdEquals(x, y);
- } else {
- // x is an object.
- if (IS_SPEC_OBJECT(y)) return %_ObjectEquals(x, y) ? 0 : 1;
- if (IS_NULL_OR_UNDEFINED(y)) return 1; // not equal
- if (IS_BOOLEAN(y)) {
- y = %to_number_fun(y);
- } else if (IS_SYMBOL(y) || IS_SIMD_VALUE(y)) {
- return 1; // not equal
- }
- x = %to_primitive(x, NO_HINT);
- }
- }
-}
-
-
// ECMA-262, section 11.8.5, page 53. The 'ncr' parameter is used as
// the result when either (or both) the operands are NaN.
function COMPARE(x, ncr) {
@@ -498,7 +436,6 @@ $toString = ToString;
"compare_builtin", COMPARE,
"compare_strong_builtin", COMPARE_STRONG,
"concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY,
- "equals_builtin", EQUALS,
"reflect_apply_prepare_builtin", REFLECT_APPLY_PREPARE,
"reflect_construct_prepare_builtin", REFLECT_CONSTRUCT_PREPARE,
]);
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698