OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 bool result = elements()->IsFixedArray(); | 3180 bool result = elements()->IsFixedArray(); |
3181 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); | 3181 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); |
3182 return result; | 3182 return result; |
3183 } | 3183 } |
3184 | 3184 |
3185 | 3185 |
3186 Object* JSObject::EnsureWritableFastElements() { | 3186 Object* JSObject::EnsureWritableFastElements() { |
3187 ASSERT(HasFastElements()); | 3187 ASSERT(HasFastElements()); |
3188 FixedArray* elems = FixedArray::cast(elements()); | 3188 FixedArray* elems = FixedArray::cast(elements()); |
3189 if (elems->map() != Heap::fixed_cow_array_map()) return elems; | 3189 if (elems->map() != Heap::fixed_cow_array_map()) return elems; |
3190 Object* writable_elems = Heap::CopyFixedArray(elems); | 3190 Object* writable_elems = Heap::CopyFixedArrayWithMap(elems, |
| 3191 Heap::fixed_array_map()); |
3191 if (writable_elems->IsFailure()) return writable_elems; | 3192 if (writable_elems->IsFailure()) return writable_elems; |
3192 FixedArray::cast(writable_elems)->set_map(Heap::fixed_array_map()); | |
3193 set_elements(FixedArray::cast(writable_elems)); | 3193 set_elements(FixedArray::cast(writable_elems)); |
3194 Counters::cow_arrays_converted.Increment(); | 3194 Counters::cow_arrays_converted.Increment(); |
3195 return writable_elems; | 3195 return writable_elems; |
3196 } | 3196 } |
3197 | 3197 |
3198 | 3198 |
3199 StringDictionary* JSObject::property_dictionary() { | 3199 StringDictionary* JSObject::property_dictionary() { |
3200 ASSERT(!HasFastProperties()); | 3200 ASSERT(!HasFastProperties()); |
3201 return StringDictionary::cast(properties()); | 3201 return StringDictionary::cast(properties()); |
3202 } | 3202 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 #undef WRITE_INT_FIELD | 3538 #undef WRITE_INT_FIELD |
3539 #undef READ_SHORT_FIELD | 3539 #undef READ_SHORT_FIELD |
3540 #undef WRITE_SHORT_FIELD | 3540 #undef WRITE_SHORT_FIELD |
3541 #undef READ_BYTE_FIELD | 3541 #undef READ_BYTE_FIELD |
3542 #undef WRITE_BYTE_FIELD | 3542 #undef WRITE_BYTE_FIELD |
3543 | 3543 |
3544 | 3544 |
3545 } } // namespace v8::internal | 3545 } } // namespace v8::internal |
3546 | 3546 |
3547 #endif // V8_OBJECTS_INL_H_ | 3547 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |