Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: src/objects-inl.h

Issue 3466013: Fix copy-on-write assert by setting the new array map early. (Closed)
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698