for (int i = blocks()->length() - 2; i >= 0; --i) {
Object** block = blocks()->at(i);
if (last_handle_before_deferred_block_ != NULL &&
- (last_handle_before_deferred_block_ < &block[kHandleBlockSize]) &&
+ (last_handle_before_deferred_block_ <= &block[kHandleBlockSize]) &&
(last_handle_before_deferred_block_ >= block)) {
v->VisitPointers(block, last_handle_before_deferred_block_);
ASSERT(!found_block_before_deferred);
new(info->zone()) OptimizingCompiler(*info);
OptimizingCompiler::Status status = compiler->CreateGraph();
if (status == OptimizingCompiler::SUCCEEDED) {
+ info.Detach();
+ shared->code()->set_profiler_ticks(0);
// Do a scavenge to put off the next scavenge as far as possible.
// This may ease the issue that GVN blocks the next scavenge.
isolate->heap()->CollectGarbage(NEW_SPACE, "parallel recompile");
- shared->code()->set_profiler_ticks(0);
- info.Detach();
isolate->optimizing_compiler_thread()->QueueForOptimization(compiler);
} else if (status == OptimizingCompiler::BAILED_OUT) {
isolate->clear_pending_exception();
heap->CollectAllGarbage(Heap::kNoGCFlags);
heap->CollectAllGarbage(Heap::kNoGCFlags);
}
+
+
+class DummyVisitor : public ObjectVisitor {
+ public:
+ void VisitPointers(Object** start, Object** end) { }
+};
+
+
+TEST(DeferredHandles) {
+ InitializeVM();
+ Isolate* isolate = Isolate::Current();
+ Heap* heap = isolate->heap();
+ v8::HandleScope scope;
+ v8::ImplementationUtilities::HandleScopeData* data =
+ isolate->handle_scope_data();
+ Handle<Object> init(heap->empty_string(), isolate);
+ while (data->next < data->limit) {
+ Handle<Object> obj(heap->empty_string(), isolate);
+ }
+ // An entire block of handles has been filled.
+ // Next handle would require a new block.
+ ASSERT(data->next == data->limit);
+
+ DeferredHandleScope deferred(isolate);
+ DummyVisitor visitor;
+ isolate->handle_scope_implementer()->Iterate(&visitor);
+ deferred.Detach();
+}