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/v8.h" | 5 #include "src/v8.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.h" | 9 #include "src/debug.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 | 380 |
381 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 381 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
382 SealHandleScope shs(isolate); | 382 SealHandleScope shs(isolate); |
383 DCHECK(args.length() == 1); | 383 DCHECK(args.length() == 1); |
384 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 384 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
385 return isolate->heap()->ToBoolean(obj->IsExtensible()); | 385 return isolate->heap()->ToBoolean(obj->IsExtensible()); |
386 } | 386 } |
387 | 387 |
388 | 388 |
389 RUNTIME_FUNCTION(Runtime_DisableAccessChecks) { | |
390 HandleScope scope(isolate); | |
391 DCHECK(args.length() == 1); | |
392 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0); | |
393 Handle<Map> old_map(object->map()); | |
394 bool needs_access_checks = old_map->is_access_check_needed(); | |
395 if (needs_access_checks) { | |
396 // Copy map so it won't interfere constructor's initial map. | |
397 Handle<Map> new_map = Map::Copy(old_map, "DisableAccessChecks"); | |
398 new_map->set_is_access_check_needed(false); | |
399 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map); | |
400 } | |
401 return isolate->heap()->ToBoolean(needs_access_checks); | |
402 } | |
403 | |
404 | |
405 RUNTIME_FUNCTION(Runtime_EnableAccessChecks) { | |
406 HandleScope scope(isolate); | |
407 DCHECK(args.length() == 1); | |
408 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | |
409 Handle<Map> old_map(object->map()); | |
410 RUNTIME_ASSERT(!old_map->is_access_check_needed()); | |
411 // Copy map so it won't interfere constructor's initial map. | |
412 Handle<Map> new_map = Map::Copy(old_map, "EnableAccessChecks"); | |
413 new_map->set_is_access_check_needed(true); | |
414 JSObject::MigrateToMap(object, new_map); | |
415 return isolate->heap()->undefined_value(); | |
416 } | |
417 | |
418 | |
419 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { | 389 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { |
420 HandleScope scope(isolate); | 390 HandleScope scope(isolate); |
421 DCHECK(args.length() == 2); | 391 DCHECK(args.length() == 2); |
422 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 392 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
423 CONVERT_SMI_ARG_CHECKED(properties, 1); | 393 CONVERT_SMI_ARG_CHECKED(properties, 1); |
424 // Conservative upper limit to prevent fuzz tests from going OOM. | 394 // Conservative upper limit to prevent fuzz tests from going OOM. |
425 RUNTIME_ASSERT(properties <= 100000); | 395 RUNTIME_ASSERT(properties <= 100000); |
426 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { | 396 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { |
427 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, | 397 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties, |
428 "OptimizeForAdding"); | 398 "OptimizeForAdding"); |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); | 1414 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); |
1445 | 1415 |
1446 RETURN_FAILURE_ON_EXCEPTION( | 1416 RETURN_FAILURE_ON_EXCEPTION( |
1447 isolate, | 1417 isolate, |
1448 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), | 1418 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), |
1449 setter, attrs)); | 1419 setter, attrs)); |
1450 return isolate->heap()->undefined_value(); | 1420 return isolate->heap()->undefined_value(); |
1451 } | 1421 } |
1452 } // namespace internal | 1422 } // namespace internal |
1453 } // namespace v8 | 1423 } // namespace v8 |
OLD | NEW |