Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 2170743003: [api] Introduce fast instantiations cache (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing uint issue under windows Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4257 Handle<JSFunction> g = Handle<JSFunction>::cast( 4257 Handle<JSFunction> g = Handle<JSFunction>::cast(
4258 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( 4258 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
4259 CcTest::global()->Get(env.local(), v8_str("g")).ToLocalChecked()))); 4259 CcTest::global()->Get(env.local(), v8_str("g")).ToLocalChecked())));
4260 code = inner_scope.CloseAndEscape(handle(g->code(), isolate)); 4260 code = inner_scope.CloseAndEscape(handle(g->code(), isolate));
4261 if (!code->is_optimized_code()) return; 4261 if (!code->is_optimized_code()) return;
4262 } 4262 }
4263 4263
4264 Handle<TypeFeedbackVector> vector = 4264 Handle<TypeFeedbackVector> vector =
4265 TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata())); 4265 TypeFeedbackVector::New(isolate, handle(shared->feedback_metadata()));
4266 Handle<LiteralsArray> lit = 4266 Handle<LiteralsArray> lit =
4267 LiteralsArray::New(isolate, vector, shared->num_literals(), TENURED); 4267 LiteralsArray::New(isolate, vector, shared->num_literals());
4268 Handle<Context> context(isolate->context()); 4268 Handle<Context> context(isolate->context());
4269 4269
4270 // Add the new code several times to the optimized code map and also set an 4270 // Add the new code several times to the optimized code map and also set an
4271 // allocation timeout so that expanding the code map will trigger a GC. 4271 // allocation timeout so that expanding the code map will trigger a GC.
4272 heap->set_allocation_timeout(5); 4272 heap->set_allocation_timeout(5);
4273 FLAG_gc_interval = 1000; 4273 FLAG_gc_interval = 1000;
4274 for (int i = 0; i < 10; ++i) { 4274 for (int i = 0; i < 10; ++i) {
4275 BailoutId id = BailoutId(i); 4275 BailoutId id = BailoutId(i);
4276 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4276 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4277 } 4277 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 4335
4336 // Add the code with a literals array to be evacuated. 4336 // Add the code with a literals array to be evacuated.
4337 Page* evac_page; 4337 Page* evac_page;
4338 { 4338 {
4339 HandleScope inner_scope(isolate); 4339 HandleScope inner_scope(isolate);
4340 AlwaysAllocateScope always_allocate(isolate); 4340 AlwaysAllocateScope always_allocate(isolate);
4341 // Make sure literal is placed on an old-space evacuation candidate. 4341 // Make sure literal is placed on an old-space evacuation candidate.
4342 heap::SimulateFullSpace(heap->old_space()); 4342 heap::SimulateFullSpace(heap->old_space());
4343 4343
4344 // Make sure there the number of literals is > 0. 4344 // Make sure there the number of literals is > 0.
4345 Handle<LiteralsArray> lit = 4345 Handle<LiteralsArray> lit = LiteralsArray::New(isolate, vector, 23);
4346 LiteralsArray::New(isolate, vector, 23, TENURED);
4347 4346
4348 evac_page = Page::FromAddress(lit->address()); 4347 evac_page = Page::FromAddress(lit->address());
4349 BailoutId id = BailoutId(100); 4348 BailoutId id = BailoutId(100);
4350 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4349 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4351 } 4350 }
4352 4351
4353 // Heap is ready, force {lit_page} to become an evacuation candidate and 4352 // Heap is ready, force {lit_page} to become an evacuation candidate and
4354 // simulate incremental marking to enqueue optimized code map. 4353 // simulate incremental marking to enqueue optimized code map.
4355 FLAG_manual_evacuation_candidates_selection = true; 4354 FLAG_manual_evacuation_candidates_selection = true;
4356 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); 4355 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
6923 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); 6922 chunk, chunk->area_end() - kPointerSize, chunk->area_end());
6924 slots[chunk->area_end() - kPointerSize] = false; 6923 slots[chunk->area_end() - kPointerSize] = false;
6925 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { 6924 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) {
6926 CHECK(slots[addr]); 6925 CHECK(slots[addr]);
6927 return KEEP_SLOT; 6926 return KEEP_SLOT;
6928 }); 6927 });
6929 } 6928 }
6930 6929
6931 } // namespace internal 6930 } // namespace internal
6932 } // namespace v8 6931 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698