From 702167b107d6890cd50f9b1e66bcb02149644969 Mon Sep 17 00:00:00 2001 From: "verwaest@chromium.org" Date: Mon, 23 Jun 2014 09:04:17 +0000 Subject: [PATCH] Simplify {Enable|Disable}AccessCheck BUG= R=dcarney@chromium.org Review URL: https://codereview.chromium.org/334243003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21919 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/runtime.cc | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/runtime.cc b/src/runtime.cc index c0b3c40..b5aa651 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -2126,11 +2126,7 @@ RUNTIME_FUNCTION(Runtime_DisableAccessChecks) { // Copy map so it won't interfere constructor's initial map. Handle new_map = Map::Copy(old_map); new_map->set_is_access_check_needed(false); - if (object->IsJSObject()) { - JSObject::MigrateToMap(Handle::cast(object), new_map); - } else { - object->set_map(*new_map); - } + JSObject::MigrateToMap(Handle::cast(object), new_map); } return isolate->heap()->ToBoolean(needs_access_checks); } @@ -2141,16 +2137,11 @@ RUNTIME_FUNCTION(Runtime_EnableAccessChecks) { ASSERT(args.length() == 1); CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0); Handle old_map(object->map()); - if (!old_map->is_access_check_needed()) { - // Copy map so it won't interfere constructor's initial map. - Handle new_map = Map::Copy(old_map); - new_map->set_is_access_check_needed(true); - if (object->IsJSObject()) { - JSObject::MigrateToMap(Handle::cast(object), new_map); - } else { - object->set_map(*new_map); - } - } + ASSERT(!old_map->is_access_check_needed()); + // Copy map so it won't interfere constructor's initial map. + Handle new_map = Map::Copy(old_map); + new_map->set_is_access_check_needed(true); + JSObject::MigrateToMap(Handle::cast(object), new_map); return isolate->heap()->undefined_value(); } -- 2.7.4