| Index: src/zone.h
|
| diff --git a/src/zone.h b/src/zone.h
|
| index a689f1218f0d4e5d085e18a9287e482dace6699d..a690b8d8caf1bb6ec3144908f37b4e8736c982d8 100644
|
| --- a/src/zone.h
|
| +++ b/src/zone.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef V8_ZONE_H_
|
| #define V8_ZONE_H_
|
|
|
| +#include <limits>
|
| +
|
| #include "src/allocation.h"
|
| #include "src/base/logging.h"
|
| #include "src/globals.h"
|
| @@ -38,10 +40,14 @@ class Zone {
|
| ~Zone();
|
| // Allocate 'size' bytes of memory in the Zone; expands the Zone by
|
| // allocating new segments of memory on demand using malloc().
|
| - inline void* New(int size);
|
| + void* New(int size);
|
|
|
| template <typename T>
|
| - inline T* NewArray(int length);
|
| + T* NewArray(int length) {
|
| + CHECK(std::numeric_limits<int>::max() / static_cast<int>(sizeof(T)) >
|
| + length);
|
| + return static_cast<T*>(New(length * sizeof(T)));
|
| + }
|
|
|
| // Deletes all objects and free all memory allocated in the Zone. Keeps one
|
| // small (size <= kMaximumKeptSegmentSize) segment around if it finds one.
|
|
|