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

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

Issue 1176453002: Optimize trivial regexp disjunctions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make test faster Created 5 years, 6 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
« no previous file with comments | « src/vector.h ('k') | test/mjsunit/regress/regress-chromium-482998.js » ('j') | 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 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 1740
1741 v8::V8::Initialize(); 1741 v8::V8::Initialize();
1742 1742
1743 Isolate* isolate = CcTest::i_isolate(); 1743 Isolate* isolate = CcTest::i_isolate();
1744 HandleScope scope(isolate); 1744 HandleScope scope(isolate);
1745 1745
1746 LocalContext context; 1746 LocalContext context;
1747 1747
1748 // Adjust source below and this check to match 1748 // Adjust source below and this check to match
1749 // RegExpImple::kRegExpTooLargeToOptimize. 1749 // RegExpImple::kRegExpTooLargeToOptimize.
1750 DCHECK_EQ(i::RegExpImpl::kRegExpTooLargeToOptimize, 10 * KB); 1750 DCHECK_EQ(i::RegExpImpl::kRegExpTooLargeToOptimize, 20 * KB);
1751 1751
1752 // Compile a regexp that is much larger if we are using regexp optimizations. 1752 // Compile a regexp that is much larger if we are using regexp optimizations.
1753 CompileRun( 1753 CompileRun(
1754 "var reg_exp_source = '(?:a|bc|def|ghij|klmno|pqrstu)';" 1754 "var reg_exp_source = '(?:a|bc|def|ghij|klmno|pqrstu)';"
1755 "var half_size_reg_exp;" 1755 "var half_size_reg_exp;"
1756 "while (reg_exp_source.length < 10 * 1024) {" 1756 "while (reg_exp_source.length < 20 * 1024) {"
1757 " half_size_reg_exp = reg_exp_source;" 1757 " half_size_reg_exp = reg_exp_source;"
1758 " reg_exp_source = reg_exp_source + reg_exp_source;" 1758 " reg_exp_source = reg_exp_source + reg_exp_source;"
1759 "}" 1759 "}"
1760 // Flatten string. 1760 // Flatten string.
1761 "reg_exp_source.match(/f/);"); 1761 "reg_exp_source.match(/f/);");
1762 1762
1763 // Get initial heap size after several full GCs, which will stabilize 1763 // Get initial heap size after several full GCs, which will stabilize
1764 // the heap size and return with sweeping finished completely. 1764 // the heap size and return with sweeping finished completely.
1765 CcTest::heap()->CollectAllGarbage(); 1765 CcTest::heap()->CollectAllGarbage();
1766 CcTest::heap()->CollectAllGarbage(); 1766 CcTest::heap()->CollectAllGarbage();
(...skipping 4186 matching lines...) Expand 10 before | Expand all | Expand 10 after
5953 size_t counter2 = 2000; 5953 size_t counter2 = 2000;
5954 tracer->SampleAllocation(time2, counter2, counter2); 5954 tracer->SampleAllocation(time2, counter2, counter2);
5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); 5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput);
5957 int time3 = 1000; 5957 int time3 = 1000;
5958 size_t counter3 = 30000; 5958 size_t counter3 = 30000;
5959 tracer->SampleAllocation(time3, counter3, counter3); 5959 tracer->SampleAllocation(time3, counter3, counter3);
5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); 5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100);
5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); 5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput);
5962 } 5962 }
OLDNEW
« no previous file with comments | « src/vector.h ('k') | test/mjsunit/regress/regress-chromium-482998.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698