Commit 3cbb49f2 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Replace uses of set_map by MigrateToMap.

BUG=
R=ishell@chromium.org

Review URL: https://codereview.chromium.org/218783003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20389 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f30452ba
...@@ -2048,37 +2048,39 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) { ...@@ -2048,37 +2048,39 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetTemplateField) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) {
SealHandleScope shs(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(HeapObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
Map* old_map = object->map(); Handle<Map> old_map(object->map());
bool needs_access_checks = old_map->is_access_check_needed(); bool needs_access_checks = old_map->is_access_check_needed();
if (needs_access_checks) { if (needs_access_checks) {
// Copy map so it won't interfere constructor's initial map. // Copy map so it won't interfere constructor's initial map.
Map* new_map; Handle<Map> new_map = Map::Copy(old_map);
MaybeObject* maybe_new_map = old_map->Copy();
if (!maybe_new_map->To(&new_map)) return maybe_new_map;
new_map->set_is_access_check_needed(false); new_map->set_is_access_check_needed(false);
object->set_map(new_map); if (object->IsJSObject()) {
JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
} else {
object->set_map(*new_map);
}
} }
return isolate->heap()->ToBoolean(needs_access_checks); return isolate->heap()->ToBoolean(needs_access_checks);
} }
RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) {
SealHandleScope shs(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(HeapObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
Map* old_map = object->map(); Handle<Map> old_map(object->map());
if (!old_map->is_access_check_needed()) { if (!old_map->is_access_check_needed()) {
// Copy map so it won't interfere constructor's initial map. // Copy map so it won't interfere constructor's initial map.
Map* new_map; Handle<Map> new_map = Map::Copy(old_map);
MaybeObject* maybe_new_map = old_map->Copy();
if (!maybe_new_map->To(&new_map)) return maybe_new_map;
new_map->set_is_access_check_needed(true); new_map->set_is_access_check_needed(true);
object->set_map(new_map); if (object->IsJSObject()) {
JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
} else {
object->set_map(*new_map);
}
} }
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -2945,9 +2947,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) { ...@@ -2945,9 +2947,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetPrototype) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
SealHandleScope shs(isolate); HandleScope shs(isolate);
RUNTIME_ASSERT(args.length() == 1); RUNTIME_ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
String* name = isolate->heap()->prototype_string(); String* name = isolate->heap()->prototype_string();
...@@ -2970,9 +2972,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { ...@@ -2970,9 +2972,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
instance_desc, &new_desc, index, OMIT_TRANSITION); instance_desc, &new_desc, index, OMIT_TRANSITION);
if (!maybe_map->To(&new_map)) return maybe_map; if (!maybe_map->To(&new_map)) return maybe_map;
function->set_map(new_map); JSObject::MigrateToMap(function, handle(new_map));
} else { // Dictionary properties. } else { // Dictionary properties.
// Directly manipulate the property details. // Directly manipulate the property details.
DisallowHeapAllocation no_gc;
int entry = function->property_dictionary()->FindEntry(name); int entry = function->property_dictionary()->FindEntry(name);
ASSERT(entry != NameDictionary::kNotFound); ASSERT(entry != NameDictionary::kNotFound);
PropertyDetails details = function->property_dictionary()->DetailsAt(entry); PropertyDetails details = function->property_dictionary()->DetailsAt(entry);
...@@ -2982,7 +2985,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { ...@@ -2982,7 +2985,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) {
details.dictionary_index()); details.dictionary_index());
function->property_dictionary()->DetailsAtPut(entry, new_details); function->property_dictionary()->DetailsAtPut(entry, new_details);
} }
return function; return *function;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment