Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 10601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10612 PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY); | 10612 PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY); |
| 10613 } | 10613 } |
| 10614 | 10614 |
| 10615 | 10615 |
| 10616 void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) { | 10616 void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) { |
| 10617 PatchPlatformCodeAge(isolate, sequence, kExecutedOnceCodeAge, | 10617 PatchPlatformCodeAge(isolate, sequence, kExecutedOnceCodeAge, |
| 10618 NO_MARKING_PARITY); | 10618 NO_MARKING_PARITY); |
| 10619 } | 10619 } |
| 10620 | 10620 |
| 10621 | 10621 |
| 10622 static Code::Age EffectiveAge(Code::Age age) { | |
| 10623 if (age == Code::kNotExecutedCodeAge) { | |
| 10624 // Treat that's never been executed as old immediately. | |
| 10625 age = Code::kIsOldCodeAge; | |
| 10626 } else if (age == Code::kExecutedOnceCodeAge) { | |
|
Michael Starzinger
2013/11/04 12:28:28
nit: Only one white-space after "if".
rmcilroy
2013/11/05 13:44:57
Done.
| |
| 10627 // Pre-age code that has only been executed once. | |
| 10628 age = Code::kPreAgedCodeAge; | |
| 10629 } | |
| 10630 return age; | |
| 10631 } | |
| 10632 | |
| 10633 | |
| 10622 void Code::MakeOlder(MarkingParity current_parity) { | 10634 void Code::MakeOlder(MarkingParity current_parity) { |
| 10623 byte* sequence = FindCodeAgeSequence(); | 10635 byte* sequence = FindCodeAgeSequence(); |
| 10624 if (sequence != NULL) { | 10636 if (sequence != NULL) { |
| 10625 Age age; | 10637 Age age; |
| 10626 MarkingParity code_parity; | 10638 MarkingParity code_parity; |
| 10627 GetCodeAgeAndParity(sequence, &age, &code_parity); | 10639 GetCodeAgeAndParity(sequence, &age, &code_parity); |
| 10640 age = EffectiveAge(age); | |
| 10628 if (age != kLastCodeAge && code_parity != current_parity) { | 10641 if (age != kLastCodeAge && code_parity != current_parity) { |
| 10629 PatchPlatformCodeAge(GetIsolate(), | 10642 PatchPlatformCodeAge(GetIsolate(), |
| 10630 sequence, | 10643 sequence, |
| 10631 static_cast<Age>(age + 1), | 10644 static_cast<Age>(age + 1), |
| 10632 current_parity); | 10645 current_parity); |
| 10633 } | 10646 } |
| 10634 } | 10647 } |
| 10635 } | 10648 } |
| 10636 | 10649 |
| 10637 | 10650 |
| 10638 bool Code::IsOld() { | 10651 bool Code::IsOld() { |
| 10639 Age age = GetAge(); | 10652 return GetAge() >= kIsOldCodeAge; |
| 10640 return age >= kIsOldCodeAge; | |
| 10641 } | 10653 } |
| 10642 | 10654 |
| 10643 | 10655 |
| 10644 byte* Code::FindCodeAgeSequence() { | 10656 byte* Code::FindCodeAgeSequence() { |
| 10645 return FLAG_age_code && | 10657 return FLAG_age_code && |
| 10646 prologue_offset() != Code::kPrologueOffsetNotSet && | 10658 prologue_offset() != Code::kPrologueOffsetNotSet && |
| 10647 (kind() == OPTIMIZED_FUNCTION || | 10659 (kind() == OPTIMIZED_FUNCTION || |
| 10648 (kind() == FUNCTION && !has_debug_break_slots())) | 10660 (kind() == FUNCTION && !has_debug_break_slots())) |
| 10649 ? instruction_start() + prologue_offset() | 10661 ? instruction_start() + prologue_offset() |
| 10650 : NULL; | 10662 : NULL; |
| 10651 } | 10663 } |
| 10652 | 10664 |
| 10653 | 10665 |
| 10654 Code::Age Code::GetAge() { | 10666 Code::Age Code::GetAge() { |
| 10667 return EffectiveAge(GetRawAge()); | |
| 10668 } | |
| 10669 | |
| 10670 | |
| 10671 Code::Age Code::GetRawAge() { | |
| 10655 byte* sequence = FindCodeAgeSequence(); | 10672 byte* sequence = FindCodeAgeSequence(); |
| 10656 if (sequence == NULL) { | 10673 if (sequence == NULL) { |
| 10657 return Code::kNoAgeCodeAge; | 10674 return kNoAgeCodeAge; |
| 10658 } | 10675 } |
| 10659 Age age; | 10676 Age age; |
| 10660 MarkingParity parity; | 10677 MarkingParity parity; |
| 10661 GetCodeAgeAndParity(sequence, &age, &parity); | 10678 GetCodeAgeAndParity(sequence, &age, &parity); |
| 10662 return age; | 10679 return age; |
| 10663 } | 10680 } |
| 10664 | 10681 |
| 10665 | 10682 |
| 10666 void Code::GetCodeAgeAndParity(Code* code, Age* age, | 10683 void Code::GetCodeAgeAndParity(Code* code, Age* age, |
| 10667 MarkingParity* parity) { | 10684 MarkingParity* parity) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 10678 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ | 10695 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ |
| 10679 if (code == stub) { \ | 10696 if (code == stub) { \ |
| 10680 *age = k##AGE##CodeAge; \ | 10697 *age = k##AGE##CodeAge; \ |
| 10681 *parity = ODD_MARKING_PARITY; \ | 10698 *parity = ODD_MARKING_PARITY; \ |
| 10682 return; \ | 10699 return; \ |
| 10683 } | 10700 } |
| 10684 CODE_AGE_LIST(HANDLE_CODE_AGE) | 10701 CODE_AGE_LIST(HANDLE_CODE_AGE) |
| 10685 #undef HANDLE_CODE_AGE | 10702 #undef HANDLE_CODE_AGE |
| 10686 stub = *builtins->MarkCodeAsExecutedOnce(); | 10703 stub = *builtins->MarkCodeAsExecutedOnce(); |
| 10687 if (code == stub) { | 10704 if (code == stub) { |
| 10688 // Treat that's never been executed as old immediatly. | 10705 *age = kNotExecutedCodeAge; |
| 10689 *age = kIsOldCodeAge; | |
| 10690 *parity = NO_MARKING_PARITY; | 10706 *parity = NO_MARKING_PARITY; |
| 10691 return; | 10707 return; |
| 10692 } | 10708 } |
| 10693 stub = *builtins->MarkCodeAsExecutedTwice(); | 10709 stub = *builtins->MarkCodeAsExecutedTwice(); |
| 10694 if (code == stub) { | 10710 if (code == stub) { |
| 10695 // Pre-age code that has only been executed once. | 10711 *age = kExecutedOnceCodeAge; |
| 10696 *age = kPreAgedCodeAge; | |
| 10697 *parity = NO_MARKING_PARITY; | 10712 *parity = NO_MARKING_PARITY; |
| 10698 return; | 10713 return; |
| 10699 } | 10714 } |
| 10700 UNREACHABLE(); | 10715 UNREACHABLE(); |
| 10701 } | 10716 } |
| 10702 | 10717 |
| 10703 | 10718 |
| 10704 Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity) { | 10719 Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity) { |
| 10705 Builtins* builtins = isolate->builtins(); | 10720 Builtins* builtins = isolate->builtins(); |
| 10706 switch (age) { | 10721 switch (age) { |
| (...skipping 5691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16398 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16413 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16399 static const char* error_messages_[] = { | 16414 static const char* error_messages_[] = { |
| 16400 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16415 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16401 }; | 16416 }; |
| 16402 #undef ERROR_MESSAGES_TEXTS | 16417 #undef ERROR_MESSAGES_TEXTS |
| 16403 return error_messages_[reason]; | 16418 return error_messages_[reason]; |
| 16404 } | 16419 } |
| 16405 | 16420 |
| 16406 | 16421 |
| 16407 } } // namespace v8::internal | 16422 } } // namespace v8::internal |
| OLD | NEW |