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

Side by Side Diff: src/heap.cc

Issue 6546036: Combine typed and pixel arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix wrong external element call Created 9 years, 10 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 if (!maybe_obj->ToObject(&obj)) return false; 1711 if (!maybe_obj->ToObject(&obj)) return false;
1712 } 1712 }
1713 set_byte_array_map(Map::cast(obj)); 1713 set_byte_array_map(Map::cast(obj));
1714 1714
1715 { MaybeObject* maybe_obj = AllocateByteArray(0, TENURED); 1715 { MaybeObject* maybe_obj = AllocateByteArray(0, TENURED);
1716 if (!maybe_obj->ToObject(&obj)) return false; 1716 if (!maybe_obj->ToObject(&obj)) return false;
1717 } 1717 }
1718 set_empty_byte_array(ByteArray::cast(obj)); 1718 set_empty_byte_array(ByteArray::cast(obj));
1719 1719
1720 { MaybeObject* maybe_obj = 1720 { MaybeObject* maybe_obj =
1721 AllocateMap(PIXEL_ARRAY_TYPE, PixelArray::kAlignedSize); 1721 AllocateMap(EXTERNAL_PIXEL_ARRAY_TYPE, ExternalArray::kAlignedSize);
1722 if (!maybe_obj->ToObject(&obj)) return false; 1722 if (!maybe_obj->ToObject(&obj)) return false;
1723 } 1723 }
1724 set_pixel_array_map(Map::cast(obj)); 1724 set_external_pixel_array_map(Map::cast(obj));
1725 1725
1726 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE, 1726 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE,
1727 ExternalArray::kAlignedSize); 1727 ExternalArray::kAlignedSize);
1728 if (!maybe_obj->ToObject(&obj)) return false; 1728 if (!maybe_obj->ToObject(&obj)) return false;
1729 } 1729 }
1730 set_external_byte_array_map(Map::cast(obj)); 1730 set_external_byte_array_map(Map::cast(obj));
1731 1731
1732 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 1732 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
1733 ExternalArray::kAlignedSize); 1733 ExternalArray::kAlignedSize);
1734 if (!maybe_obj->ToObject(&obj)) return false; 1734 if (!maybe_obj->ToObject(&obj)) return false;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 case kExternalShortArray: 2261 case kExternalShortArray:
2262 return kExternalShortArrayMapRootIndex; 2262 return kExternalShortArrayMapRootIndex;
2263 case kExternalUnsignedShortArray: 2263 case kExternalUnsignedShortArray:
2264 return kExternalUnsignedShortArrayMapRootIndex; 2264 return kExternalUnsignedShortArrayMapRootIndex;
2265 case kExternalIntArray: 2265 case kExternalIntArray:
2266 return kExternalIntArrayMapRootIndex; 2266 return kExternalIntArrayMapRootIndex;
2267 case kExternalUnsignedIntArray: 2267 case kExternalUnsignedIntArray:
2268 return kExternalUnsignedIntArrayMapRootIndex; 2268 return kExternalUnsignedIntArrayMapRootIndex;
2269 case kExternalFloatArray: 2269 case kExternalFloatArray:
2270 return kExternalFloatArrayMapRootIndex; 2270 return kExternalFloatArrayMapRootIndex;
2271 case kExternalPixelArray:
2272 return kExternalPixelArrayMapRootIndex;
2271 default: 2273 default:
2272 UNREACHABLE(); 2274 UNREACHABLE();
2273 return kUndefinedValueRootIndex; 2275 return kUndefinedValueRootIndex;
2274 } 2276 }
2275 } 2277 }
2276 2278
2277 2279
2278 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { 2280 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
2279 // We need to distinguish the minus zero value and this cannot be 2281 // We need to distinguish the minus zero value and this cannot be
2280 // done after conversion to int. Doing this by comparing bit 2282 // done after conversion to int. Doing this by comparing bit
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2695 filler->set_map(one_pointer_filler_map()); 2697 filler->set_map(one_pointer_filler_map());
2696 } else if (size == 2 * kPointerSize) { 2698 } else if (size == 2 * kPointerSize) {
2697 filler->set_map(two_pointer_filler_map()); 2699 filler->set_map(two_pointer_filler_map());
2698 } else { 2700 } else {
2699 filler->set_map(byte_array_map()); 2701 filler->set_map(byte_array_map());
2700 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size)); 2702 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
2701 } 2703 }
2702 } 2704 }
2703 2705
2704 2706
2705 MaybeObject* Heap::AllocatePixelArray(int length, 2707 MaybeObject* Heap::AllocateExternalPixelArray(int length,
2706 uint8_t* external_pointer, 2708 uint8_t* external_pointer,
2707 PretenureFlag pretenure) { 2709 PretenureFlag pretenure) {
2708 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 2710 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
2709 Object* result; 2711 Object* result;
2710 { MaybeObject* maybe_result = 2712 { MaybeObject* maybe_result =
2711 AllocateRaw(PixelArray::kAlignedSize, space, OLD_DATA_SPACE); 2713 AllocateRaw(ExternalPixelArray::kAlignedSize, space, OLD_DATA_SPACE);
2712 if (!maybe_result->ToObject(&result)) return maybe_result; 2714 if (!maybe_result->ToObject(&result)) return maybe_result;
2713 } 2715 }
2714 2716
2715 reinterpret_cast<PixelArray*>(result)->set_map(pixel_array_map()); 2717 reinterpret_cast<ExternalPixelArray*>(result)->set_map(
2716 reinterpret_cast<PixelArray*>(result)->set_length(length); 2718 external_pixel_array_map());
2717 reinterpret_cast<PixelArray*>(result)->set_external_pointer(external_pointer); 2719 reinterpret_cast<ExternalPixelArray*>(result)->set_length(length);
2720 reinterpret_cast<ExternalPixelArray*>(result)->set_external_pointer(
2721 external_pointer);
2718 2722
2719 return result; 2723 return result;
2720 } 2724 }
2721 2725
2722 2726
2723 MaybeObject* Heap::AllocateExternalArray(int length, 2727 MaybeObject* Heap::AllocateExternalArray(int length,
2724 ExternalArrayType array_type, 2728 ExternalArrayType array_type,
2725 void* external_pointer, 2729 void* external_pointer,
2726 PretenureFlag pretenure) { 2730 PretenureFlag pretenure) {
2727 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 2731 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
(...skipping 2860 matching lines...) Expand 10 before | Expand all | Expand 10 after
5588 void ExternalStringTable::TearDown() { 5592 void ExternalStringTable::TearDown() {
5589 new_space_strings_.Free(); 5593 new_space_strings_.Free();
5590 old_space_strings_.Free(); 5594 old_space_strings_.Free();
5591 } 5595 }
5592 5596
5593 5597
5594 List<Object*> ExternalStringTable::new_space_strings_; 5598 List<Object*> ExternalStringTable::new_space_strings_;
5595 List<Object*> ExternalStringTable::old_space_strings_; 5599 List<Object*> ExternalStringTable::old_space_strings_;
5596 5600
5597 } } // namespace v8::internal 5601 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698