Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(961)

Unified Diff: src/runtime.cc

Issue 18067: Fix issue 6264 with a test case.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 1073)
+++ src/runtime.cc (working copy)
@@ -343,8 +343,16 @@
static Object* Runtime_DisableAccessChecks(Arguments args) {
ASSERT(args.length() == 1);
CONVERT_CHECKED(HeapObject, object, args[0]);
- bool needs_access_checks = object->map()->is_access_check_needed();
- object->map()->set_is_access_check_needed(false);
+ Map* old_map = object->map();
+ bool needs_access_checks = old_map->is_access_check_needed();
+ if (needs_access_checks) {
+ // Copy map so it won't interfere constructor's initial map.
+ Object* new_map = old_map->CopyDropTransitions();
+ if (new_map->IsFailure()) return new_map;
+
+ Map::cast(new_map)->set_is_access_check_needed(false);
+ object->set_map(Map::cast(new_map));
+ }
return needs_access_checks ? Heap::true_value() : Heap::false_value();
}
@@ -352,7 +360,15 @@
static Object* Runtime_EnableAccessChecks(Arguments args) {
ASSERT(args.length() == 1);
CONVERT_CHECKED(HeapObject, object, args[0]);
- object->map()->set_is_access_check_needed(true);
+ Map* old_map = object->map();
+ if (!old_map->is_access_check_needed()) {
+ // Copy map so it won't interfere constructor's initial map.
+ Object* new_map = old_map->CopyDropTransitions();
+ if (new_map->IsFailure()) return new_map;
+
+ Map::cast(new_map)->set_is_access_check_needed(true);
+ object->set_map(Map::cast(new_map));
+ }
return Heap::undefined_value();
}
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698