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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // This function's code looks flushable. But we have to postpone | 407 // This function's code looks flushable. But we have to postpone |
408 // the decision until we see all functions that point to the same | 408 // the decision until we see all functions that point to the same |
409 // SharedFunctionInfo because some of them might be optimized. | 409 // SharedFunctionInfo because some of them might be optimized. |
410 // That would also make the non-optimized version of the code | 410 // That would also make the non-optimized version of the code |
411 // non-flushable, because it is required for bailing out from | 411 // non-flushable, because it is required for bailing out from |
412 // optimized code. | 412 // optimized code. |
413 collector->code_flusher()->AddCandidate(function); | 413 collector->code_flusher()->AddCandidate(function); |
414 // Visit shared function info immediately to avoid double checking | 414 // Visit shared function info immediately to avoid double checking |
415 // of its flushability later. This is just an optimization because | 415 // of its flushability later. This is just an optimization because |
416 // the shared function info would eventually be visited. | 416 // the shared function info would eventually be visited. |
417 SharedFunctionInfo* shared = function->unchecked_shared(); | 417 SharedFunctionInfo* shared = function->shared(); |
418 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { | 418 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { |
419 StaticVisitor::MarkObject(heap, shared->map()); | 419 StaticVisitor::MarkObject(heap, shared->map()); |
420 VisitSharedFunctionInfoWeakCode(heap, shared); | 420 VisitSharedFunctionInfoWeakCode(heap, shared); |
421 } | 421 } |
422 // Treat the reference to the code object weakly. | 422 // Treat the reference to the code object weakly. |
423 VisitJSFunctionWeakCode(heap, object); | 423 VisitJSFunctionWeakCode(heap, object); |
424 return; | 424 return; |
425 } else { | 425 } else { |
426 // Visit all unoptimized code objects to prevent flushing them. | 426 // Visit all unoptimized code objects to prevent flushing them. |
427 StaticVisitor::MarkObject(heap, function->shared()->code()); | 427 StaticVisitor::MarkObject(heap, function->shared()->code()); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { | 588 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { |
589 Object* undefined = heap->undefined_value(); | 589 Object* undefined = heap->undefined_value(); |
590 return (info->script() != undefined) && | 590 return (info->script() != undefined) && |
591 (reinterpret_cast<Script*>(info->script())->source() != undefined); | 591 (reinterpret_cast<Script*>(info->script())->source() != undefined); |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 template<typename StaticVisitor> | 595 template<typename StaticVisitor> |
596 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( | 596 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( |
597 Heap* heap, JSFunction* function) { | 597 Heap* heap, JSFunction* function) { |
598 SharedFunctionInfo* shared_info = function->unchecked_shared(); | 598 SharedFunctionInfo* shared_info = function->shared(); |
599 | 599 |
600 // Code is either on stack, in compilation cache or referenced | 600 // Code is either on stack, in compilation cache or referenced |
601 // by optimized version of function. | 601 // by optimized version of function. |
602 MarkBit code_mark = Marking::MarkBitFrom(function->code()); | 602 MarkBit code_mark = Marking::MarkBitFrom(function->code()); |
603 if (code_mark.Get()) { | 603 if (code_mark.Get()) { |
604 if (!FLAG_age_code) { | 604 if (!FLAG_age_code) { |
605 if (!Marking::MarkBitFrom(shared_info).Get()) { | 605 if (!Marking::MarkBitFrom(shared_info).Get()) { |
606 shared_info->set_code_age(0); | 606 shared_info->set_code_age(0); |
607 } | 607 } |
608 } | 608 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 RelocIterator it(this, mode_mask); | 825 RelocIterator it(this, mode_mask); |
826 for (; !it.done(); it.next()) { | 826 for (; !it.done(); it.next()) { |
827 it.rinfo()->template Visit<StaticVisitor>(heap); | 827 it.rinfo()->template Visit<StaticVisitor>(heap); |
828 } | 828 } |
829 } | 829 } |
830 | 830 |
831 | 831 |
832 } } // namespace v8::internal | 832 } } // namespace v8::internal |
833 | 833 |
834 #endif // V8_OBJECTS_VISITING_INL_H_ | 834 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |