| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // 4. Return FromPropertyDescriptor(desc). | 289 // 4. Return FromPropertyDescriptor(desc). |
| 290 if (!found) return isolate->heap()->undefined_value(); | 290 if (!found) return isolate->heap()->undefined_value(); |
| 291 return *desc.ToObject(isolate); | 291 return *desc.ToObject(isolate); |
| 292 } | 292 } |
| 293 | 293 |
| 294 | 294 |
| 295 RUNTIME_FUNCTION(Runtime_PreventExtensions) { | 295 RUNTIME_FUNCTION(Runtime_PreventExtensions) { |
| 296 HandleScope scope(isolate); | 296 HandleScope scope(isolate); |
| 297 DCHECK(args.length() == 1); | 297 DCHECK(args.length() == 1); |
| 298 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 298 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 299 if (JSReceiver::PreventExtensions(obj, Object::THROW_ON_ERROR).IsNothing()) | 299 MAYBE_RETURN(JSReceiver::PreventExtensions(obj, Object::THROW_ON_ERROR), |
| 300 return isolate->heap()->exception(); | 300 isolate->heap()->exception()); |
| 301 return *obj; | 301 return *obj; |
| 302 } | 302 } |
| 303 | 303 |
| 304 | 304 |
| 305 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 305 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
| 306 HandleScope scope(isolate); | 306 HandleScope scope(isolate); |
| 307 DCHECK(args.length() == 1); | 307 DCHECK(args.length() == 1); |
| 308 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 308 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 309 return isolate->heap()->ToBoolean(JSObject::IsExtensible(obj)); | 309 Maybe<bool> result = JSReceiver::IsExtensible(obj); |
| 310 MAYBE_RETURN(result, isolate->heap()->exception()); |
| 311 return isolate->heap()->ToBoolean(result.FromJust()); |
| 310 } | 312 } |
| 311 | 313 |
| 312 | 314 |
| 313 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { | 315 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { |
| 314 HandleScope scope(isolate); | 316 HandleScope scope(isolate); |
| 315 DCHECK(args.length() == 2); | 317 DCHECK(args.length() == 2); |
| 316 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 318 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
| 317 CONVERT_SMI_ARG_CHECKED(properties, 1); | 319 CONVERT_SMI_ARG_CHECKED(properties, 1); |
| 318 // Conservative upper limit to prevent fuzz tests from going OOM. | 320 // Conservative upper limit to prevent fuzz tests from going OOM. |
| 319 RUNTIME_ASSERT(properties <= 100000); | 321 RUNTIME_ASSERT(properties <= 100000); |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 | 1587 |
| 1586 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1588 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
| 1587 HandleScope scope(isolate); | 1589 HandleScope scope(isolate); |
| 1588 DCHECK(args.length() == 2); | 1590 DCHECK(args.length() == 2); |
| 1589 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1591 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
| 1590 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1592 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
| 1591 return JSReceiver::DefineProperties(isolate, o, properties); | 1593 return JSReceiver::DefineProperties(isolate, o, properties); |
| 1592 } | 1594 } |
| 1593 } // namespace internal | 1595 } // namespace internal |
| 1594 } // namespace v8 | 1596 } // namespace v8 |
| OLD | NEW |