| OLD | NEW |
| 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 Loading... |
| 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 4192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5959 size_t counter2 = 2000; | 5959 size_t counter2 = 2000; |
| 5960 tracer->SampleAllocation(time2, counter2, counter2); | 5960 tracer->SampleAllocation(time2, counter2, counter2); |
| 5961 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5961 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5962 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5962 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
| 5963 int time3 = 1000; | 5963 int time3 = 1000; |
| 5964 size_t counter3 = 30000; | 5964 size_t counter3 = 30000; |
| 5965 tracer->SampleAllocation(time3, counter3, counter3); | 5965 tracer->SampleAllocation(time3, counter3, counter3); |
| 5966 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5966 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5967 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5967 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
| 5968 } | 5968 } |
| OLD | NEW |