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

Side by Side Diff: src/heap.cc

Issue 399044: Merge r3285, r3313, and r3318 to branches/1.3. (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.3/
Patch Set: Created 11 years, 1 month 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/global-handles.cc ('k') | src/ia32/codegen-ia32.h » ('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 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 return SmiOrNumberFromDouble(value, 1723 return SmiOrNumberFromDouble(value,
1724 false /* use preallocated NaN, -0.0 */, 1724 false /* use preallocated NaN, -0.0 */,
1725 pretenure); 1725 pretenure);
1726 } 1726 }
1727 1727
1728 1728
1729 Object* Heap::AllocateProxy(Address proxy, PretenureFlag pretenure) { 1729 Object* Heap::AllocateProxy(Address proxy, PretenureFlag pretenure) {
1730 // Statically ensure that it is safe to allocate proxies in paged spaces. 1730 // Statically ensure that it is safe to allocate proxies in paged spaces.
1731 STATIC_ASSERT(Proxy::kSize <= Page::kMaxHeapObjectSize); 1731 STATIC_ASSERT(Proxy::kSize <= Page::kMaxHeapObjectSize);
1732 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 1732 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
1733 if (always_allocate()) space = OLD_DATA_SPACE;
1733 Object* result = Allocate(proxy_map(), space); 1734 Object* result = Allocate(proxy_map(), space);
1734 if (result->IsFailure()) return result; 1735 if (result->IsFailure()) return result;
1735 1736
1736 Proxy::cast(result)->set_proxy(proxy); 1737 Proxy::cast(result)->set_proxy(proxy);
1737 return result; 1738 return result;
1738 } 1739 }
1739 1740
1740 1741
1741 Object* Heap::AllocateSharedFunctionInfo(Object* name) { 1742 Object* Heap::AllocateSharedFunctionInfo(Object* name) {
1742 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); 1743 Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 map = is_ascii ? short_cons_ascii_string_map() 1815 map = is_ascii ? short_cons_ascii_string_map()
1815 : short_cons_string_map(); 1816 : short_cons_string_map();
1816 } else if (length <= String::kMaxMediumSize) { 1817 } else if (length <= String::kMaxMediumSize) {
1817 map = is_ascii ? medium_cons_ascii_string_map() 1818 map = is_ascii ? medium_cons_ascii_string_map()
1818 : medium_cons_string_map(); 1819 : medium_cons_string_map();
1819 } else { 1820 } else {
1820 map = is_ascii ? long_cons_ascii_string_map() 1821 map = is_ascii ? long_cons_ascii_string_map()
1821 : long_cons_string_map(); 1822 : long_cons_string_map();
1822 } 1823 }
1823 1824
1824 Object* result = Allocate(map, NEW_SPACE); 1825 Object* result = Allocate(map,
1826 always_allocate() ? OLD_POINTER_SPACE : NEW_SPACE);
1825 if (result->IsFailure()) return result; 1827 if (result->IsFailure()) return result;
1826 ASSERT(InNewSpace(result));
1827 ConsString* cons_string = ConsString::cast(result); 1828 ConsString* cons_string = ConsString::cast(result);
1828 cons_string->set_first(first, SKIP_WRITE_BARRIER); 1829 WriteBarrierMode mode = cons_string->GetWriteBarrierMode();
1829 cons_string->set_second(second, SKIP_WRITE_BARRIER); 1830 cons_string->set_first(first, mode);
1831 cons_string->set_second(second, mode);
1830 cons_string->set_length(length); 1832 cons_string->set_length(length);
1831 return result; 1833 return result;
1832 } 1834 }
1833 1835
1834 1836
1835 Object* Heap::AllocateSlicedString(String* buffer, 1837 Object* Heap::AllocateSlicedString(String* buffer,
1836 int start, 1838 int start,
1837 int end) { 1839 int end) {
1838 int length = end - start; 1840 int length = end - start;
1839 1841
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 Map* map; 1915 Map* map;
1914 int length = resource->length(); 1916 int length = resource->length();
1915 if (length <= String::kMaxShortSize) { 1917 if (length <= String::kMaxShortSize) {
1916 map = short_external_ascii_string_map(); 1918 map = short_external_ascii_string_map();
1917 } else if (length <= String::kMaxMediumSize) { 1919 } else if (length <= String::kMaxMediumSize) {
1918 map = medium_external_ascii_string_map(); 1920 map = medium_external_ascii_string_map();
1919 } else { 1921 } else {
1920 map = long_external_ascii_string_map(); 1922 map = long_external_ascii_string_map();
1921 } 1923 }
1922 1924
1923 Object* result = Allocate(map, NEW_SPACE); 1925 Object* result = Allocate(map,
1926 always_allocate() ? OLD_DATA_SPACE : NEW_SPACE);
1924 if (result->IsFailure()) return result; 1927 if (result->IsFailure()) return result;
1925 1928
1926 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); 1929 ExternalAsciiString* external_string = ExternalAsciiString::cast(result);
1927 external_string->set_length(length); 1930 external_string->set_length(length);
1928 external_string->set_resource(resource); 1931 external_string->set_resource(resource);
1929 1932
1930 return result; 1933 return result;
1931 } 1934 }
1932 1935
1933 1936
1934 Object* Heap::AllocateExternalStringFromTwoByte( 1937 Object* Heap::AllocateExternalStringFromTwoByte(
1935 ExternalTwoByteString::Resource* resource) { 1938 ExternalTwoByteString::Resource* resource) {
1936 int length = resource->length(); 1939 int length = resource->length();
1937 1940
1938 Map* map = ExternalTwoByteString::StringMap(length); 1941 Map* map = ExternalTwoByteString::StringMap(length);
1939 Object* result = Allocate(map, NEW_SPACE); 1942 Object* result = Allocate(map,
1943 always_allocate() ? OLD_DATA_SPACE : NEW_SPACE);
1940 if (result->IsFailure()) return result; 1944 if (result->IsFailure()) return result;
1941 1945
1942 ExternalTwoByteString* external_string = ExternalTwoByteString::cast(result); 1946 ExternalTwoByteString* external_string = ExternalTwoByteString::cast(result);
1943 external_string->set_length(length); 1947 external_string->set_length(length);
1944 external_string->set_resource(resource); 1948 external_string->set_resource(resource);
1945 1949
1946 return result; 1950 return result;
1947 } 1951 }
1948 1952
1949 1953
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 map->unused_property_fields() - 2318 map->unused_property_fields() -
2315 map->inobject_properties(); 2319 map->inobject_properties();
2316 ASSERT(prop_size >= 0); 2320 ASSERT(prop_size >= 0);
2317 Object* properties = AllocateFixedArray(prop_size, pretenure); 2321 Object* properties = AllocateFixedArray(prop_size, pretenure);
2318 if (properties->IsFailure()) return properties; 2322 if (properties->IsFailure()) return properties;
2319 2323
2320 // Allocate the JSObject. 2324 // Allocate the JSObject.
2321 AllocationSpace space = 2325 AllocationSpace space =
2322 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; 2326 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE;
2323 if (map->instance_size() > MaxObjectSizeInPagedSpace()) space = LO_SPACE; 2327 if (map->instance_size() > MaxObjectSizeInPagedSpace()) space = LO_SPACE;
2328 if (always_allocate()) space = OLD_POINTER_SPACE;
2324 Object* obj = Allocate(map, space); 2329 Object* obj = Allocate(map, space);
2325 if (obj->IsFailure()) return obj; 2330 if (obj->IsFailure()) return obj;
2326 2331
2327 // Initialize the JSObject. 2332 // Initialize the JSObject.
2328 InitializeJSObjectFromMap(JSObject::cast(obj), 2333 InitializeJSObjectFromMap(JSObject::cast(obj),
2329 FixedArray::cast(properties), 2334 FixedArray::cast(properties),
2330 map); 2335 map);
2331 return obj; 2336 return obj;
2332 } 2337 }
2333 2338
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
4030 for (int i = 0; i < kNumberOfCaches; i++) { 4035 for (int i = 0; i < kNumberOfCaches; i++) {
4031 if (caches_[i] != NULL) { 4036 if (caches_[i] != NULL) {
4032 delete caches_[i]; 4037 delete caches_[i];
4033 caches_[i] = NULL; 4038 caches_[i] = NULL;
4034 } 4039 }
4035 } 4040 }
4036 } 4041 }
4037 4042
4038 4043
4039 } } // namespace v8::internal 4044 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698