OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 18 matching lines...) Expand all Loading... |
29 #define V8_SPACES_INL_H_ | 29 #define V8_SPACES_INL_H_ |
30 | 30 |
31 #include "memory.h" | 31 #include "memory.h" |
32 #include "spaces.h" | 32 #include "spaces.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 | 37 |
38 // ----------------------------------------------------------------------------- | 38 // ----------------------------------------------------------------------------- |
39 // HeapObjectIterator | |
40 | |
41 bool HeapObjectIterator::has_next() { | |
42 if (cur_addr_ < cur_limit_) { | |
43 return true; // common case | |
44 } | |
45 ASSERT(cur_addr_ == cur_limit_); | |
46 return HasNextInNextPage(); // slow path | |
47 } | |
48 | |
49 | |
50 HeapObject* HeapObjectIterator::next() { | |
51 ASSERT(has_next()); | |
52 | |
53 HeapObject* obj = HeapObject::FromAddress(cur_addr_); | |
54 int obj_size = (size_func_ == NULL) ? obj->Size() : size_func_(obj); | |
55 ASSERT_OBJECT_SIZE(obj_size); | |
56 | |
57 cur_addr_ += obj_size; | |
58 ASSERT(cur_addr_ <= cur_limit_); | |
59 | |
60 return obj; | |
61 } | |
62 | |
63 | |
64 // ----------------------------------------------------------------------------- | |
65 // PageIterator | 39 // PageIterator |
66 | 40 |
67 bool PageIterator::has_next() { | 41 bool PageIterator::has_next() { |
68 return prev_page_ != stop_page_; | 42 return prev_page_ != stop_page_; |
69 } | 43 } |
70 | 44 |
71 | 45 |
72 Page* PageIterator::next() { | 46 Page* PageIterator::next() { |
73 ASSERT(has_next()); | 47 ASSERT(has_next()); |
74 prev_page_ = (prev_page_ == NULL) | 48 prev_page_ = (prev_page_ == NULL) |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 337 |
364 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 338 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
365 return object->map() == Heap::raw_unchecked_byte_array_map() | 339 return object->map() == Heap::raw_unchecked_byte_array_map() |
366 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() | 340 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() |
367 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); | 341 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); |
368 } | 342 } |
369 | 343 |
370 } } // namespace v8::internal | 344 } } // namespace v8::internal |
371 | 345 |
372 #endif // V8_SPACES_INL_H_ | 346 #endif // V8_SPACES_INL_H_ |
OLD | NEW |