Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 7e0ba9f1000a7246277e82bf52ff2ae2e0be0668..c09bfc169358c5a13090c7048fec8e6d12eb76dc 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1414,6 +1414,40 @@ MaybeObject* JSObject::ResetElements() { |
| } |
| +MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) { |
| + int size = |
|
danno
2012/10/17 13:54:23
As discussed, please convert this into something a
Toon Verwaest
2012/10/17 14:03:40
Done.
|
| + map->NumberOfOwnDescriptors() - |
| + map->inobject_properties() + |
| + map->unused_property_fields(); |
| + if (properties()->length() == size) { |
| + set_map(map); |
| + return this; |
| + } |
| + FixedArray* new_properties; |
| + MaybeObject* maybe_properties = properties()->CopySize(size); |
| + if (!maybe_properties->To(&new_properties)) return maybe_properties; |
| + set_properties(new_properties); |
| + set_map(map); |
| + return new_properties; |
| +} |
| + |
| + |
| +bool JSObject::TryTransitionToField(String* key) { |
|
danno
2012/10/17 13:54:23
This should only be called by handlified code, it
Toon Verwaest
2012/10/17 14:03:40
Done.
|
| + Map* own_map = map(); |
| + if (!own_map->HasTransitionArray()) return false; |
| + TransitionArray* transitions = own_map->transitions(); |
| + int transition = transitions->Search(key); |
| + if (transition == TransitionArray::kNotFound) return false; |
| + PropertyDetails target_details = transitions->GetTargetDetails(transition); |
| + if (target_details.type() != FIELD) return false; |
| + if (target_details.attributes() != NONE) return false; |
| + Handle<JSObject> self(this); |
| + Handle<Map> target(transitions->GetTarget(transition)); |
| + JSObject::AddFastPropertyUsingMap(self, target); |
| + return true; |
| +} |
| + |
| + |
| ACCESSORS(Oddball, to_string, String, kToStringOffset) |
| ACCESSORS(Oddball, to_number, Object, kToNumberOffset) |