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 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3509 " var a = new Array(n);" | 3509 " var a = new Array(n);" |
3510 " for (var i = 0; i < n; i += 100) a[i] = i;" | 3510 " for (var i = 0; i < n; i += 100) a[i] = i;" |
3511 "};" | 3511 "};" |
3512 "f(10 * 1024 * 1024);"); | 3512 "f(10 * 1024 * 1024);"); |
3513 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 3513 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
3514 if (marking->IsStopped()) marking->Start(); | 3514 if (marking->IsStopped()) marking->Start(); |
3515 // This big step should be sufficient to mark the whole array. | 3515 // This big step should be sufficient to mark the whole array. |
3516 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 3516 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); |
3517 ASSERT(marking->IsComplete()); | 3517 ASSERT(marking->IsComplete()); |
3518 } | 3518 } |
| 3519 |
| 3520 |
| 3521 TEST(DisableInlineAllocation) { |
| 3522 i::FLAG_allow_natives_syntax = true; |
| 3523 CcTest::InitializeVM(); |
| 3524 v8::HandleScope scope(CcTest::isolate()); |
| 3525 CompileRun("function test() {" |
| 3526 " var x = [];" |
| 3527 " for (var i = 0; i < 10; i++) {" |
| 3528 " x[i] = [ {}, [1,2,3], [1,x,3] ];" |
| 3529 " }" |
| 3530 "}" |
| 3531 "function run() {" |
| 3532 " %OptimizeFunctionOnNextCall(test);" |
| 3533 " test();" |
| 3534 " %DeoptimizeFunction(test);" |
| 3535 "}"); |
| 3536 |
| 3537 // Warm-up with inline allocation enabled. |
| 3538 CompileRun("test(); test(); run();"); |
| 3539 |
| 3540 // Run test with inline allocation disabled. |
| 3541 CcTest::heap()->DisableInlineAllocation(); |
| 3542 CompileRun("run()"); |
| 3543 |
| 3544 // Run test with inline allocation disabled and pretenuring. |
| 3545 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 3546 CompileRun("run()"); |
| 3547 |
| 3548 // Run test with inline allocation re-enabled. |
| 3549 CcTest::heap()->EnableInlineAllocation(); |
| 3550 CompileRun("run()"); |
| 3551 } |
OLD | NEW |