OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1419 Object* obj; | 1419 Object* obj; |
1420 ElementsKind elements_kind = GetInitialFastElementsKind(); | 1420 ElementsKind elements_kind = GetInitialFastElementsKind(); |
1421 if (!FLAG_smi_only_arrays) { | 1421 if (!FLAG_smi_only_arrays) { |
1422 elements_kind = FastSmiToObjectElementsKind(elements_kind); | 1422 elements_kind = FastSmiToObjectElementsKind(elements_kind); |
1423 } | 1423 } |
1424 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(), | 1424 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(), |
1425 elements_kind); | 1425 elements_kind); |
1426 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1426 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1427 set_map(Map::cast(obj)); | 1427 set_map(Map::cast(obj)); |
1428 initialize_elements(); | 1428 initialize_elements(); |
1429 if (FLAG_harmony_observation && map()->is_observed()) { | |
1430 // Maintain invariant that observed elements are always in dictionary mode. | |
1431 // For this to work on arrays, we have to make sure to reset length first. | |
1432 if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(0)); | |
Michael Starzinger
2012/12/11 15:20:19
OMG, having to set the JSArray length to 0 here is
rossberg
2012/12/11 15:29:35
Yeah, the whole "abstraction" we have here is bogu
| |
1433 maybe_obj = NormalizeElements(); | |
1434 if (maybe_obj->IsFailure()) return maybe_obj; | |
1435 } | |
1429 return this; | 1436 return this; |
1430 } | 1437 } |
1431 | 1438 |
1432 | 1439 |
1433 MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) { | 1440 MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) { |
1434 ASSERT(this->map()->NumberOfOwnDescriptors() + 1 == | 1441 ASSERT(this->map()->NumberOfOwnDescriptors() + 1 == |
1435 map->NumberOfOwnDescriptors()); | 1442 map->NumberOfOwnDescriptors()); |
1436 if (this->map()->unused_property_fields() == 0) { | 1443 if (this->map()->unused_property_fields() == 0) { |
1437 int new_size = properties()->length() + map->unused_property_fields() + 1; | 1444 int new_size = properties()->length() + map->unused_property_fields() + 1; |
1438 FixedArray* new_properties; | 1445 FixedArray* new_properties; |
(...skipping 4300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5739 #undef WRITE_UINT32_FIELD | 5746 #undef WRITE_UINT32_FIELD |
5740 #undef READ_SHORT_FIELD | 5747 #undef READ_SHORT_FIELD |
5741 #undef WRITE_SHORT_FIELD | 5748 #undef WRITE_SHORT_FIELD |
5742 #undef READ_BYTE_FIELD | 5749 #undef READ_BYTE_FIELD |
5743 #undef WRITE_BYTE_FIELD | 5750 #undef WRITE_BYTE_FIELD |
5744 | 5751 |
5745 | 5752 |
5746 } } // namespace v8::internal | 5753 } } // namespace v8::internal |
5747 | 5754 |
5748 #endif // V8_OBJECTS_INL_H_ | 5755 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |