| Index: src/global-handles.h
|
| diff --git a/src/global-handles.h b/src/global-handles.h
|
| index cd75133a24367092ec07e87bd9fc451a8a9e9d64..ad785c4eb4f897287620aceec487bd38806d6cf7 100644
|
| --- a/src/global-handles.h
|
| +++ b/src/global-handles.h
|
| @@ -28,6 +28,8 @@
|
| #ifndef V8_GLOBAL_HANDLES_H_
|
| #define V8_GLOBAL_HANDLES_H_
|
|
|
| +#include <vector>
|
| +
|
| #include "../include/v8.h"
|
| #include "../include/v8-profiler.h"
|
|
|
| @@ -331,6 +333,54 @@ class GlobalHandles {
|
| };
|
|
|
|
|
| +class EternalHandles {
|
| + public:
|
| + static const int kInvalidIndex = -1;
|
| + enum IndexedHandle {
|
| + I18N_TEMPLATE_ONE,
|
| + I18N_TEMPLATE_TWO,
|
| +
|
| + LAST_INDEX = I18N_TEMPLATE_TWO
|
| + };
|
| +
|
| + EternalHandles();
|
| + ~EternalHandles();
|
| +
|
| + int NumberOfHandles() { return size_; }
|
| +
|
| + int Create(Isolate* isolate, Object* object);
|
| +
|
| + inline Object** Get(int index) {
|
| + ASSERT(index >= 0 && index < size_);
|
| + return &blocks_[index >> kShift][index & kMask];
|
| + }
|
| +
|
| + inline int GetIndex(IndexedHandle i) {
|
| + return indexed_handles_[i];
|
| + }
|
| +
|
| + int CreateIndexed(Isolate* isolate, Object* object, IndexedHandle i) {
|
| + ASSERT(GetIndex(i) == kInvalidIndex);
|
| + indexed_handles_[i] = Create(isolate, object);
|
| + return indexed_handles_[i];
|
| + }
|
| +
|
| + void IterateAllRoots(ObjectVisitor* visitor);
|
| +
|
| + private:
|
| + static const int kShift = 8;
|
| + static const int kSize = 1 << kShift;
|
| + static const int kMask = 0xff;
|
| + typedef std::vector<Object**> BlockStore;
|
| + int size_;
|
| + Object*** blocks_;
|
| + BlockStore block_store_;
|
| + int indexed_handles_[LAST_INDEX+1];
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(EternalHandles);
|
| +};
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|
| #endif // V8_GLOBAL_HANDLES_H_
|
|
|