| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 20 matching lines...) Expand all Loading... |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "checks.h" | 32 #include "checks.h" |
| 33 #include "hashmap.h" | 33 #include "hashmap.h" |
| 34 #include "globals.h" | 34 #include "globals.h" |
| 35 #include "list.h" | 35 #include "list.h" |
| 36 #include "splay-tree.h" | 36 #include "splay-tree.h" |
| 37 | 37 |
| 38 namespace v8 { | 38 namespace v8 { |
| 39 namespace internal { | 39 namespace internal { |
| 40 | 40 |
| 41 #if defined(__has_feature) |
| 42 #if __has_feature(address_sanitizer) |
| 43 #define V8_USE_ADDRESS_SANITIZER |
| 44 #endif |
| 45 #endif |
| 41 | 46 |
| 42 class Segment; | 47 class Segment; |
| 43 class Isolate; | 48 class Isolate; |
| 44 | 49 |
| 45 // The Zone supports very fast allocation of small chunks of | 50 // The Zone supports very fast allocation of small chunks of |
| 46 // memory. The chunks cannot be deallocated individually, but instead | 51 // memory. The chunks cannot be deallocated individually, but instead |
| 47 // the Zone supports deallocating all chunks in one fast | 52 // the Zone supports deallocating all chunks in one fast |
| 48 // operation. The Zone is used to hold temporary data structures like | 53 // operation. The Zone is used to hold temporary data structures like |
| 49 // the abstract syntax tree, which is deallocated after compilation. | 54 // the abstract syntax tree, which is deallocated after compilation. |
| 50 | 55 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 inline unsigned allocation_size() { return allocation_size_; } | 88 inline unsigned allocation_size() { return allocation_size_; } |
| 84 | 89 |
| 85 inline Isolate* isolate() { return isolate_; } | 90 inline Isolate* isolate() { return isolate_; } |
| 86 | 91 |
| 87 private: | 92 private: |
| 88 friend class Isolate; | 93 friend class Isolate; |
| 89 | 94 |
| 90 // All pointers returned from New() have this alignment. In addition, if the | 95 // All pointers returned from New() have this alignment. In addition, if the |
| 91 // object being allocated has a size that is divisible by 8 then its alignment | 96 // object being allocated has a size that is divisible by 8 then its alignment |
| 92 // will be 8. ASan requires 8-byte alignment. | 97 // will be 8. ASan requires 8-byte alignment. |
| 93 #ifdef ADDRESS_SANITIZER | 98 #ifdef V8_USE_ADDRESS_SANITIZER |
| 94 static const int kAlignment = 8; | 99 static const int kAlignment = 8; |
| 95 STATIC_ASSERT(kPointerSize <= 8); | 100 STATIC_ASSERT(kPointerSize <= 8); |
| 96 #else | 101 #else |
| 97 static const int kAlignment = kPointerSize; | 102 static const int kAlignment = kPointerSize; |
| 98 #endif | 103 #endif |
| 99 | 104 |
| 100 // Never allocate segments smaller than this size in bytes. | 105 // Never allocate segments smaller than this size in bytes. |
| 101 static const int kMinimumSegmentSize = 8 * KB; | 106 static const int kMinimumSegmentSize = 8 * KB; |
| 102 | 107 |
| 103 // Never allocate segments larger than this size in bytes. | 108 // Never allocate segments larger than this size in bytes. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 void operator delete(void* pointer) { UNREACHABLE(); } | 262 void operator delete(void* pointer) { UNREACHABLE(); } |
| 258 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } | 263 void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); } |
| 259 }; | 264 }; |
| 260 | 265 |
| 261 | 266 |
| 262 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; | 267 typedef TemplateHashMapImpl<ZoneAllocationPolicy> ZoneHashMap; |
| 263 | 268 |
| 264 } } // namespace v8::internal | 269 } } // namespace v8::internal |
| 265 | 270 |
| 266 #endif // V8_ZONE_H_ | 271 #endif // V8_ZONE_H_ |
| OLD | NEW |