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

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

Issue 2780773002: [heap] Two minor fixes in EstimatedSize (Closed)
Patch Set: Remove unused variables Created 3 years, 8 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/context-measure.cc ('K') | « src/context-measure.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 5881 matching lines...) Expand 10 before | Expand all | Expand 10 after
5892 PrintF("Context size : %d bytes\n", measure.Size()); 5892 PrintF("Context size : %d bytes\n", measure.Size());
5893 PrintF("Context object count: %d\n", measure.Count()); 5893 PrintF("Context object count: %d\n", measure.Count());
5894 5894
5895 CHECK_LE(1000, measure.Count()); 5895 CHECK_LE(1000, measure.Count());
5896 CHECK_LE(50000, measure.Size()); 5896 CHECK_LE(50000, measure.Size());
5897 5897
5898 CHECK_LE(measure.Count(), count_upper_limit); 5898 CHECK_LE(measure.Count(), count_upper_limit);
5899 CHECK_LE(measure.Size(), size_upper_limit); 5899 CHECK_LE(measure.Size(), size_upper_limit);
5900 } 5900 }
5901 5901
5902 TEST(ContextMeasureNoMap) {
5903 CcTest::InitializeVM();
5904 v8::HandleScope scope(CcTest::isolate());
5905
5906 Local<v8::Context> current_context = CcTest::isolate()->GetCurrentContext();
5907 Local<v8::Context> other_context = v8::Context::New(CcTest::isolate());
5908
5909 CompileRun(current_context, "var x = []");
5910
5911 size_t original_size_current = current_context->EstimatedSize();
5912 size_t original_size_other = other_context->EstimatedSize();
5913
5914 CompileRun(current_context, "x.a = 1;");
5915
5916 size_t new_size_current = current_context->EstimatedSize();
5917 size_t new_size_other = other_context->EstimatedSize();
5918
5919 CHECK_LT(original_size_current, new_size_current);
5920 CHECK_EQ(original_size_other, new_size_other);
5921 }
5902 5922
5903 TEST(ScriptIterator) { 5923 TEST(ScriptIterator) {
5904 CcTest::InitializeVM(); 5924 CcTest::InitializeVM();
5905 v8::HandleScope scope(CcTest::isolate()); 5925 v8::HandleScope scope(CcTest::isolate());
5906 Isolate* isolate = CcTest::i_isolate(); 5926 Isolate* isolate = CcTest::i_isolate();
5907 Heap* heap = CcTest::heap(); 5927 Heap* heap = CcTest::heap();
5908 LocalContext context; 5928 LocalContext context;
5909 5929
5910 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); 5930 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask);
5911 5931
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
6637 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); 6657 CHECK(!heap->code_space()->FirstPage()->Contains(code->address()));
6638 6658
6639 // Ensure it's not in large object space. 6659 // Ensure it's not in large object space.
6640 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); 6660 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address());
6641 CHECK(chunk->owner()->identity() != LO_SPACE); 6661 CHECK(chunk->owner()->identity() != LO_SPACE);
6642 CHECK(chunk->NeverEvacuate()); 6662 CHECK(chunk->NeverEvacuate());
6643 } 6663 }
6644 6664
6645 } // namespace internal 6665 } // namespace internal
6646 } // namespace v8 6666 } // namespace v8
OLDNEW
« src/context-measure.cc ('K') | « src/context-measure.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698