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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 isolate->heap()->exception()); | 263 isolate->heap()->exception()); |
264 return *obj; | 264 return *obj; |
265 } | 265 } |
266 | 266 |
267 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { | 267 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { |
268 HandleScope scope(isolate); | 268 HandleScope scope(isolate); |
269 DCHECK(args.length() == 2); | 269 DCHECK(args.length() == 2); |
270 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 270 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
271 CONVERT_SMI_ARG_CHECKED(properties, 1); | 271 CONVERT_SMI_ARG_CHECKED(properties, 1); |
272 // Conservative upper limit to prevent fuzz tests from going OOM. | 272 // Conservative upper limit to prevent fuzz tests from going OOM. |
273 RUNTIME_ASSERT(properties <= 100000); | 273 if (properties > 100000) return isolate->ThrowIllegalOperation(); |
274 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { | 274 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { |
275 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, | 275 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, |
276 "OptimizeForAdding"); | 276 "OptimizeForAdding"); |
277 } | 277 } |
278 return *object; | 278 return *object; |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 namespace { | 282 namespace { |
283 | 283 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 isolate, o, key, &success, LookupIterator::OWN); | 1005 isolate, o, key, &success, LookupIterator::OWN); |
1006 if (!success) return isolate->heap()->exception(); | 1006 if (!success) return isolate->heap()->exception(); |
1007 MAYBE_RETURN( | 1007 MAYBE_RETURN( |
1008 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 1008 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
1009 isolate->heap()->exception()); | 1009 isolate->heap()->exception()); |
1010 return *value; | 1010 return *value; |
1011 } | 1011 } |
1012 | 1012 |
1013 } // namespace internal | 1013 } // namespace internal |
1014 } // namespace v8 | 1014 } // namespace v8 |
OLD | NEW |