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

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

Issue 1693833002: Remove strong mode support from binary operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 return Smi::FromInt(GREATER); 1170 return Smi::FromInt(GREATER);
1171 case ComparisonResult::kUndefined: 1171 case ComparisonResult::kUndefined:
1172 return *ncr; 1172 return *ncr;
1173 } 1173 }
1174 UNREACHABLE(); 1174 UNREACHABLE();
1175 } 1175 }
1176 return isolate->heap()->exception(); 1176 return isolate->heap()->exception();
1177 } 1177 }
1178 1178
1179 1179
1180 // TODO(bmeurer): Kill this special wrapper and use TF compatible LessThan,
1181 // GreaterThan, etc. which return true or false.
1182 RUNTIME_FUNCTION(Runtime_Compare_Strong) {
1183 HandleScope scope(isolate);
1184 DCHECK_EQ(3, args.length());
1185 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
1186 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
1187 CONVERT_ARG_HANDLE_CHECKED(Object, ncr, 2);
1188 Maybe<ComparisonResult> result = Object::Compare(x, y, Strength::STRONG);
1189 if (result.IsJust()) {
1190 switch (result.FromJust()) {
1191 case ComparisonResult::kLessThan:
1192 return Smi::FromInt(LESS);
1193 case ComparisonResult::kEqual:
1194 return Smi::FromInt(EQUAL);
1195 case ComparisonResult::kGreaterThan:
1196 return Smi::FromInt(GREATER);
1197 case ComparisonResult::kUndefined:
1198 return *ncr;
1199 }
1200 UNREACHABLE();
1201 }
1202 return isolate->heap()->exception();
1203 }
1204
1205
1206 RUNTIME_FUNCTION(Runtime_InstanceOf) { 1180 RUNTIME_FUNCTION(Runtime_InstanceOf) {
1207 // ECMA-262, section 11.8.6, page 54. 1181 // ECMA-262, section 11.8.6, page 54.
1208 HandleScope shs(isolate); 1182 HandleScope shs(isolate);
1209 DCHECK_EQ(2, args.length()); 1183 DCHECK_EQ(2, args.length());
1210 DCHECK(args.length() == 2); 1184 DCHECK(args.length() == 2);
1211 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 1185 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
1212 CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1); 1186 CONVERT_ARG_HANDLE_CHECKED(Object, callable, 1);
1213 // {callable} must have a [[Call]] internal method. 1187 // {callable} must have a [[Call]] internal method.
1214 if (!callable->IsCallable()) { 1188 if (!callable->IsCallable()) {
1215 THROW_NEW_ERROR_RETURN_FAILURE( 1189 THROW_NEW_ERROR_RETURN_FAILURE(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 DCHECK(args.length() == 2); 1270 DCHECK(args.length() == 2);
1297 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1271 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1298 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1272 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1299 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1273 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1300 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); 1274 isolate, o, JSReceiver::DefineProperties(isolate, o, properties));
1301 return *o; 1275 return *o;
1302 } 1276 }
1303 1277
1304 } // namespace internal 1278 } // namespace internal
1305 } // namespace v8 1279 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698