| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 // Bump the code age so that flushing is triggered. | 1340 // Bump the code age so that flushing is triggered. |
| 1341 const int kAgingThreshold = 6; | 1341 const int kAgingThreshold = 6; |
| 1342 for (int i = 0; i < kAgingThreshold; i++) { | 1342 for (int i = 0; i < kAgingThreshold; i++) { |
| 1343 function->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2)); | 1343 function->shared()->code()->MakeOlder(static_cast<MarkingParity>(i % 2)); |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 // Simulate incremental marking so that the function is enqueued as | 1346 // Simulate incremental marking so that the function is enqueued as |
| 1347 // code flushing candidate. | 1347 // code flushing candidate. |
| 1348 SimulateIncrementalMarking(); | 1348 SimulateIncrementalMarking(); |
| 1349 | 1349 |
| 1350 #ifdef ENABLE_DEBUGGER_SUPPORT | |
| 1351 // Enable the debugger and add a breakpoint while incremental marking | 1350 // Enable the debugger and add a breakpoint while incremental marking |
| 1352 // is running so that incremental marking aborts and code flushing is | 1351 // is running so that incremental marking aborts and code flushing is |
| 1353 // disabled. | 1352 // disabled. |
| 1354 int position = 0; | 1353 int position = 0; |
| 1355 Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); | 1354 Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); |
| 1356 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); | 1355 isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); |
| 1357 isolate->debug()->ClearAllBreakPoints(); | 1356 isolate->debug()->ClearAllBreakPoints(); |
| 1358 #endif // ENABLE_DEBUGGER_SUPPORT | |
| 1359 | 1357 |
| 1360 // Force optimization now that code flushing is disabled. | 1358 // Force optimization now that code flushing is disabled. |
| 1361 { v8::HandleScope scope(CcTest::isolate()); | 1359 { v8::HandleScope scope(CcTest::isolate()); |
| 1362 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); | 1360 CompileRun("%OptimizeFunctionOnNextCall(foo); foo();"); |
| 1363 } | 1361 } |
| 1364 | 1362 |
| 1365 // Simulate one final GC to make sure the candidate queue is sane. | 1363 // Simulate one final GC to make sure the candidate queue is sane. |
| 1366 heap->CollectAllGarbage(Heap::kNoGCFlags); | 1364 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 1367 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); | 1365 CHECK(function->shared()->is_compiled() || !function->IsOptimized()); |
| 1368 CHECK(function->is_compiled() || !function->IsOptimized()); | 1366 CHECK(function->is_compiled() || !function->IsOptimized()); |
| (...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3653 } | 3651 } |
| 3654 | 3652 |
| 3655 function = inner_scope.CloseAndEscape(handle(*f, isolate)); | 3653 function = inner_scope.CloseAndEscape(handle(*f, isolate)); |
| 3656 } | 3654 } |
| 3657 | 3655 |
| 3658 // Simulate incremental marking so that unoptimized function is enqueued as a | 3656 // Simulate incremental marking so that unoptimized function is enqueued as a |
| 3659 // candidate for code flushing. The shared function info however will not be | 3657 // candidate for code flushing. The shared function info however will not be |
| 3660 // explicitly enqueued. | 3658 // explicitly enqueued. |
| 3661 SimulateIncrementalMarking(); | 3659 SimulateIncrementalMarking(); |
| 3662 | 3660 |
| 3663 #ifdef ENABLE_DEBUGGER_SUPPORT | |
| 3664 // Now enable the debugger which in turn will disable code flushing. | 3661 // Now enable the debugger which in turn will disable code flushing. |
| 3665 CHECK(isolate->debug()->Load()); | 3662 CHECK(isolate->debug()->Load()); |
| 3666 #endif // ENABLE_DEBUGGER_SUPPORT | |
| 3667 | 3663 |
| 3668 // This cycle will bust the heap and subsequent cycles will go ballistic. | 3664 // This cycle will bust the heap and subsequent cycles will go ballistic. |
| 3669 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3665 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3670 heap->CollectAllGarbage(Heap::kNoGCFlags); | 3666 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 3671 } | 3667 } |
| 3672 | 3668 |
| 3673 | 3669 |
| 3674 class DummyVisitor : public ObjectVisitor { | 3670 class DummyVisitor : public ObjectVisitor { |
| 3675 public: | 3671 public: |
| 3676 void VisitPointers(Object** start, Object** end) { } | 3672 void VisitPointers(Object** start, Object** end) { } |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4217 "array;"); | 4213 "array;"); |
| 4218 | 4214 |
| 4219 Handle<JSObject> o = | 4215 Handle<JSObject> o = |
| 4220 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); | 4216 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
| 4221 CHECK(heap->InOldPointerSpace(o->elements())); | 4217 CHECK(heap->InOldPointerSpace(o->elements())); |
| 4222 CHECK(heap->InOldPointerSpace(*o)); | 4218 CHECK(heap->InOldPointerSpace(*o)); |
| 4223 Page* page = Page::FromAddress(o->elements()->address()); | 4219 Page* page = Page::FromAddress(o->elements()->address()); |
| 4224 CHECK(page->WasSwept() || | 4220 CHECK(page->WasSwept() || |
| 4225 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4221 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
| 4226 } | 4222 } |
| OLD | NEW |