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

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: final version Created 9 years, 9 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/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 if (!maybe_obj->ToObject(&obj)) return false; 1700 if (!maybe_obj->ToObject(&obj)) return false;
1701 } 1701 }
1702 set_byte_array_map(Map::cast(obj)); 1702 set_byte_array_map(Map::cast(obj));
1703 1703
1704 { MaybeObject* maybe_obj = AllocateByteArray(0, TENURED); 1704 { MaybeObject* maybe_obj = AllocateByteArray(0, TENURED);
1705 if (!maybe_obj->ToObject(&obj)) return false; 1705 if (!maybe_obj->ToObject(&obj)) return false;
1706 } 1706 }
1707 set_empty_byte_array(ByteArray::cast(obj)); 1707 set_empty_byte_array(ByteArray::cast(obj));
1708 1708
1709 { MaybeObject* maybe_obj = 1709 { MaybeObject* maybe_obj =
1710 AllocateMap(PIXEL_ARRAY_TYPE, PixelArray::kAlignedSize); 1710 AllocateMap(EXTERNAL_PIXEL_ARRAY_TYPE, ExternalArray::kAlignedSize);
1711 if (!maybe_obj->ToObject(&obj)) return false; 1711 if (!maybe_obj->ToObject(&obj)) return false;
1712 } 1712 }
1713 set_pixel_array_map(Map::cast(obj)); 1713 set_external_pixel_array_map(Map::cast(obj));
1714 1714
1715 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE, 1715 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE,
1716 ExternalArray::kAlignedSize); 1716 ExternalArray::kAlignedSize);
1717 if (!maybe_obj->ToObject(&obj)) return false; 1717 if (!maybe_obj->ToObject(&obj)) return false;
1718 } 1718 }
1719 set_external_byte_array_map(Map::cast(obj)); 1719 set_external_byte_array_map(Map::cast(obj));
1720 1720
1721 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 1721 { MaybeObject* maybe_obj = AllocateMap(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
1722 ExternalArray::kAlignedSize); 1722 ExternalArray::kAlignedSize);
1723 if (!maybe_obj->ToObject(&obj)) return false; 1723 if (!maybe_obj->ToObject(&obj)) return false;
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 case kExternalShortArray: 2221 case kExternalShortArray:
2222 return kExternalShortArrayMapRootIndex; 2222 return kExternalShortArrayMapRootIndex;
2223 case kExternalUnsignedShortArray: 2223 case kExternalUnsignedShortArray:
2224 return kExternalUnsignedShortArrayMapRootIndex; 2224 return kExternalUnsignedShortArrayMapRootIndex;
2225 case kExternalIntArray: 2225 case kExternalIntArray:
2226 return kExternalIntArrayMapRootIndex; 2226 return kExternalIntArrayMapRootIndex;
2227 case kExternalUnsignedIntArray: 2227 case kExternalUnsignedIntArray:
2228 return kExternalUnsignedIntArrayMapRootIndex; 2228 return kExternalUnsignedIntArrayMapRootIndex;
2229 case kExternalFloatArray: 2229 case kExternalFloatArray:
2230 return kExternalFloatArrayMapRootIndex; 2230 return kExternalFloatArrayMapRootIndex;
2231 case kExternalPixelArray:
2232 return kExternalPixelArrayMapRootIndex;
2231 default: 2233 default:
2232 UNREACHABLE(); 2234 UNREACHABLE();
2233 return kUndefinedValueRootIndex; 2235 return kUndefinedValueRootIndex;
2234 } 2236 }
2235 } 2237 }
2236 2238
2237 2239
2238 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { 2240 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
2239 // We need to distinguish the minus zero value and this cannot be 2241 // We need to distinguish the minus zero value and this cannot be
2240 // done after conversion to int. Doing this by comparing bit 2242 // done after conversion to int. Doing this by comparing bit
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 filler->set_map(one_pointer_filler_map()); 2657 filler->set_map(one_pointer_filler_map());
2656 } else if (size == 2 * kPointerSize) { 2658 } else if (size == 2 * kPointerSize) {
2657 filler->set_map(two_pointer_filler_map()); 2659 filler->set_map(two_pointer_filler_map());
2658 } else { 2660 } else {
2659 filler->set_map(byte_array_map()); 2661 filler->set_map(byte_array_map());
2660 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size)); 2662 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
2661 } 2663 }
2662 } 2664 }
2663 2665
2664 2666
2665 MaybeObject* Heap::AllocatePixelArray(int length,
2666 uint8_t* external_pointer,
2667 PretenureFlag pretenure) {
2668 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
2669 Object* result;
2670 { MaybeObject* maybe_result =
2671 AllocateRaw(PixelArray::kAlignedSize, space, OLD_DATA_SPACE);
2672 if (!maybe_result->ToObject(&result)) return maybe_result;
2673 }
2674
2675 reinterpret_cast<PixelArray*>(result)->set_map(pixel_array_map());
2676 reinterpret_cast<PixelArray*>(result)->set_length(length);
2677 reinterpret_cast<PixelArray*>(result)->set_external_pointer(external_pointer);
2678
2679 return result;
2680 }
2681
2682
2683 MaybeObject* Heap::AllocateExternalArray(int length, 2667 MaybeObject* Heap::AllocateExternalArray(int length,
2684 ExternalArrayType array_type, 2668 ExternalArrayType array_type,
2685 void* external_pointer, 2669 void* external_pointer,
2686 PretenureFlag pretenure) { 2670 PretenureFlag pretenure) {
2687 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 2671 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
2688 Object* result; 2672 Object* result;
2689 { MaybeObject* maybe_result = AllocateRaw(ExternalArray::kAlignedSize, 2673 { MaybeObject* maybe_result = AllocateRaw(ExternalArray::kAlignedSize,
2690 space, 2674 space,
2691 OLD_DATA_SPACE); 2675 OLD_DATA_SPACE);
2692 if (!maybe_result->ToObject(&result)) return maybe_result; 2676 if (!maybe_result->ToObject(&result)) return maybe_result;
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5575 void ExternalStringTable::TearDown() { 5559 void ExternalStringTable::TearDown() {
5576 new_space_strings_.Free(); 5560 new_space_strings_.Free();
5577 old_space_strings_.Free(); 5561 old_space_strings_.Free();
5578 } 5562 }
5579 5563
5580 5564
5581 List<Object*> ExternalStringTable::new_space_strings_; 5565 List<Object*> ExternalStringTable::new_space_strings_;
5582 List<Object*> ExternalStringTable::old_space_strings_; 5566 List<Object*> ExternalStringTable::old_space_strings_;
5583 5567
5584 } } // namespace v8::internal 5568 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698