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

Side by Side Diff: src/heap.cc

Issue 7778013: NewGC: Merge bleeding edge up to 9009. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 3 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.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 oddball_map()->set_prototype(null_value()); 1811 oddball_map()->set_prototype(null_value());
1812 oddball_map()->set_constructor(null_value()); 1812 oddball_map()->set_constructor(null_value());
1813 1813
1814 { MaybeObject* maybe_obj = 1814 { MaybeObject* maybe_obj =
1815 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1815 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1816 if (!maybe_obj->ToObject(&obj)) return false; 1816 if (!maybe_obj->ToObject(&obj)) return false;
1817 } 1817 }
1818 set_fixed_cow_array_map(Map::cast(obj)); 1818 set_fixed_cow_array_map(Map::cast(obj));
1819 ASSERT(fixed_array_map() != fixed_cow_array_map()); 1819 ASSERT(fixed_array_map() != fixed_cow_array_map());
1820 1820
1821 { MaybeObject* maybe_obj =
1822 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1823 if (!maybe_obj->ToObject(&obj)) return false;
1824 }
1825 set_serialized_scope_info_map(Map::cast(obj));
1826
1821 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); 1827 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize);
1822 if (!maybe_obj->ToObject(&obj)) return false; 1828 if (!maybe_obj->ToObject(&obj)) return false;
1823 } 1829 }
1824 set_heap_number_map(Map::cast(obj)); 1830 set_heap_number_map(Map::cast(obj));
1825 1831
1826 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); 1832 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize);
1827 if (!maybe_obj->ToObject(&obj)) return false; 1833 if (!maybe_obj->ToObject(&obj)) return false;
1828 } 1834 }
1829 set_foreign_map(Map::cast(obj)); 1835 set_foreign_map(Map::cast(obj));
1830 1836
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1982 { MaybeObject* maybe_obj = 1988 { MaybeObject* maybe_obj =
1983 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1989 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1984 if (!maybe_obj->ToObject(&obj)) return false; 1990 if (!maybe_obj->ToObject(&obj)) return false;
1985 } 1991 }
1986 set_with_context_map(Map::cast(obj)); 1992 set_with_context_map(Map::cast(obj));
1987 1993
1988 { MaybeObject* maybe_obj = 1994 { MaybeObject* maybe_obj =
1989 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1995 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1990 if (!maybe_obj->ToObject(&obj)) return false; 1996 if (!maybe_obj->ToObject(&obj)) return false;
1991 } 1997 }
1998 set_block_context_map(Map::cast(obj));
1999
2000 { MaybeObject* maybe_obj =
2001 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2002 if (!maybe_obj->ToObject(&obj)) return false;
2003 }
1992 Map* global_context_map = Map::cast(obj); 2004 Map* global_context_map = Map::cast(obj);
1993 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); 2005 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
1994 set_global_context_map(global_context_map); 2006 set_global_context_map(global_context_map);
1995 2007
1996 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, 2008 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
1997 SharedFunctionInfo::kAlignedSize); 2009 SharedFunctionInfo::kAlignedSize);
1998 if (!maybe_obj->ToObject(&obj)) return false; 2010 if (!maybe_obj->ToObject(&obj)) return false;
1999 } 2011 }
2000 set_shared_function_info_map(Map::cast(obj)); 2012 set_shared_function_info_map(Map::cast(obj));
2001 2013
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
4089 Context* context = reinterpret_cast<Context*>(result); 4101 Context* context = reinterpret_cast<Context*>(result);
4090 context->set_map(with_context_map()); 4102 context->set_map(with_context_map());
4091 context->set_closure(function); 4103 context->set_closure(function);
4092 context->set_previous(previous); 4104 context->set_previous(previous);
4093 context->set_extension(extension); 4105 context->set_extension(extension);
4094 context->set_global(previous->global()); 4106 context->set_global(previous->global());
4095 return context; 4107 return context;
4096 } 4108 }
4097 4109
4098 4110
4111 MaybeObject* Heap::AllocateBlockContext(JSFunction* function,
4112 Context* previous,
4113 SerializedScopeInfo* scope_info) {
4114 Object* result;
4115 { MaybeObject* maybe_result =
4116 AllocateFixedArray(scope_info->NumberOfContextSlots());
4117 if (!maybe_result->ToObject(&result)) return maybe_result;
4118 }
4119 // TODO(keuchel): properly initialize context slots.
4120 Context* context = reinterpret_cast<Context*>(result);
4121 context->set_map(block_context_map());
4122 context->set_closure(function);
4123 context->set_previous(previous);
4124 context->set_extension(scope_info);
4125 context->set_global(previous->global());
4126 return context;
4127 }
4128
4129
4130 MaybeObject* Heap::AllocateSerializedScopeInfo(int length) {
4131 Object* result;
4132 { MaybeObject* maybe_result = AllocateFixedArray(length, TENURED);
4133 if (!maybe_result->ToObject(&result)) return maybe_result;
4134 }
4135 SerializedScopeInfo* scope_info =
4136 reinterpret_cast<SerializedScopeInfo*>(result);
4137 scope_info->set_map(serialized_scope_info_map());
4138 return scope_info;
4139 }
4140
4141
4099 MaybeObject* Heap::AllocateStruct(InstanceType type) { 4142 MaybeObject* Heap::AllocateStruct(InstanceType type) {
4100 Map* map; 4143 Map* map;
4101 switch (type) { 4144 switch (type) {
4102 #define MAKE_CASE(NAME, Name, name) \ 4145 #define MAKE_CASE(NAME, Name, name) \
4103 case NAME##_TYPE: map = name##_map(); break; 4146 case NAME##_TYPE: map = name##_map(); break;
4104 STRUCT_LIST(MAKE_CASE) 4147 STRUCT_LIST(MAKE_CASE)
4105 #undef MAKE_CASE 4148 #undef MAKE_CASE
4106 default: 4149 default:
4107 UNREACHABLE(); 4150 UNREACHABLE();
4108 return Failure::InternalError(); 4151 return Failure::InternalError();
(...skipping 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after
6075 } 6118 }
6076 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6119 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6077 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6120 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6078 next = chunk->next_chunk(); 6121 next = chunk->next_chunk();
6079 isolate_->memory_allocator()->Free(chunk); 6122 isolate_->memory_allocator()->Free(chunk);
6080 } 6123 }
6081 chunks_queued_for_free_ = NULL; 6124 chunks_queued_for_free_ = NULL;
6082 } 6125 }
6083 6126
6084 } } // namespace v8::internal 6127 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698