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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1695743003: [builtins] Support SameValue and SameValueZero via runtime functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 RUNTIME_FUNCTION(Runtime_StrictEquals) { 1153 RUNTIME_FUNCTION(Runtime_StrictEquals) {
1154 SealHandleScope scope(isolate); 1154 SealHandleScope scope(isolate);
1155 DCHECK_EQ(2, args.length()); 1155 DCHECK_EQ(2, args.length());
1156 CONVERT_ARG_CHECKED(Object, x, 0); 1156 CONVERT_ARG_CHECKED(Object, x, 0);
1157 CONVERT_ARG_CHECKED(Object, y, 1); 1157 CONVERT_ARG_CHECKED(Object, y, 1);
1158 // TODO(bmeurer): Change this at some point to return true/false instead. 1158 // TODO(bmeurer): Change this at some point to return true/false instead.
1159 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL); 1159 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL);
1160 } 1160 }
1161 1161
1162 1162
1163 RUNTIME_FUNCTION(Runtime_SameValue) {
1164 SealHandleScope scope(isolate);
1165 DCHECK_EQ(2, args.length());
1166 CONVERT_ARG_CHECKED(Object, x, 0);
1167 CONVERT_ARG_CHECKED(Object, y, 1);
1168 return isolate->heap()->ToBoolean(x->SameValue(y));
1169 }
1170
1171
1172 RUNTIME_FUNCTION(Runtime_SameValueZero) {
1173 SealHandleScope scope(isolate);
1174 DCHECK_EQ(2, args.length());
1175 CONVERT_ARG_CHECKED(Object, x, 0);
1176 CONVERT_ARG_CHECKED(Object, y, 1);
1177 return isolate->heap()->ToBoolean(x->SameValueZero(y));
1178 }
1179
1180
1163 // TODO(bmeurer): Kill this special wrapper and use TF compatible LessThan, 1181 // TODO(bmeurer): Kill this special wrapper and use TF compatible LessThan,
1164 // GreaterThan, etc. which return true or false. 1182 // GreaterThan, etc. which return true or false.
1165 RUNTIME_FUNCTION(Runtime_Compare) { 1183 RUNTIME_FUNCTION(Runtime_Compare) {
1166 HandleScope scope(isolate); 1184 HandleScope scope(isolate);
1167 DCHECK_EQ(3, args.length()); 1185 DCHECK_EQ(3, args.length());
1168 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); 1186 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
1169 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); 1187 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
1170 CONVERT_ARG_HANDLE_CHECKED(Object, ncr, 2); 1188 CONVERT_ARG_HANDLE_CHECKED(Object, ncr, 2);
1171 Maybe<ComparisonResult> result = Object::Compare(x, y); 1189 Maybe<ComparisonResult> result = Object::Compare(x, y);
1172 if (result.IsJust()) { 1190 if (result.IsJust()) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 DCHECK(args.length() == 2); 1323 DCHECK(args.length() == 2);
1306 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1324 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1307 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1325 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1308 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1326 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1309 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); 1327 isolate, o, JSReceiver::DefineProperties(isolate, o, properties));
1310 return *o; 1328 return *o;
1311 } 1329 }
1312 1330
1313 } // namespace internal 1331 } // namespace internal
1314 } // namespace v8 1332 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698