OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SPACES_H_ | 5 #ifndef V8_SPACES_H_ |
6 #define V8_SPACES_H_ | 6 #define V8_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 922 |
923 // Reserves a range of virtual memory, but does not commit any of it. | 923 // Reserves a range of virtual memory, but does not commit any of it. |
924 // Can only be called once, at heap initialization time. | 924 // Can only be called once, at heap initialization time. |
925 // Returns false on failure. | 925 // Returns false on failure. |
926 bool SetUp(size_t requested_size); | 926 bool SetUp(size_t requested_size); |
927 | 927 |
928 // Frees the range of virtual memory, and frees the data structures used to | 928 // Frees the range of virtual memory, and frees the data structures used to |
929 // manage it. | 929 // manage it. |
930 void TearDown(); | 930 void TearDown(); |
931 | 931 |
932 bool exists() { return this != NULL && code_range_ != NULL; } | 932 bool valid() { return code_range_ != NULL; } |
933 Address start() { | 933 Address start() { |
934 if (this == NULL || code_range_ == NULL) return NULL; | 934 ASSERT(valid()); |
935 return static_cast<Address>(code_range_->address()); | 935 return static_cast<Address>(code_range_->address()); |
936 } | 936 } |
937 bool contains(Address address) { | 937 bool contains(Address address) { |
938 if (this == NULL || code_range_ == NULL) return false; | 938 if (!valid()) return false; |
939 Address start = static_cast<Address>(code_range_->address()); | 939 Address start = static_cast<Address>(code_range_->address()); |
940 return start <= address && address < start + code_range_->size(); | 940 return start <= address && address < start + code_range_->size(); |
941 } | 941 } |
942 | 942 |
943 // Allocates a chunk of memory from the large-object portion of | 943 // Allocates a chunk of memory from the large-object portion of |
944 // the code range. On platforms with no separate code range, should | 944 // the code range. On platforms with no separate code range, should |
945 // not be called. | 945 // not be called. |
946 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested_size, | 946 MUST_USE_RESULT Address AllocateRawMemory(const size_t requested_size, |
947 const size_t commit_size, | 947 const size_t commit_size, |
948 size_t* allocated); | 948 size_t* allocated); |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 } | 3000 } |
3001 // Must be small, since an iteration is used for lookup. | 3001 // Must be small, since an iteration is used for lookup. |
3002 static const int kMaxComments = 64; | 3002 static const int kMaxComments = 64; |
3003 }; | 3003 }; |
3004 #endif | 3004 #endif |
3005 | 3005 |
3006 | 3006 |
3007 } } // namespace v8::internal | 3007 } } // namespace v8::internal |
3008 | 3008 |
3009 #endif // V8_SPACES_H_ | 3009 #endif // V8_SPACES_H_ |
OLD | NEW |