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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 HandleScope scope(isolate); | 243 HandleScope scope(isolate); |
244 DCHECK(args.length() == 2); | 244 DCHECK(args.length() == 2); |
245 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 245 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
246 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 246 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
247 MAYBE_RETURN( | 247 MAYBE_RETURN( |
248 JSReceiver::SetPrototype(obj, prototype, false, Object::THROW_ON_ERROR), | 248 JSReceiver::SetPrototype(obj, prototype, false, Object::THROW_ON_ERROR), |
249 isolate->heap()->exception()); | 249 isolate->heap()->exception()); |
250 return *obj; | 250 return *obj; |
251 } | 251 } |
252 | 252 |
| 253 |
| 254 RUNTIME_FUNCTION(Runtime_SetPrototype) { |
| 255 HandleScope scope(isolate); |
| 256 DCHECK(args.length() == 2); |
| 257 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 258 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 259 MAYBE_RETURN( |
| 260 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR), |
| 261 isolate->heap()->exception()); |
| 262 return *obj; |
| 263 } |
| 264 |
253 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { | 265 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { |
254 HandleScope scope(isolate); | 266 HandleScope scope(isolate); |
255 DCHECK(args.length() == 2); | 267 DCHECK(args.length() == 2); |
256 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 268 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
257 CONVERT_SMI_ARG_CHECKED(properties, 1); | 269 CONVERT_SMI_ARG_CHECKED(properties, 1); |
258 // Conservative upper limit to prevent fuzz tests from going OOM. | 270 // Conservative upper limit to prevent fuzz tests from going OOM. |
259 if (properties > 100000) return isolate->ThrowIllegalOperation(); | 271 if (properties > 100000) return isolate->ThrowIllegalOperation(); |
260 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { | 272 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { |
261 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, | 273 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, |
262 "OptimizeForAdding"); | 274 "OptimizeForAdding"); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 if (!success) return isolate->heap()->exception(); | 894 if (!success) return isolate->heap()->exception(); |
883 MAYBE_RETURN( | 895 MAYBE_RETURN( |
884 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 896 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
885 isolate->heap()->exception()); | 897 isolate->heap()->exception()); |
886 return *value; | 898 return *value; |
887 } | 899 } |
888 | 900 |
889 | 901 |
890 } // namespace internal | 902 } // namespace internal |
891 } // namespace v8 | 903 } // namespace v8 |
OLD | NEW |