OLD | NEW |
---|---|
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 Loading... | |
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2250 case kExternalShortArray: | 2250 case kExternalShortArray: |
2251 return kExternalShortArrayMapRootIndex; | 2251 return kExternalShortArrayMapRootIndex; |
2252 case kExternalUnsignedShortArray: | 2252 case kExternalUnsignedShortArray: |
2253 return kExternalUnsignedShortArrayMapRootIndex; | 2253 return kExternalUnsignedShortArrayMapRootIndex; |
2254 case kExternalIntArray: | 2254 case kExternalIntArray: |
2255 return kExternalIntArrayMapRootIndex; | 2255 return kExternalIntArrayMapRootIndex; |
2256 case kExternalUnsignedIntArray: | 2256 case kExternalUnsignedIntArray: |
2257 return kExternalUnsignedIntArrayMapRootIndex; | 2257 return kExternalUnsignedIntArrayMapRootIndex; |
2258 case kExternalFloatArray: | 2258 case kExternalFloatArray: |
2259 return kExternalFloatArrayMapRootIndex; | 2259 return kExternalFloatArrayMapRootIndex; |
2260 case kExternalPixelArray: | |
2261 return kExternalPixelArrayMapRootIndex; | |
2260 default: | 2262 default: |
2261 UNREACHABLE(); | 2263 UNREACHABLE(); |
2262 return kUndefinedValueRootIndex; | 2264 return kUndefinedValueRootIndex; |
2263 } | 2265 } |
2264 } | 2266 } |
2265 | 2267 |
2266 | 2268 |
2267 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { | 2269 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { |
2268 // We need to distinguish the minus zero value and this cannot be | 2270 // We need to distinguish the minus zero value and this cannot be |
2269 // done after conversion to int. Doing this by comparing bit | 2271 // done after conversion to int. Doing this by comparing bit |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2684 filler->set_map(one_pointer_filler_map()); | 2686 filler->set_map(one_pointer_filler_map()); |
2685 } else if (size == 2 * kPointerSize) { | 2687 } else if (size == 2 * kPointerSize) { |
2686 filler->set_map(two_pointer_filler_map()); | 2688 filler->set_map(two_pointer_filler_map()); |
2687 } else { | 2689 } else { |
2688 filler->set_map(byte_array_map()); | 2690 filler->set_map(byte_array_map()); |
2689 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size)); | 2691 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size)); |
2690 } | 2692 } |
2691 } | 2693 } |
2692 | 2694 |
2693 | 2695 |
2694 MaybeObject* Heap::AllocatePixelArray(int length, | 2696 MaybeObject* Heap::AllocateExternalPixelArray(int length, |
Kevin Millikin (Chromium)
2011/03/07 15:41:45
Likewise, can you remove this function and use Hea
danno
2011/03/08 10:01:56
Done.
| |
2695 uint8_t* external_pointer, | 2697 uint8_t* external_pointer, |
2696 PretenureFlag pretenure) { | 2698 PretenureFlag pretenure) { |
2697 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 2699 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
2698 Object* result; | 2700 Object* result; |
2699 { MaybeObject* maybe_result = | 2701 { MaybeObject* maybe_result = |
2700 AllocateRaw(PixelArray::kAlignedSize, space, OLD_DATA_SPACE); | 2702 AllocateRaw(ExternalPixelArray::kAlignedSize, space, OLD_DATA_SPACE); |
2701 if (!maybe_result->ToObject(&result)) return maybe_result; | 2703 if (!maybe_result->ToObject(&result)) return maybe_result; |
2702 } | 2704 } |
2703 | 2705 |
2704 reinterpret_cast<PixelArray*>(result)->set_map(pixel_array_map()); | 2706 reinterpret_cast<ExternalPixelArray*>(result)->set_map( |
2705 reinterpret_cast<PixelArray*>(result)->set_length(length); | 2707 external_pixel_array_map()); |
2706 reinterpret_cast<PixelArray*>(result)->set_external_pointer(external_pointer); | 2708 reinterpret_cast<ExternalPixelArray*>(result)->set_length(length); |
2709 reinterpret_cast<ExternalPixelArray*>(result)->set_external_pointer( | |
2710 external_pointer); | |
2707 | 2711 |
2708 return result; | 2712 return result; |
2709 } | 2713 } |
2710 | 2714 |
2711 | 2715 |
2712 MaybeObject* Heap::AllocateExternalArray(int length, | 2716 MaybeObject* Heap::AllocateExternalArray(int length, |
2713 ExternalArrayType array_type, | 2717 ExternalArrayType array_type, |
2714 void* external_pointer, | 2718 void* external_pointer, |
2715 PretenureFlag pretenure) { | 2719 PretenureFlag pretenure) { |
2716 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 2720 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5601 void ExternalStringTable::TearDown() { | 5605 void ExternalStringTable::TearDown() { |
5602 new_space_strings_.Free(); | 5606 new_space_strings_.Free(); |
5603 old_space_strings_.Free(); | 5607 old_space_strings_.Free(); |
5604 } | 5608 } |
5605 | 5609 |
5606 | 5610 |
5607 List<Object*> ExternalStringTable::new_space_strings_; | 5611 List<Object*> ExternalStringTable::new_space_strings_; |
5608 List<Object*> ExternalStringTable::old_space_strings_; | 5612 List<Object*> ExternalStringTable::old_space_strings_; |
5609 | 5613 |
5610 } } // namespace v8::internal | 5614 } } // namespace v8::internal |
OLD | NEW |