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

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

Issue 1374723002: Introduce LiteralsArray to hide it's implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More comments. Created 5 years, 2 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
« src/objects-inl.h ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 "g(); %OptimizeFunctionOnNextCall(g); g();"); 4568 "g(); %OptimizeFunctionOnNextCall(g); g();");
4569 4569
4570 Handle<JSFunction> g = 4570 Handle<JSFunction> g =
4571 v8::Utils::OpenHandle( 4571 v8::Utils::OpenHandle(
4572 *v8::Handle<v8::Function>::Cast( 4572 *v8::Handle<v8::Function>::Cast(
4573 CcTest::global()->Get(v8_str("g")))); 4573 CcTest::global()->Get(v8_str("g"))));
4574 code = inner_scope.CloseAndEscape(handle(g->code(), isolate)); 4574 code = inner_scope.CloseAndEscape(handle(g->code(), isolate));
4575 if (!code->is_optimized_code()) return; 4575 if (!code->is_optimized_code()) return;
4576 } 4576 }
4577 4577
4578 Handle<FixedArray> lit = isolate->factory()->empty_fixed_array(); 4578 Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
4579 Handle<LiteralsArray> lit = isolate->factory()->NewLiteralsArray(
4580 vector, shared->num_literals(), TENURED);
4579 Handle<Context> context(isolate->context()); 4581 Handle<Context> context(isolate->context());
4580 4582
4581 // Add the new code several times to the optimized code map and also set an 4583 // Add the new code several times to the optimized code map and also set an
4582 // allocation timeout so that expanding the code map will trigger a GC. 4584 // allocation timeout so that expanding the code map will trigger a GC.
4583 heap->set_allocation_timeout(5); 4585 heap->set_allocation_timeout(5);
4584 FLAG_gc_interval = 1000; 4586 FLAG_gc_interval = 1000;
4585 for (int i = 0; i < 10; ++i) { 4587 for (int i = 0; i < 10; ++i) {
4586 BailoutId id = BailoutId(i); 4588 BailoutId id = BailoutId(i);
4587 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4589 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4588 } 4590 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4624 "g(); %OptimizeFunctionOnNextCall(g); g();"); 4626 "g(); %OptimizeFunctionOnNextCall(g); g();");
4625 4627
4626 Handle<JSFunction> g = 4628 Handle<JSFunction> g =
4627 v8::Utils::OpenHandle( 4629 v8::Utils::OpenHandle(
4628 *v8::Handle<v8::Function>::Cast( 4630 *v8::Handle<v8::Function>::Cast(
4629 CcTest::global()->Get(v8_str("g")))); 4631 CcTest::global()->Get(v8_str("g"))));
4630 code = inner_scope.CloseAndEscape(handle(g->code(), isolate)); 4632 code = inner_scope.CloseAndEscape(handle(g->code(), isolate));
4631 if (!code->is_optimized_code()) return; 4633 if (!code->is_optimized_code()) return;
4632 } 4634 }
4633 4635
4634 Handle<FixedArray> lit = isolate->factory()->empty_fixed_array(); 4636 Handle<TypeFeedbackVector> vector = handle(shared->feedback_vector());
4637 Handle<LiteralsArray> lit = isolate->factory()->NewLiteralsArray(
4638 vector, shared->num_literals(), TENURED);
4635 Handle<Context> context(isolate->context()); 4639 Handle<Context> context(isolate->context());
4636 4640
4637 // Add the code several times to the optimized code map. 4641 // Add the code several times to the optimized code map.
4638 for (int i = 0; i < 3; ++i) { 4642 for (int i = 0; i < 3; ++i) {
4639 HandleScope inner_scope(isolate); 4643 HandleScope inner_scope(isolate);
4640 BailoutId id = BailoutId(i); 4644 BailoutId id = BailoutId(i);
4641 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4645 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4642 } 4646 }
4643 shared->optimized_code_map()->Print(); 4647 shared->optimized_code_map()->Print();
4644 4648
4645 // Add the code with a literals array to be evacuated. 4649 // Add the code with a literals array to be evacuated.
4646 Page* evac_page; 4650 Page* evac_page;
4647 { 4651 {
4648 HandleScope inner_scope(isolate); 4652 HandleScope inner_scope(isolate);
4649 AlwaysAllocateScope always_allocate(isolate); 4653 AlwaysAllocateScope always_allocate(isolate);
4650 // Make sure literal is placed on an old-space evacuation candidate. 4654 // Make sure literal is placed on an old-space evacuation candidate.
4651 SimulateFullSpace(heap->old_space()); 4655 SimulateFullSpace(heap->old_space());
4652 Handle<FixedArray> lit = isolate->factory()->NewFixedArray(23, TENURED); 4656
4657 // Make sure there the number of literals is > 0.
4658 Handle<LiteralsArray> lit =
4659 isolate->factory()->NewLiteralsArray(vector, 23, TENURED);
4660
4653 evac_page = Page::FromAddress(lit->address()); 4661 evac_page = Page::FromAddress(lit->address());
4654 BailoutId id = BailoutId(100); 4662 BailoutId id = BailoutId(100);
4655 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id); 4663 SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
4656 } 4664 }
4657 4665
4658 // Heap is ready, force {lit_page} to become an evacuation candidate and 4666 // Heap is ready, force {lit_page} to become an evacuation candidate and
4659 // simulate incremental marking to enqueue optimized code map. 4667 // simulate incremental marking to enqueue optimized code map.
4660 FLAG_manual_evacuation_candidates_selection = true; 4668 FLAG_manual_evacuation_candidates_selection = true;
4661 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); 4669 evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING);
4662 SimulateIncrementalMarking(heap); 4670 SimulateIncrementalMarking(heap);
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
6515 // The CollectGarbage call above starts sweeper threads. 6523 // The CollectGarbage call above starts sweeper threads.
6516 // The crash will happen if the following two functions 6524 // The crash will happen if the following two functions
6517 // are called before sweeping finishes. 6525 // are called before sweeping finishes.
6518 heap->StartIncrementalMarking(); 6526 heap->StartIncrementalMarking();
6519 heap->FinalizeIncrementalMarkingIfComplete("test"); 6527 heap->FinalizeIncrementalMarkingIfComplete("test");
6520 } 6528 }
6521 6529
6522 6530
6523 } // namespace internal 6531 } // namespace internal
6524 } // namespace v8 6532 } // namespace v8
OLDNEW
« src/objects-inl.h ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698