| Index: src/global-handles.cc
|
| diff --git a/src/global-handles.cc b/src/global-handles.cc
|
| index 88ebe31647dc954fa21f0f5deca99dbf2ccc819b..6cf71aed04b0b00aad8039f2e28fbf401f404b90 100644
|
| --- a/src/global-handles.cc
|
| +++ b/src/global-handles.cc
|
| @@ -1018,4 +1018,50 @@ void GlobalHandles::ComputeObjectGroupsAndImplicitReferences() {
|
| }
|
|
|
|
|
| +EternalHandles::EternalHandles()
|
| + : size_(0), blocks_(NULL) {
|
| + for (unsigned i = 0; i < ARRAY_SIZE(indexed_handles_); i++) {
|
| + indexed_handles_[i] = kInvalidIndex;
|
| + }
|
| +}
|
| +
|
| +
|
| +EternalHandles::~EternalHandles() {
|
| + for (BlockStore::iterator it = block_store_.begin();
|
| + it != block_store_.end(); it++) {
|
| + delete[] *it;
|
| + }
|
| +}
|
| +
|
| +
|
| +void EternalHandles::IterateAllRoots(ObjectVisitor* visitor) {
|
| + int limit = size_;
|
| + for (BlockStore::iterator it = block_store_.begin();
|
| + it != block_store_.end(); it++) {
|
| + visitor->VisitPointers(*it, *it + Min(limit, kSize));
|
| + limit -= kSize;
|
| + }
|
| +}
|
| +
|
| +
|
| +int EternalHandles::Create(Isolate* isolate, Object* object) {
|
| + if (object == NULL) return kInvalidIndex;
|
| + int block = size_ >> kShift;
|
| + int offset = size_ & kMask;
|
| + // need to resize
|
| + if (offset == 0) {
|
| + Object** next_block = new Object*[kSize];
|
| + Object* undefined = isolate->heap()->undefined_value();
|
| + for (int i = 0; i < kSize; i++) {
|
| + next_block[i] = undefined;
|
| + }
|
| + block_store_.push_back(next_block);
|
| + blocks_ = &block_store_.front();
|
| + }
|
| + ASSERT_EQ(isolate->heap()->undefined_value(), blocks_[block][offset]);
|
| + blocks_[block][offset] = object;
|
| + return size_++;
|
| +}
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|