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

Side by Side Diff: src/heap.cc

Issue 18509003: Keep two empty lines between declarations for cpp files (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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/handles.cc ('k') | src/heap-profiler.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 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 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 case EXTERNAL_DOUBLE_ELEMENTS: 3494 case EXTERNAL_DOUBLE_ELEMENTS:
3495 return kEmptyExternalDoubleArrayRootIndex; 3495 return kEmptyExternalDoubleArrayRootIndex;
3496 case EXTERNAL_PIXEL_ELEMENTS: 3496 case EXTERNAL_PIXEL_ELEMENTS:
3497 return kEmptyExternalPixelArrayRootIndex; 3497 return kEmptyExternalPixelArrayRootIndex;
3498 default: 3498 default:
3499 UNREACHABLE(); 3499 UNREACHABLE();
3500 return kUndefinedValueRootIndex; 3500 return kUndefinedValueRootIndex;
3501 } 3501 }
3502 } 3502 }
3503 3503
3504
3504 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) { 3505 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) {
3505 return ExternalArray::cast( 3506 return ExternalArray::cast(
3506 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]); 3507 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]);
3507 } 3508 }
3508 3509
3509 3510
3510 3511
3511 3512
3512 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { 3513 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) {
3513 // We need to distinguish the minus zero value and this cannot be 3514 // We need to distinguish the minus zero value and this cannot be
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
5224 ASSERT(stream_length == 0); 5225 ASSERT(stream_length == 0);
5225 ASSERT(len == 0); 5226 ASSERT(len == 0);
5226 } 5227 }
5227 5228
5228 5229
5229 static inline void WriteOneByteData(String* s, uint8_t* chars, int len) { 5230 static inline void WriteOneByteData(String* s, uint8_t* chars, int len) {
5230 ASSERT(s->length() == len); 5231 ASSERT(s->length() == len);
5231 String::WriteToFlat(s, chars, 0, len); 5232 String::WriteToFlat(s, chars, 0, len);
5232 } 5233 }
5233 5234
5235
5234 static inline void WriteTwoByteData(String* s, uint16_t* chars, int len) { 5236 static inline void WriteTwoByteData(String* s, uint16_t* chars, int len) {
5235 ASSERT(s->length() == len); 5237 ASSERT(s->length() == len);
5236 String::WriteToFlat(s, chars, 0, len); 5238 String::WriteToFlat(s, chars, 0, len);
5237 } 5239 }
5238 5240
5239 5241
5240 template<bool is_one_byte, typename T> 5242 template<bool is_one_byte, typename T>
5241 MaybeObject* Heap::AllocateInternalizedStringImpl( 5243 MaybeObject* Heap::AllocateInternalizedStringImpl(
5242 T t, int chars, uint32_t hash_field) { 5244 T t, int chars, uint32_t hash_field) {
5243 ASSERT(chars >= 0); 5245 ASSERT(chars >= 0);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
5408 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE); 5410 AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
5409 if (!maybe_result->ToObject(&result)) return maybe_result; 5411 if (!maybe_result->ToObject(&result)) return maybe_result;
5410 } 5412 }
5411 // Initialize the object. 5413 // Initialize the object.
5412 reinterpret_cast<FixedArray*>(result)->set_map_no_write_barrier( 5414 reinterpret_cast<FixedArray*>(result)->set_map_no_write_barrier(
5413 fixed_array_map()); 5415 fixed_array_map());
5414 reinterpret_cast<FixedArray*>(result)->set_length(0); 5416 reinterpret_cast<FixedArray*>(result)->set_length(0);
5415 return result; 5417 return result;
5416 } 5418 }
5417 5419
5420
5418 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) { 5421 MaybeObject* Heap::AllocateEmptyExternalArray(ExternalArrayType array_type) {
5419 return AllocateExternalArray(0, array_type, NULL, TENURED); 5422 return AllocateExternalArray(0, array_type, NULL, TENURED);
5420 } 5423 }
5421 5424
5422 5425
5423 MaybeObject* Heap::AllocateRawFixedArray(int length) { 5426 MaybeObject* Heap::AllocateRawFixedArray(int length) {
5424 if (length < 0 || length > FixedArray::kMaxLength) { 5427 if (length < 0 || length > FixedArray::kMaxLength) {
5425 return Failure::OutOfMemoryException(0xd); 5428 return Failure::OutOfMemoryException(0xd);
5426 } 5429 }
5427 ASSERT(length > 0); 5430 ASSERT(length > 0);
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
6744 6747
6745 6748
6746 V8_DECLARE_ONCE(initialize_gc_once); 6749 V8_DECLARE_ONCE(initialize_gc_once);
6747 6750
6748 static void InitializeGCOnce() { 6751 static void InitializeGCOnce() {
6749 InitializeScavengingVisitorsTables(); 6752 InitializeScavengingVisitorsTables();
6750 NewSpaceScavenger::Initialize(); 6753 NewSpaceScavenger::Initialize();
6751 MarkCompactCollector::Initialize(); 6754 MarkCompactCollector::Initialize();
6752 } 6755 }
6753 6756
6757
6754 bool Heap::SetUp() { 6758 bool Heap::SetUp() {
6755 #ifdef DEBUG 6759 #ifdef DEBUG
6756 allocation_timeout_ = FLAG_gc_interval; 6760 allocation_timeout_ = FLAG_gc_interval;
6757 #endif 6761 #endif
6758 6762
6759 // Initialize heap spaces and initial maps and objects. Whenever something 6763 // Initialize heap spaces and initial maps and objects. Whenever something
6760 // goes wrong, just return false. The caller should check the results and 6764 // goes wrong, just return false. The caller should check the results and
6761 // call Heap::TearDown() to release allocated memory. 6765 // call Heap::TearDown() to release allocated memory.
6762 // 6766 //
6763 // If the heap is not yet configured (e.g. through the API), configure it. 6767 // If the heap is not yet configured (e.g. through the API), configure it.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
6854 store_buffer()->SetUp(); 6858 store_buffer()->SetUp();
6855 6859
6856 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex(); 6860 if (FLAG_parallel_recompilation) relocation_mutex_ = OS::CreateMutex();
6857 #ifdef DEBUG 6861 #ifdef DEBUG
6858 relocation_mutex_locked_by_optimizer_thread_ = false; 6862 relocation_mutex_locked_by_optimizer_thread_ = false;
6859 #endif // DEBUG 6863 #endif // DEBUG
6860 6864
6861 return true; 6865 return true;
6862 } 6866 }
6863 6867
6868
6864 bool Heap::CreateHeapObjects() { 6869 bool Heap::CreateHeapObjects() {
6865 // Create initial maps. 6870 // Create initial maps.
6866 if (!CreateInitialMaps()) return false; 6871 if (!CreateInitialMaps()) return false;
6867 if (!CreateApiObjects()) return false; 6872 if (!CreateApiObjects()) return false;
6868 6873
6869 // Create initial objects 6874 // Create initial objects
6870 if (!CreateInitialObjects()) return false; 6875 if (!CreateInitialObjects()) return false;
6871 6876
6872 native_contexts_list_ = undefined_value(); 6877 native_contexts_list_ = undefined_value();
6873 array_buffers_list_ = undefined_value(); 6878 array_buffers_list_ = undefined_value();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
7019 class PrintHandleVisitor: public ObjectVisitor { 7024 class PrintHandleVisitor: public ObjectVisitor {
7020 public: 7025 public:
7021 void VisitPointers(Object** start, Object** end) { 7026 void VisitPointers(Object** start, Object** end) {
7022 for (Object** p = start; p < end; p++) 7027 for (Object** p = start; p < end; p++)
7023 PrintF(" handle %p to %p\n", 7028 PrintF(" handle %p to %p\n",
7024 reinterpret_cast<void*>(p), 7029 reinterpret_cast<void*>(p),
7025 reinterpret_cast<void*>(*p)); 7030 reinterpret_cast<void*>(*p));
7026 } 7031 }
7027 }; 7032 };
7028 7033
7034
7029 void Heap::PrintHandles() { 7035 void Heap::PrintHandles() {
7030 PrintF("Handles:\n"); 7036 PrintF("Handles:\n");
7031 PrintHandleVisitor v; 7037 PrintHandleVisitor v;
7032 isolate_->handle_scope_implementer()->Iterate(&v); 7038 isolate_->handle_scope_implementer()->Iterate(&v);
7033 } 7039 }
7034 7040
7035 #endif 7041 #endif
7036 7042
7037 7043
7038 Space* AllSpaces::next() { 7044 Space* AllSpaces::next() {
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
8116 if (FLAG_parallel_recompilation) { 8122 if (FLAG_parallel_recompilation) {
8117 heap_->relocation_mutex_->Lock(); 8123 heap_->relocation_mutex_->Lock();
8118 #ifdef DEBUG 8124 #ifdef DEBUG
8119 heap_->relocation_mutex_locked_by_optimizer_thread_ = 8125 heap_->relocation_mutex_locked_by_optimizer_thread_ =
8120 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); 8126 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread();
8121 #endif // DEBUG 8127 #endif // DEBUG
8122 } 8128 }
8123 } 8129 }
8124 8130
8125 } } // namespace v8::internal 8131 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698