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

Side by Side Diff: src/spaces.h

Issue 8345040: Don't allow large object space to grow over the max oldspace limit (fixes issue 1717) (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 2 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.cc ('k') | src/spaces.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 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 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 2435
2436 // ----------------------------------------------------------------------------- 2436 // -----------------------------------------------------------------------------
2437 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by 2437 // Large objects ( > Page::kMaxHeapObjectSize ) are allocated and managed by
2438 // the large object space. A large object is allocated from OS heap with 2438 // the large object space. A large object is allocated from OS heap with
2439 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset). 2439 // extra padding bytes (Page::kPageSize + Page::kObjectStartOffset).
2440 // A large object always starts at Page::kObjectStartOffset to a page. 2440 // A large object always starts at Page::kObjectStartOffset to a page.
2441 // Large objects do not move during garbage collections. 2441 // Large objects do not move during garbage collections.
2442 2442
2443 class LargeObjectSpace : public Space { 2443 class LargeObjectSpace : public Space {
2444 public: 2444 public:
2445 LargeObjectSpace(Heap* heap, AllocationSpace id); 2445 LargeObjectSpace(Heap* heap, intptr_t max_capacity, AllocationSpace id);
2446 virtual ~LargeObjectSpace() {} 2446 virtual ~LargeObjectSpace() {}
2447 2447
2448 // Initializes internal data structures. 2448 // Initializes internal data structures.
2449 bool Setup(); 2449 bool Setup();
2450 2450
2451 // Releases internal resources, frees objects in this space. 2451 // Releases internal resources, frees objects in this space.
2452 void TearDown(); 2452 void TearDown();
2453 2453
2454 static intptr_t ObjectSizeFor(intptr_t chunk_size) { 2454 static intptr_t ObjectSizeFor(intptr_t chunk_size) {
2455 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0; 2455 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 virtual void Verify(); 2505 virtual void Verify();
2506 virtual void Print(); 2506 virtual void Print();
2507 void ReportStatistics(); 2507 void ReportStatistics();
2508 void CollectCodeStatistics(); 2508 void CollectCodeStatistics();
2509 #endif 2509 #endif
2510 // Checks whether an address is in the object area in this space. It 2510 // Checks whether an address is in the object area in this space. It
2511 // iterates all objects in the space. May be slow. 2511 // iterates all objects in the space. May be slow.
2512 bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); } 2512 bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); }
2513 2513
2514 private: 2514 private:
2515 intptr_t max_capacity_;
2515 // The head of the linked list of large object chunks. 2516 // The head of the linked list of large object chunks.
2516 LargePage* first_page_; 2517 LargePage* first_page_;
2517 intptr_t size_; // allocated bytes 2518 intptr_t size_; // allocated bytes
2518 int page_count_; // number of chunks 2519 int page_count_; // number of chunks
2519 intptr_t objects_size_; // size of objects 2520 intptr_t objects_size_; // size of objects
2520 2521
2521 friend class LargeObjectIterator; 2522 friend class LargeObjectIterator;
2522 2523
2523 public: 2524 public:
2524 TRACK_MEMORY("LargeObjectSpace") 2525 TRACK_MEMORY("LargeObjectSpace")
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 } 2615 }
2615 // Must be small, since an iteration is used for lookup. 2616 // Must be small, since an iteration is used for lookup.
2616 static const int kMaxComments = 64; 2617 static const int kMaxComments = 64;
2617 }; 2618 };
2618 #endif 2619 #endif
2619 2620
2620 2621
2621 } } // namespace v8::internal 2622 } } // namespace v8::internal
2622 2623
2623 #endif // V8_SPACES_H_ 2624 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698