Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index f672534791d9277fe0d4990a896428bdfca81ef7..0844c1d02bfcc4019bc3da1fe3d99aeb8186aadd 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -1293,14 +1293,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { |
| 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; |
| - { MaybeObject* maybe_new_map = |
| - old_map->CopyDropTransitions(DescriptorArray::MAY_BE_SHARED); |
| - if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
| - } |
| + Map* new_map; |
| + MaybeObject* maybe_new_map = old_map->Copy(DescriptorArray::MAY_BE_SHARED); |
| + if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| - Map::cast(new_map)->set_is_access_check_needed(false); |
| - object->set_map(Map::cast(new_map)); |
| + new_map->set_is_access_check_needed(false); |
| + object->set_map(new_map); |
| } |
| return isolate->heap()->ToBoolean(needs_access_checks); |
| } |
| @@ -1312,14 +1310,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { |
| 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; |
| - { MaybeObject* maybe_new_map = |
| - old_map->CopyDropTransitions(DescriptorArray::MAY_BE_SHARED); |
| - if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
| - } |
| + Map* new_map; |
| + MaybeObject* maybe_new_map = old_map->Copy(DescriptorArray::MAY_BE_SHARED); |
| + if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| - Map::cast(new_map)->set_is_access_check_needed(true); |
| - object->set_map(Map::cast(new_map)); |
| + new_map->set_is_access_check_needed(true); |
| + object->set_map(new_map); |
| } |
| return isolate->heap()->undefined_value(); |
| } |
| @@ -2172,25 +2168,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetReadOnlyPrototype) { |
| if (function->HasFastProperties()) { |
| // Construct a new field descriptor with updated attributes. |
| DescriptorArray* instance_desc = function->map()->instance_descriptors(); |
| + |
| int index = instance_desc->Search(name); |
| ASSERT(index != DescriptorArray::kNotFound); |
| PropertyDetails details = instance_desc->GetDetails(index); |
| + |
| CallbacksDescriptor new_desc(name, |
| instance_desc->GetValue(index), |
| static_cast<PropertyAttributes>(details.attributes() | READ_ONLY), |
| details.index()); |
| - // Construct a new field descriptors array containing the new descriptor. |
| - DescriptorArray* new_descriptors; |
| - { MaybeObject* maybe_descriptors = |
| - instance_desc->CopyReplace(&new_desc, index); |
| - if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; |
| - } |
| + |
| // Create a new map featuring the new field descriptors array. |
| Map* new_map; |
| - { MaybeObject* maybe_map = |
| - function->map()->CopyReplaceDescriptors(new_descriptors); |
| - if (!maybe_map->To(&new_map)) return maybe_map; |
| - } |
| + MaybeObject* maybe_map = |
| + function->map()->CopyReplaceDescriptor(&new_desc, |
|
Jakob Kummerow
2012/07/17 13:43:10
nit: if you want, you can save one line here as fo
|
| + index, |
| + OMIT_TRANSITION); |
| + if (!maybe_map->To(&new_map)) return maybe_map; |
| + |
| function->set_map(new_map); |
| } else { // Dictionary properties. |
| // Directly manipulate the property details. |
| @@ -7829,8 +7824,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) { |
| isolate->heap()->non_strict_arguments_elements_map()); |
| Handle<Map> old_map(result->map()); |
| - Handle<Map> new_map = |
| - isolate->factory()->CopyMapDropTransitions(old_map); |
| + Handle<Map> new_map = isolate->factory()->CopyMap(old_map); |
| new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS); |
| result->set_map(*new_map); |