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

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 | « no previous file | src/spaces.cc » ('j') | src/spaces.cc » ('J')
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 13 matching lines...) Expand all
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 "list.h" 32 #include "list.h"
33 #include "log.h" 33 #include "log.h"
34 #include "hashmap.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:
42 // 43 //
43 // A JS heap consists of a young generation, an old generation, and a large 44 // A JS heap consists of a young generation, an old generation, and a large
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 HashMap map_; // speed up containing pointer check
Vyacheslav Egorov (Chromium) 2012/03/08 11:41:23 Consider more meaningful name and comment. For exa
2539 2541
2540 friend class LargeObjectIterator; 2542 friend class LargeObjectIterator;
2541 2543
2542 public: 2544 public:
2543 TRACK_MEMORY("LargeObjectSpace") 2545 TRACK_MEMORY("LargeObjectSpace")
2544 }; 2546 };
2545 2547
2546 2548
2547 class LargeObjectIterator: public ObjectIterator { 2549 class LargeObjectIterator: public ObjectIterator {
2548 public: 2550 public:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 } 2635 }
2634 // Must be small, since an iteration is used for lookup. 2636 // Must be small, since an iteration is used for lookup.
2635 static const int kMaxComments = 64; 2637 static const int kMaxComments = 64;
2636 }; 2638 };
2637 #endif 2639 #endif
2638 2640
2639 2641
2640 } } // namespace v8::internal 2642 } } // namespace v8::internal
2641 2643
2642 #endif // V8_SPACES_H_ 2644 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « no previous file | src/spaces.cc » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698