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

Side by Side Diff: src/objects.cc

Issue 7473: Apply fix for issue 116 from bleeding_edge branch. Update version... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 12 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('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 4637 matching lines...) Expand 10 before | Expand all | Expand 10 after
4648 elms->set(index, value); 4648 elms->set(index, value);
4649 if (IsJSArray()) { 4649 if (IsJSArray()) {
4650 // Update the length of the array if needed. 4650 // Update the length of the array if needed.
4651 uint32_t array_length = 0; 4651 uint32_t array_length = 0;
4652 CHECK(Array::IndexFromObject(JSArray::cast(this)->length(), 4652 CHECK(Array::IndexFromObject(JSArray::cast(this)->length(),
4653 &array_length)); 4653 &array_length));
4654 if (index >= array_length) { 4654 if (index >= array_length) {
4655 JSArray::cast(this)->set_length(Smi::FromInt(index + 1)); 4655 JSArray::cast(this)->set_length(Smi::FromInt(index + 1));
4656 } 4656 }
4657 } 4657 }
4658 return this; 4658 return value;
4659 } 4659 }
4660 4660
4661 // Allow gap in fast case. 4661 // Allow gap in fast case.
4662 if ((index - elms_length) < kMaxGap) { 4662 if ((index - elms_length) < kMaxGap) {
4663 // Try allocating extra space. 4663 // Try allocating extra space.
4664 int new_capacity = NewElementsCapacity(index+1); 4664 int new_capacity = NewElementsCapacity(index+1);
4665 if (new_capacity <= kMaxFastElementsLength || 4665 if (new_capacity <= kMaxFastElementsLength ||
4666 !ShouldConvertToSlowElements(new_capacity)) { 4666 !ShouldConvertToSlowElements(new_capacity)) {
4667 ASSERT(static_cast<uint32_t>(new_capacity) > index); 4667 ASSERT(static_cast<uint32_t>(new_capacity) > index);
4668 Object* obj = Heap::AllocateFixedArrayWithHoles(new_capacity); 4668 Object* obj = Heap::AllocateFixedArrayWithHoles(new_capacity);
4669 if (obj->IsFailure()) return obj; 4669 if (obj->IsFailure()) return obj;
4670 SetFastElements(FixedArray::cast(obj)); 4670 SetFastElements(FixedArray::cast(obj));
4671 if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(index + 1)); 4671 if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(index + 1));
4672 FixedArray::cast(elements())->set(index, value); 4672 FixedArray::cast(elements())->set(index, value);
4673 return this; 4673 return value;
4674 } 4674 }
4675 } 4675 }
4676 4676
4677 // Otherwise default to slow case. 4677 // Otherwise default to slow case.
4678 Object* obj = NormalizeElements(); 4678 Object* obj = NormalizeElements();
4679 if (obj->IsFailure()) return obj; 4679 if (obj->IsFailure()) return obj;
4680 ASSERT(!HasFastElements()); 4680 ASSERT(!HasFastElements());
4681 return SetElement(index, value); 4681 return SetElement(index, value);
4682 } 4682 }
4683 4683
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
6428 // No break point. 6428 // No break point.
6429 if (break_point_objects()->IsUndefined()) return 0; 6429 if (break_point_objects()->IsUndefined()) return 0;
6430 // Single beak point. 6430 // Single beak point.
6431 if (!break_point_objects()->IsFixedArray()) return 1; 6431 if (!break_point_objects()->IsFixedArray()) return 1;
6432 // Multiple break points. 6432 // Multiple break points.
6433 return FixedArray::cast(break_point_objects())->length(); 6433 return FixedArray::cast(break_point_objects())->length();
6434 } 6434 }
6435 6435
6436 6436
6437 } } // namespace v8::internal 6437 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698