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 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1375 |
1376 // Simulate incremental marking so that the function is enqueued as | 1376 // Simulate incremental marking so that the function is enqueued as |
1377 // code flushing candidate. | 1377 // code flushing candidate. |
1378 SimulateIncrementalMarking(heap); | 1378 SimulateIncrementalMarking(heap); |
1379 | 1379 |
1380 // Enable the debugger and add a breakpoint while incremental marking | 1380 // Enable the debugger and add a breakpoint while incremental marking |
1381 // is running so that incremental marking aborts and code flushing is | 1381 // is running so that incremental marking aborts and code flushing is |
1382 // disabled. | 1382 // disabled. |
1383 int position = 0; | 1383 int position = 0; |
1384 Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); | 1384 Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); |
| 1385 EnableDebugger(); |
1385 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); | 1386 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); |
1386 isolate->debug()->ClearAllBreakPoints(); | 1387 isolate->debug()->ClearAllBreakPoints(); |
| 1388 DisableDebugger(); |
1387 | 1389 |
1388 // Force optimization now that code flushing is disabled. | 1390 // Force optimization now that code flushing is disabled. |
1389 { v8::HandleScope scope(CcTest::isolate()); | 1391 { v8::HandleScope scope(CcTest::isolate()); |
1390 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); | 1392 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); |
1391 } | 1393 } |
1392 | 1394 |
1393 // Simulate one final GC to make sure the candidate queue is sane. | 1395 // Simulate one final GC to make sure the candidate queue is sane. |
1394 heap->CollectAllGarbage(); | 1396 heap->CollectAllGarbage(); |
1395 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); | 1397 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); |
1396 CHECK(function->is_compiled() || !function->IsOptimized()); | 1398 CHECK(function->is_compiled() || !function->IsOptimized()); |
(...skipping 4564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5961 size_t counter2 = 2000; | 5963 size_t counter2 = 2000; |
5962 tracer->SampleAllocation(time2, counter2, counter2); | 5964 tracer->SampleAllocation(time2, counter2, counter2); |
5963 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5965 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5964 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5966 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
5965 int time3 = 1000; | 5967 int time3 = 1000; |
5966 size_t counter3 = 30000; | 5968 size_t counter3 = 30000; |
5967 tracer->SampleAllocation(time3, counter3, counter3); | 5969 tracer->SampleAllocation(time3, counter3, counter3); |
5968 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5970 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5969 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5971 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
5970 } | 5972 } |
OLD | NEW |