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