Chromium Code Reviews| 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 8585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8596 // copy reloc info | 8596 // copy reloc info |
| 8597 memmove(relocation_start(), | 8597 memmove(relocation_start(), |
| 8598 desc.buffer + desc.buffer_size - desc.reloc_size, | 8598 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 8599 desc.reloc_size); | 8599 desc.reloc_size); |
| 8600 | 8600 |
| 8601 // unbox handles and relocate | 8601 // unbox handles and relocate |
| 8602 intptr_t delta = instruction_start() - desc.buffer; | 8602 intptr_t delta = instruction_start() - desc.buffer; |
| 8603 int mode_mask = RelocInfo::kCodeTargetMask | | 8603 int mode_mask = RelocInfo::kCodeTargetMask | |
| 8604 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 8604 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 8605 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 8605 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
| 8606 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | |
| 8606 RelocInfo::kApplyMask; | 8607 RelocInfo::kApplyMask; |
| 8607 Assembler* origin = desc.origin; // Needed to find target_object on X64. | 8608 // Needed to find target_object and runtime_entry on X64 |
| 8609 Assembler* origin = desc.origin; | |
| 8608 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 8610 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 8609 RelocInfo::Mode mode = it.rinfo()->rmode(); | 8611 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 8610 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 8612 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 8611 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 8613 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 8612 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); | 8614 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER); |
| 8613 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 8615 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { |
| 8614 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); | 8616 Handle<JSGlobalPropertyCell> cell = it.rinfo()->target_cell_handle(); |
| 8615 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); | 8617 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER); |
| 8616 } else if (RelocInfo::IsCodeTarget(mode)) { | 8618 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 8617 // rewrite code handles in inline cache targets to direct | 8619 // rewrite code handles in inline cache targets to direct |
| 8618 // pointers to the first instruction in the code object | 8620 // pointers to the first instruction in the code object |
| 8619 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 8621 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 8620 Code* code = Code::cast(*p); | 8622 Code* code = Code::cast(*p); |
| 8621 it.rinfo()->set_target_address(code->instruction_start(), | 8623 it.rinfo()->set_target_address(code->instruction_start(), |
| 8622 SKIP_WRITE_BARRIER); | 8624 SKIP_WRITE_BARRIER); |
| 8625 } else if (RelocInfo::IsRuntimeEntry(mode) && | |
| 8626 RelocInfo::NeedsInitializeRuntimeEntry()) { | |
| 8627 Address p = it.rinfo()->target_runtime_entry(origin); | |
|
danno
2013/03/07 14:57:23
Why do you need NeedsInitializeRuntimeEntry at all
haitao.feng
2013/03/08 05:30:05
Done.
| |
| 8628 it.rinfo()->set_target_address(p, SKIP_WRITE_BARRIER); | |
| 8623 } else { | 8629 } else { |
| 8624 it.rinfo()->apply(delta); | 8630 it.rinfo()->apply(delta); |
| 8625 } | 8631 } |
| 8626 } | 8632 } |
| 8627 CPU::FlushICache(instruction_start(), instruction_size()); | 8633 CPU::FlushICache(instruction_start(), instruction_size()); |
| 8628 } | 8634 } |
| 8629 | 8635 |
| 8630 | 8636 |
| 8631 // Locate the source position which is closest to the address in the code. This | 8637 // Locate the source position which is closest to the address in the code. This |
| 8632 // is using the source position information embedded in the relocation info. | 8638 // is using the source position information embedded in the relocation info. |
| (...skipping 5349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13982 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13988 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13983 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13989 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13984 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13990 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13985 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13991 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13986 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13992 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13987 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13993 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13988 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13994 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13989 } | 13995 } |
| 13990 | 13996 |
| 13991 } } // namespace v8::internal | 13997 } } // namespace v8::internal |
| OLD | NEW |