Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/objects.cc

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: <sigh> upload only the one commit... Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10420 matching lines...) Expand 10 before | Expand all | Expand 10 after
10431 (is_compare_ic_stub() && 10431 (is_compare_ic_stub() &&
10432 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT); 10432 ICCompareStub::CompareState(stub_info()) == CompareIC::KNOWN_OBJECT);
10433 } 10433 }
10434 10434
10435 10435
10436 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { 10436 void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) {
10437 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY); 10437 PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY);
10438 } 10438 }
10439 10439
10440 10440
10441 void Code::MarkCodeAsExecuted(byte* sequence, Isolate* isolate) {
10442 PatchPlatformCodeAge(isolate, sequence, kExecutedOnceCodeAge,
10443 NO_MARKING_PARITY);
10444 }
10445
10446
10441 void Code::MakeOlder(MarkingParity current_parity) { 10447 void Code::MakeOlder(MarkingParity current_parity) {
10442 byte* sequence = FindCodeAgeSequence(); 10448 byte* sequence = FindCodeAgeSequence();
10443 if (sequence != NULL) { 10449 if (sequence != NULL) {
10444 Age age; 10450 Age age;
10445 MarkingParity code_parity; 10451 MarkingParity code_parity;
10446 GetCodeAgeAndParity(sequence, &age, &code_parity); 10452 GetCodeAgeAndParity(sequence, &age, &code_parity);
10447 if (age != kLastCodeAge && code_parity != current_parity) { 10453 if (age != kLastCodeAge && code_parity != current_parity) {
10448 PatchPlatformCodeAge(GetIsolate(), 10454 PatchPlatformCodeAge(GetIsolate(),
10449 sequence, 10455 sequence,
10450 static_cast<Age>(age + 1), 10456 static_cast<Age>(age + 1),
10451 current_parity); 10457 current_parity);
10452 } 10458 }
10453 } 10459 }
10454 } 10460 }
10455 10461
10456 10462
10457 bool Code::IsOld() { 10463 bool Code::IsOld() {
10458 byte* sequence = FindCodeAgeSequence(); 10464 Age age = GetAge();
10459 if (sequence == NULL) return false; 10465 return age >= kIsOldCodeAge;
10460 Age age;
10461 MarkingParity parity;
10462 GetCodeAgeAndParity(sequence, &age, &parity);
10463 return age >= kSexagenarianCodeAge;
10464 } 10466 }
10465 10467
10466 10468
10467 byte* Code::FindCodeAgeSequence() { 10469 byte* Code::FindCodeAgeSequence() {
10468 return FLAG_age_code && 10470 return FLAG_age_code &&
10469 prologue_offset() != kPrologueOffsetNotSet && 10471 prologue_offset() != kPrologueOffsetNotSet &&
10470 (kind() == OPTIMIZED_FUNCTION || 10472 (kind() == OPTIMIZED_FUNCTION ||
10471 (kind() == FUNCTION && !has_debug_break_slots())) 10473 (kind() == FUNCTION && !has_debug_break_slots()))
10472 ? instruction_start() + prologue_offset() 10474 ? instruction_start() + prologue_offset()
10473 : NULL; 10475 : NULL;
10474 } 10476 }
10475 10477
10476 10478
10477 int Code::GetAge() { 10479 Code::Age Code::GetAge() {
10478 byte* sequence = FindCodeAgeSequence(); 10480 byte* sequence = FindCodeAgeSequence();
10479 if (sequence == NULL) { 10481 if (sequence == NULL) {
10480 return Code::kNoAge; 10482 return Code::kNoAge;
10481 } 10483 }
10482 Age age; 10484 Age age;
10483 MarkingParity parity; 10485 MarkingParity parity;
10484 GetCodeAgeAndParity(sequence, &age, &parity); 10486 GetCodeAgeAndParity(sequence, &age, &parity);
10485 return age; 10487 return age;
10486 } 10488 }
10487 10489
(...skipping 11 matching lines...) Expand all
10499 return; \ 10501 return; \
10500 } \ 10502 } \
10501 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ 10503 stub = *builtins->Make##AGE##CodeYoungAgainOddMarking(); \
10502 if (code == stub) { \ 10504 if (code == stub) { \
10503 *age = k##AGE##CodeAge; \ 10505 *age = k##AGE##CodeAge; \
10504 *parity = ODD_MARKING_PARITY; \ 10506 *parity = ODD_MARKING_PARITY; \
10505 return; \ 10507 return; \
10506 } 10508 }
10507 CODE_AGE_LIST(HANDLE_CODE_AGE) 10509 CODE_AGE_LIST(HANDLE_CODE_AGE)
10508 #undef HANDLE_CODE_AGE 10510 #undef HANDLE_CODE_AGE
10511 stub = *builtins->MarkCodeAsExecutedOnce();
10512 if (code == stub) {
10513 // Treat that's never been executed as old immediatly.
10514 *age = kIsOldCodeAge;
10515 *parity = NO_MARKING_PARITY;
10516 return;
10517 }
10518 stub = *builtins->MarkCodeAsExecutedTwice();
10519 if (code == stub) {
10520 // Pre-age code that has only been executed once.
10521 *age = kPreAgedCodeAge;
10522 *parity = NO_MARKING_PARITY;
10523 return;
10524 }
10509 UNREACHABLE(); 10525 UNREACHABLE();
10510 } 10526 }
10511 10527
10512 10528
10513 Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity) { 10529 Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity) {
10514 Builtins* builtins = isolate->builtins(); 10530 Builtins* builtins = isolate->builtins();
10515 switch (age) { 10531 switch (age) {
10516 #define HANDLE_CODE_AGE(AGE) \ 10532 #define HANDLE_CODE_AGE(AGE) \
10517 case k##AGE##CodeAge: { \ 10533 case k##AGE##CodeAge: { \
10518 Code* stub = parity == EVEN_MARKING_PARITY \ 10534 Code* stub = parity == EVEN_MARKING_PARITY \
10519 ? *builtins->Make##AGE##CodeYoungAgainEvenMarking() \ 10535 ? *builtins->Make##AGE##CodeYoungAgainEvenMarking() \
10520 : *builtins->Make##AGE##CodeYoungAgainOddMarking(); \ 10536 : *builtins->Make##AGE##CodeYoungAgainOddMarking(); \
10521 return stub; \ 10537 return stub; \
10522 } 10538 }
10523 CODE_AGE_LIST(HANDLE_CODE_AGE) 10539 CODE_AGE_LIST(HANDLE_CODE_AGE)
10524 #undef HANDLE_CODE_AGE 10540 #undef HANDLE_CODE_AGE
10541 case kNotExecutedCodeAge: {
10542 ASSERT(parity == NO_MARKING_PARITY);
10543 return *builtins->MarkCodeAsExecutedOnce();
10544 }
10545 case kExecutedOnceCodeAge: {
10546 ASSERT(parity == NO_MARKING_PARITY);
10547 return *builtins->MarkCodeAsExecutedTwice();
10548 }
10525 default: 10549 default:
10526 UNREACHABLE(); 10550 UNREACHABLE();
10527 break; 10551 break;
10528 } 10552 }
10529 return NULL; 10553 return NULL;
10530 } 10554 }
10531 10555
10532 10556
10533 void Code::PrintDeoptLocation(int bailout_id) { 10557 void Code::PrintDeoptLocation(int bailout_id) {
10534 const char* last_comment = NULL; 10558 const char* last_comment = NULL;
(...skipping 5609 matching lines...) Expand 10 before | Expand all | Expand 10 after
16144 #define ERROR_MESSAGES_TEXTS(C, T) T, 16168 #define ERROR_MESSAGES_TEXTS(C, T) T,
16145 static const char* error_messages_[] = { 16169 static const char* error_messages_[] = {
16146 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16170 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16147 }; 16171 };
16148 #undef ERROR_MESSAGES_TEXTS 16172 #undef ERROR_MESSAGES_TEXTS
16149 return error_messages_[reason]; 16173 return error_messages_[reason];
16150 } 16174 }
16151 16175
16152 16176
16153 } } // namespace v8::internal 16177 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698