OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1902 if (Map::kPadStart < Map::kSize) { | 1902 if (Map::kPadStart < Map::kSize) { |
1903 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, | 1903 memset(reinterpret_cast<byte*>(map) + Map::kPadStart - kHeapObjectTag, |
1904 0, | 1904 0, |
1905 Map::kSize - Map::kPadStart); | 1905 Map::kSize - Map::kPadStart); |
1906 } | 1906 } |
1907 return map; | 1907 return map; |
1908 } | 1908 } |
1909 | 1909 |
1910 | 1910 |
1911 MaybeObject* Heap::AllocateCodeCache() { | 1911 MaybeObject* Heap::AllocateCodeCache() { |
1912 Object* result; | 1912 CodeCache* code_cache; |
1913 { MaybeObject* maybe_result = AllocateStruct(CODE_CACHE_TYPE); | 1913 { MaybeObject* maybe_code_cache = AllocateStruct(CODE_CACHE_TYPE); |
1914 if (!maybe_result->ToObject(&result)) return maybe_result; | 1914 if (!maybe_code_cache->To(&code_cache)) return maybe_code_cache; |
1915 } | 1915 } |
1916 CodeCache* code_cache = CodeCache::cast(result); | |
1917 code_cache->set_default_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); | 1916 code_cache->set_default_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
1918 code_cache->set_normal_type_cache(undefined_value(), SKIP_WRITE_BARRIER); | 1917 code_cache->set_normal_type_cache(undefined_value(), SKIP_WRITE_BARRIER); |
1919 return code_cache; | 1918 return code_cache; |
1920 } | 1919 } |
1921 | 1920 |
1922 | 1921 |
1923 MaybeObject* Heap::AllocatePolymorphicCodeCache() { | 1922 MaybeObject* Heap::AllocatePolymorphicCodeCache() { |
1924 return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); | 1923 return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); |
1925 } | 1924 } |
1926 | 1925 |
1927 | 1926 |
1928 MaybeObject* Heap::AllocateAccessorPair() { | 1927 MaybeObject* Heap::AllocateAccessorPair() { |
1929 Object* result; | 1928 AccessorPair* accessors; |
1930 { MaybeObject* maybe_result = AllocateStruct(ACCESSOR_PAIR_TYPE); | 1929 { MaybeObject* maybe_accessors = AllocateStruct(ACCESSOR_PAIR_TYPE); |
1931 if (!maybe_result->ToObject(&result)) return maybe_result; | 1930 if (!maybe_accessors->To(&accessors)) return maybe_accessors; |
1932 } | 1931 } |
1933 AccessorPair* accessors = AccessorPair::cast(result); | 1932 accessors->set_getter(the_hole_value(), SKIP_WRITE_BARRIER); |
1934 // Later we will have to distinguish between undefined and the hole... | 1933 accessors->set_setter(the_hole_value(), SKIP_WRITE_BARRIER); |
Michael Starzinger
2012/03/05 11:48:06
It would be possible to add an AllocateStructWithF
| |
1935 // accessors->set_getter(the_hole_value(), SKIP_WRITE_BARRIER); | |
1936 // accessors->set_setter(the_hole_value(), SKIP_WRITE_BARRIER); | |
1937 return accessors; | 1934 return accessors; |
1938 } | 1935 } |
1939 | 1936 |
1940 | 1937 |
1941 MaybeObject* Heap::AllocateTypeFeedbackInfo() { | 1938 MaybeObject* Heap::AllocateTypeFeedbackInfo() { |
1942 TypeFeedbackInfo* info; | 1939 TypeFeedbackInfo* info; |
1943 { MaybeObject* maybe_result = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); | 1940 { MaybeObject* maybe_info = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); |
1944 if (!maybe_result->To(&info)) return maybe_result; | 1941 if (!maybe_info->To(&info)) return maybe_info; |
1945 } | 1942 } |
1946 info->set_ic_total_count(0); | 1943 info->set_ic_total_count(0); |
1947 info->set_ic_with_typeinfo_count(0); | 1944 info->set_ic_with_typeinfo_count(0); |
1948 info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), | 1945 info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), |
1949 SKIP_WRITE_BARRIER); | 1946 SKIP_WRITE_BARRIER); |
1950 return info; | 1947 return info; |
1951 } | 1948 } |
1952 | 1949 |
1953 | 1950 |
1954 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { | 1951 MaybeObject* Heap::AllocateAliasedArgumentsEntry(int aliased_context_slot) { |
1955 AliasedArgumentsEntry* entry; | 1952 AliasedArgumentsEntry* entry; |
1956 { MaybeObject* maybe_result = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); | 1953 { MaybeObject* maybe_entry = AllocateStruct(ALIASED_ARGUMENTS_ENTRY_TYPE); |
1957 if (!maybe_result->To(&entry)) return maybe_result; | 1954 if (!maybe_entry->To(&entry)) return maybe_entry; |
1958 } | 1955 } |
1959 entry->set_aliased_context_slot(aliased_context_slot); | 1956 entry->set_aliased_context_slot(aliased_context_slot); |
1960 return entry; | 1957 return entry; |
1961 } | 1958 } |
1962 | 1959 |
1963 | 1960 |
1964 const Heap::StringTypeTable Heap::string_type_table[] = { | 1961 const Heap::StringTypeTable Heap::string_type_table[] = { |
1965 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ | 1962 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ |
1966 {type, size, k##camel_name##MapRootIndex}, | 1963 {type, size, k##camel_name##MapRootIndex}, |
1967 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) | 1964 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) |
(...skipping 4972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6940 isolate_->heap()->store_buffer()->Compact(); | 6937 isolate_->heap()->store_buffer()->Compact(); |
6941 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6938 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6942 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6939 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6943 next = chunk->next_chunk(); | 6940 next = chunk->next_chunk(); |
6944 isolate_->memory_allocator()->Free(chunk); | 6941 isolate_->memory_allocator()->Free(chunk); |
6945 } | 6942 } |
6946 chunks_queued_for_free_ = NULL; | 6943 chunks_queued_for_free_ = NULL; |
6947 } | 6944 } |
6948 | 6945 |
6949 } } // namespace v8::internal | 6946 } } // namespace v8::internal |
OLD | NEW |