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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); | 460 CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); |
461 patcher.masm()->Push(ra, fp, cp, a1); | 461 patcher.masm()->Push(ra, fp, cp, a1); |
462 patcher.masm()->LoadRoot(at, Heap::kUndefinedValueRootIndex); | 462 patcher.masm()->LoadRoot(at, Heap::kUndefinedValueRootIndex); |
463 patcher.masm()->Addu(fp, sp, Operand(2 * kPointerSize)); | 463 patcher.masm()->Addu(fp, sp, Operand(2 * kPointerSize)); |
464 initialized = true; | 464 initialized = true; |
465 } | 465 } |
466 return byte_sequence; | 466 return byte_sequence; |
467 } | 467 } |
468 | 468 |
469 | 469 |
470 byte* Code::FindPlatformCodeAgeSequence() { | |
471 byte* start = instruction_start(); | |
472 uint32_t young_length; | |
473 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | |
474 if (!memcmp(start, young_sequence, young_length) || | |
475 Memory::uint32_at(start) == kCodeAgePatchFirstInstruction) { | |
476 return start; | |
477 } else { | |
478 byte* start_after_strict = NULL; | |
479 if (kind() == FUNCTION) { | |
480 start_after_strict = start + kSizeOfFullCodegenStrictModePrologue; | |
481 } else { | |
482 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
483 start_after_strict = start + kSizeOfOptimizedStrictModePrologue; | |
484 } | |
485 ASSERT(!memcmp(start_after_strict, young_sequence, young_length) || | |
486 Memory::uint32_at(start_after_strict) == | |
487 kCodeAgePatchFirstInstruction); | |
488 return start_after_strict; | |
489 } | |
490 } | |
491 | |
492 | |
493 bool Code::IsYoungSequence(byte* sequence) { | 470 bool Code::IsYoungSequence(byte* sequence) { |
494 uint32_t young_length; | 471 uint32_t young_length; |
495 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 472 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
496 bool result = !memcmp(sequence, young_sequence, young_length); | 473 bool result = !memcmp(sequence, young_sequence, young_length); |
497 ASSERT(result || | 474 ASSERT(result || |
498 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); | 475 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); |
499 return result; | 476 return result; |
500 } | 477 } |
501 | 478 |
502 | 479 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 515 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
539 } | 516 } |
540 } | 517 } |
541 | 518 |
542 | 519 |
543 #undef __ | 520 #undef __ |
544 | 521 |
545 } } // namespace v8::internal | 522 } } // namespace v8::internal |
546 | 523 |
547 #endif // V8_TARGET_ARCH_MIPS | 524 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |