OLD | NEW |
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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 HandleScope scope(isolate); | 1066 HandleScope scope(isolate); |
1067 DCHECK_EQ(1, args.length()); | 1067 DCHECK_EQ(1, args.length()); |
1068 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); | 1068 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
1069 Handle<Object> result; | 1069 Handle<Object> result; |
1070 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 1070 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
1071 Object::ToName(isolate, input)); | 1071 Object::ToName(isolate, input)); |
1072 return *result; | 1072 return *result; |
1073 } | 1073 } |
1074 | 1074 |
1075 | 1075 |
1076 RUNTIME_FUNCTION(Runtime_Equals) { | |
1077 HandleScope scope(isolate); | |
1078 DCHECK_EQ(2, args.length()); | |
1079 CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); | |
1080 CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); | |
1081 Maybe<bool> result = Object::Equals(x, y); | |
1082 if (!result.IsJust()) return isolate->heap()->exception(); | |
1083 // TODO(bmeurer): Change this at some point to return true/false instead. | |
1084 return Smi::FromInt(result.FromJust() ? EQUAL : NOT_EQUAL); | |
1085 } | |
1086 | |
1087 | |
1088 RUNTIME_FUNCTION(Runtime_StrictEquals) { | |
1089 SealHandleScope scope(isolate); | |
1090 DCHECK_EQ(2, args.length()); | |
1091 CONVERT_ARG_CHECKED(Object, x, 0); | |
1092 CONVERT_ARG_CHECKED(Object, y, 1); | |
1093 // TODO(bmeurer): Change this at some point to return true/false instead. | |
1094 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL); | |
1095 } | |
1096 | |
1097 | |
1098 RUNTIME_FUNCTION(Runtime_SameValue) { | 1076 RUNTIME_FUNCTION(Runtime_SameValue) { |
1099 SealHandleScope scope(isolate); | 1077 SealHandleScope scope(isolate); |
1100 DCHECK_EQ(2, args.length()); | 1078 DCHECK_EQ(2, args.length()); |
1101 CONVERT_ARG_CHECKED(Object, x, 0); | 1079 CONVERT_ARG_CHECKED(Object, x, 0); |
1102 CONVERT_ARG_CHECKED(Object, y, 1); | 1080 CONVERT_ARG_CHECKED(Object, y, 1); |
1103 return isolate->heap()->ToBoolean(x->SameValue(y)); | 1081 return isolate->heap()->ToBoolean(x->SameValue(y)); |
1104 } | 1082 } |
1105 | 1083 |
1106 | 1084 |
1107 RUNTIME_FUNCTION(Runtime_SameValueZero) { | 1085 RUNTIME_FUNCTION(Runtime_SameValueZero) { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 DCHECK(args.length() == 2); | 1210 DCHECK(args.length() == 2); |
1233 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1211 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1234 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1212 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1235 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1213 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1236 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); | 1214 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); |
1237 return *o; | 1215 return *o; |
1238 } | 1216 } |
1239 | 1217 |
1240 } // namespace internal | 1218 } // namespace internal |
1241 } // namespace v8 | 1219 } // namespace v8 |
OLD | NEW |