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

Side by Side Diff: src/elements.cc

Issue 11280054: Ensure CopyElementsImpl is always executed so it fills in holes even if from_size is 0. Allow Fixed… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 ElementsKind elements_kind = from_holder->GetElementsKind(); 689 ElementsKind elements_kind = from_holder->GetElementsKind();
690 bool is_packed = IsFastPackedElementsKind(elements_kind) && 690 bool is_packed = IsFastPackedElementsKind(elements_kind) &&
691 from_holder->IsJSArray(); 691 from_holder->IsJSArray();
692 if (is_packed) { 692 if (is_packed) {
693 packed_size = Smi::cast(JSArray::cast(from_holder)->length())->value(); 693 packed_size = Smi::cast(JSArray::cast(from_holder)->length())->value();
694 if (copy_size >= 0 && packed_size > copy_size) { 694 if (copy_size >= 0 && packed_size > copy_size) {
695 packed_size = copy_size; 695 packed_size = copy_size;
696 } 696 }
697 } 697 }
698 } 698 }
699 if (from->length() == 0 || copy_size == 0) {
700 return from;
701 }
702 return ElementsAccessorSubclass::CopyElementsImpl( 699 return ElementsAccessorSubclass::CopyElementsImpl(
703 from, from_start, to, to_kind, to_start, packed_size, copy_size); 700 from, from_start, to, to_kind, to_start, packed_size, copy_size);
704 } 701 }
705 702
706 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray( 703 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray(
707 Object* receiver, 704 Object* receiver,
708 JSObject* holder, 705 JSObject* holder,
709 FixedArray* to, 706 FixedArray* to,
710 FixedArrayBase* from) { 707 FixedArrayBase* from) {
711 int len0 = to->length(); 708 int len0 = to->length();
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; 1855 if (!maybe_obj->To(&new_backing_store)) return maybe_obj;
1859 new_backing_store->set(0, length); 1856 new_backing_store->set(0, length);
1860 { MaybeObject* result = array->SetContent(new_backing_store); 1857 { MaybeObject* result = array->SetContent(new_backing_store);
1861 if (result->IsFailure()) return result; 1858 if (result->IsFailure()) return result;
1862 } 1859 }
1863 return array; 1860 return array;
1864 } 1861 }
1865 1862
1866 1863
1867 } } // namespace v8::internal 1864 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698