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

Side by Side Diff: src/spaces.h

Issue 9634005: Implement a hash based look-up to speed up containing address check in large (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 9 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/frames.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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_SPACES_H_ 28 #ifndef V8_SPACES_H_
29 #define V8_SPACES_H_ 29 #define V8_SPACES_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "hashmap.h"
32 #include "list.h" 33 #include "list.h"
33 #include "log.h" 34 #include "log.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 class Isolate; 39 class Isolate;
39 40
40 // ----------------------------------------------------------------------------- 41 // -----------------------------------------------------------------------------
41 // Heap structures: 42 // Heap structures:
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 2493
2493 int PageCount() { 2494 int PageCount() {
2494 return page_count_; 2495 return page_count_;
2495 } 2496 }
2496 2497
2497 // Finds an object for a given address, returns Failure::Exception() 2498 // Finds an object for a given address, returns Failure::Exception()
2498 // if it is not found. The function iterates through all objects in this 2499 // if it is not found. The function iterates through all objects in this
2499 // space, may be slow. 2500 // space, may be slow.
2500 MaybeObject* FindObject(Address a); 2501 MaybeObject* FindObject(Address a);
2501 2502
2502 // Finds a large object page containing the given pc, returns NULL 2503 // Finds a large object page containing the given address, returns NULL
2503 // if such a page doesn't exist. 2504 // if such a page doesn't exist.
2504 LargePage* FindPageContainingPc(Address pc); 2505 LargePage* FindPage(Address a);
2505 2506
2506 // Frees unmarked objects. 2507 // Frees unmarked objects.
2507 void FreeUnmarkedObjects(); 2508 void FreeUnmarkedObjects();
2508 2509
2509 // Checks whether a heap object is in this space; O(1). 2510 // Checks whether a heap object is in this space; O(1).
2510 bool Contains(HeapObject* obj); 2511 bool Contains(HeapObject* obj);
2511 2512
2512 // Checks whether the space is empty. 2513 // Checks whether the space is empty.
2513 bool IsEmpty() { return first_page_ == NULL; } 2514 bool IsEmpty() { return first_page_ == NULL; }
2514 2515
(...skipping 14 matching lines...) Expand all
2529 // iterates all objects in the space. May be slow. 2530 // iterates all objects in the space. May be slow.
2530 bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); } 2531 bool SlowContains(Address addr) { return !FindObject(addr)->IsFailure(); }
2531 2532
2532 private: 2533 private:
2533 intptr_t max_capacity_; 2534 intptr_t max_capacity_;
2534 // The head of the linked list of large object chunks. 2535 // The head of the linked list of large object chunks.
2535 LargePage* first_page_; 2536 LargePage* first_page_;
2536 intptr_t size_; // allocated bytes 2537 intptr_t size_; // allocated bytes
2537 int page_count_; // number of chunks 2538 int page_count_; // number of chunks
2538 intptr_t objects_size_; // size of objects 2539 intptr_t objects_size_; // size of objects
2540 // Map MemoryChunk::kAlignment-aligned chunks to large pages covering them
2541 HashMap chunk_map_;
2539 2542
2540 friend class LargeObjectIterator; 2543 friend class LargeObjectIterator;
2541 2544
2542 public: 2545 public:
2543 TRACK_MEMORY("LargeObjectSpace") 2546 TRACK_MEMORY("LargeObjectSpace")
2544 }; 2547 };
2545 2548
2546 2549
2547 class LargeObjectIterator: public ObjectIterator { 2550 class LargeObjectIterator: public ObjectIterator {
2548 public: 2551 public:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 } 2636 }
2634 // Must be small, since an iteration is used for lookup. 2637 // Must be small, since an iteration is used for lookup.
2635 static const int kMaxComments = 64; 2638 static const int kMaxComments = 64;
2636 }; 2639 };
2637 #endif 2640 #endif
2638 2641
2639 2642
2640 } } // namespace v8::internal 2643 } } // namespace v8::internal
2641 2644
2642 #endif // V8_SPACES_H_ 2645 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698