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

Side by Side Diff: src/heap.cc

Issue 159498: Merge r2549 to branches/1.2. (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.2/
Patch Set: '' Created 11 years, 4 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/ia32/codegen-ia32.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 obj = AllocateMap(LONG_ASCII_STRING_TYPE, SeqAsciiString::kAlignedSize); 1164 obj = AllocateMap(LONG_ASCII_STRING_TYPE, SeqAsciiString::kAlignedSize);
1165 if (obj->IsFailure()) return false; 1165 if (obj->IsFailure()) return false;
1166 set_undetectable_long_ascii_string_map(Map::cast(obj)); 1166 set_undetectable_long_ascii_string_map(Map::cast(obj));
1167 Map::cast(obj)->set_is_undetectable(); 1167 Map::cast(obj)->set_is_undetectable();
1168 1168
1169 obj = AllocateMap(BYTE_ARRAY_TYPE, Array::kAlignedSize); 1169 obj = AllocateMap(BYTE_ARRAY_TYPE, Array::kAlignedSize);
1170 if (obj->IsFailure()) return false; 1170 if (obj->IsFailure()) return false;
1171 set_byte_array_map(Map::cast(obj)); 1171 set_byte_array_map(Map::cast(obj));
1172 1172
1173 obj = AllocateMap(PIXEL_ARRAY_TYPE, PixelArray::kAlignedSize);
1174 if (obj->IsFailure()) return false;
1175 set_pixel_array_map(Map::cast(obj));
1176
1173 obj = AllocateMap(CODE_TYPE, Code::kHeaderSize); 1177 obj = AllocateMap(CODE_TYPE, Code::kHeaderSize);
1174 if (obj->IsFailure()) return false; 1178 if (obj->IsFailure()) return false;
1175 set_code_map(Map::cast(obj)); 1179 set_code_map(Map::cast(obj));
1176 1180
1177 obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE, 1181 obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE,
1178 JSGlobalPropertyCell::kSize); 1182 JSGlobalPropertyCell::kSize);
1179 if (obj->IsFailure()) return false; 1183 if (obj->IsFailure()) return false;
1180 set_global_property_cell_map(Map::cast(obj)); 1184 set_global_property_cell_map(Map::cast(obj));
1181 1185
1182 obj = AllocateMap(FILLER_TYPE, kPointerSize); 1186 obj = AllocateMap(FILLER_TYPE, kPointerSize);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 Object* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { 1552 Object* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
1549 return SmiOrNumberFromDouble(value, 1553 return SmiOrNumberFromDouble(value,
1550 false /* use preallocated NaN, -0.0 */, 1554 false /* use preallocated NaN, -0.0 */,
1551 pretenure); 1555 pretenure);
1552 } 1556 }
1553 1557
1554 1558
1555 Object* Heap::AllocateProxy(Address proxy, PretenureFlag pretenure) { 1559 Object* Heap::AllocateProxy(Address proxy, PretenureFlag pretenure) {
1556 // Statically ensure that it is safe to allocate proxies in paged spaces. 1560 // Statically ensure that it is safe to allocate proxies in paged spaces.
1557 STATIC_ASSERT(Proxy::kSize <= Page::kMaxHeapObjectSize); 1561 STATIC_ASSERT(Proxy::kSize <= Page::kMaxHeapObjectSize);
1558 AllocationSpace space = 1562 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
1559 (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
1560 Object* result = Allocate(proxy_map(), space); 1563 Object* result = Allocate(proxy_map(), space);
1561 if (result->IsFailure()) return result; 1564 if (result->IsFailure()) return result;
1562 1565
1563 Proxy::cast(result)->set_proxy(proxy); 1566 Proxy::cast(result)->set_proxy(proxy);
1564 return result; 1567 return result;
1565 } 1568 }
1566 1569
1567 1570
1568 Object* Heap::AllocateSharedFunctionInfo(Object* name) { 1571 Object* Heap::AllocateSharedFunctionInfo(Object* name) {
1569 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); 1572 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 HeapObject* filler = HeapObject::FromAddress(addr); 1834 HeapObject* filler = HeapObject::FromAddress(addr);
1832 if (size == kPointerSize) { 1835 if (size == kPointerSize) {
1833 filler->set_map(Heap::one_pointer_filler_map()); 1836 filler->set_map(Heap::one_pointer_filler_map());
1834 } else { 1837 } else {
1835 filler->set_map(Heap::byte_array_map()); 1838 filler->set_map(Heap::byte_array_map());
1836 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size)); 1839 ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
1837 } 1840 }
1838 } 1841 }
1839 1842
1840 1843
1844 Object* Heap::AllocatePixelArray(int length,
1845 uint8_t* external_pointer,
1846 PretenureFlag pretenure) {
1847 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
1848
1849 Object* result = AllocateRaw(PixelArray::kAlignedSize, space, OLD_DATA_SPACE);
1850
1851 if (result->IsFailure()) return result;
1852
1853 reinterpret_cast<PixelArray*>(result)->set_map(pixel_array_map());
1854 reinterpret_cast<PixelArray*>(result)->set_length(length);
1855 reinterpret_cast<PixelArray*>(result)->set_external_pointer(external_pointer);
1856
1857 return result;
1858 }
1859
1860
1841 Object* Heap::CreateCode(const CodeDesc& desc, 1861 Object* Heap::CreateCode(const CodeDesc& desc,
1842 ZoneScopeInfo* sinfo, 1862 ZoneScopeInfo* sinfo,
1843 Code::Flags flags, 1863 Code::Flags flags,
1844 Handle<Object> self_reference) { 1864 Handle<Object> self_reference) {
1845 // Compute size 1865 // Compute size
1846 int body_size = RoundUp(desc.instr_size + desc.reloc_size, kObjectAlignment); 1866 int body_size = RoundUp(desc.instr_size + desc.reloc_size, kObjectAlignment);
1847 int sinfo_size = 0; 1867 int sinfo_size = 0;
1848 if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL); 1868 if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL);
1849 int obj_size = Code::SizeFor(body_size, sinfo_size); 1869 int obj_size = Code::SizeFor(body_size, sinfo_size);
1850 ASSERT(IsAligned(obj_size, Code::kCodeAlignment)); 1870 ASSERT(IsAligned(obj_size, Code::kCodeAlignment));
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 #ifdef DEBUG 3710 #ifdef DEBUG
3691 bool Heap::GarbageCollectionGreedyCheck() { 3711 bool Heap::GarbageCollectionGreedyCheck() {
3692 ASSERT(FLAG_gc_greedy); 3712 ASSERT(FLAG_gc_greedy);
3693 if (Bootstrapper::IsActive()) return true; 3713 if (Bootstrapper::IsActive()) return true;
3694 if (disallow_allocation_failure()) return true; 3714 if (disallow_allocation_failure()) return true;
3695 return CollectGarbage(0, NEW_SPACE); 3715 return CollectGarbage(0, NEW_SPACE);
3696 } 3716 }
3697 #endif 3717 #endif
3698 3718
3699 } } // namespace v8::internal 3719 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698