| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 13970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13981 CopyBytes(unwinding_info_start(), desc.unwinding_info, | 13981 CopyBytes(unwinding_info_start(), desc.unwinding_info, |
| 13982 static_cast<size_t>(desc.unwinding_info_size)); | 13982 static_cast<size_t>(desc.unwinding_info_size)); |
| 13983 } | 13983 } |
| 13984 | 13984 |
| 13985 // copy reloc info | 13985 // copy reloc info |
| 13986 CopyBytes(relocation_start(), | 13986 CopyBytes(relocation_start(), |
| 13987 desc.buffer + desc.buffer_size - desc.reloc_size, | 13987 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 13988 static_cast<size_t>(desc.reloc_size)); | 13988 static_cast<size_t>(desc.reloc_size)); |
| 13989 | 13989 |
| 13990 // unbox handles and relocate | 13990 // unbox handles and relocate |
| 13991 intptr_t delta = instruction_start() - desc.buffer; | |
| 13992 int mode_mask = RelocInfo::kCodeTargetMask | | 13991 int mode_mask = RelocInfo::kCodeTargetMask | |
| 13993 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 13992 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 13994 RelocInfo::ModeMask(RelocInfo::CELL) | | 13993 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 13995 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | 13994 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
| 13996 RelocInfo::kApplyMask; | 13995 RelocInfo::kApplyMask; |
| 13997 // Needed to find target_object and runtime_entry on X64 | 13996 // Needed to find target_object and runtime_entry on X64 |
| 13998 Assembler* origin = desc.origin; | 13997 Assembler* origin = desc.origin; |
| 13999 AllowDeferredHandleDereference embedding_raw_address; | 13998 AllowDeferredHandleDereference embedding_raw_address; |
| 14000 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 13999 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 14001 RelocInfo::Mode mode = it.rinfo()->rmode(); | 14000 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 14002 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 14001 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 14003 Handle<HeapObject> p = it.rinfo()->target_object_handle(origin); | 14002 Handle<HeapObject> p = it.rinfo()->target_object_handle(origin); |
| 14004 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER, | 14003 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER, |
| 14005 SKIP_ICACHE_FLUSH); | 14004 SKIP_ICACHE_FLUSH); |
| 14006 } else if (mode == RelocInfo::CELL) { | 14005 } else if (mode == RelocInfo::CELL) { |
| 14007 Handle<Cell> cell = it.rinfo()->target_cell_handle(); | 14006 Handle<Cell> cell = it.rinfo()->target_cell_handle(); |
| 14008 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER, | 14007 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER, |
| 14009 SKIP_ICACHE_FLUSH); | 14008 SKIP_ICACHE_FLUSH); |
| 14010 } else if (RelocInfo::IsCodeTarget(mode)) { | 14009 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 14011 // rewrite code handles in inline cache targets to direct | 14010 // rewrite code handles to direct pointers to the first instruction in the |
| 14012 // pointers to the first instruction in the code object | 14011 // code object |
| 14013 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 14012 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 14014 Code* code = Code::cast(*p); | 14013 Code* code = Code::cast(*p); |
| 14015 it.rinfo()->set_target_address(GetIsolate(), code->instruction_start(), | 14014 it.rinfo()->set_target_address(GetIsolate(), code->instruction_start(), |
| 14016 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH); | 14015 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH); |
| 14017 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 14016 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 14018 Address p = it.rinfo()->target_runtime_entry(origin); | 14017 Address p = it.rinfo()->target_runtime_entry(origin); |
| 14019 it.rinfo()->set_target_runtime_entry( | 14018 it.rinfo()->set_target_runtime_entry( |
| 14020 GetIsolate(), p, UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH); | 14019 GetIsolate(), p, UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH); |
| 14021 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { | 14020 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { |
| 14022 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); | 14021 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); |
| 14023 Code* code = Code::cast(*p); | 14022 Code* code = Code::cast(*p); |
| 14024 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); | 14023 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); |
| 14025 } else { | 14024 } else { |
| 14025 intptr_t delta = instruction_start() - desc.buffer; |
| 14026 it.rinfo()->apply(delta); | 14026 it.rinfo()->apply(delta); |
| 14027 } | 14027 } |
| 14028 } | 14028 } |
| 14029 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); | 14029 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); |
| 14030 } | 14030 } |
| 14031 | 14031 |
| 14032 | 14032 |
| 14033 SafepointEntry Code::GetSafepointEntry(Address pc) { | 14033 SafepointEntry Code::GetSafepointEntry(Address pc) { |
| 14034 SafepointTable table(this); | 14034 SafepointTable table(this); |
| 14035 return table.FindEntry(pc); | 14035 return table.FindEntry(pc); |
| (...skipping 6603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20639 // depend on this. | 20639 // depend on this. |
| 20640 return DICTIONARY_ELEMENTS; | 20640 return DICTIONARY_ELEMENTS; |
| 20641 } | 20641 } |
| 20642 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20642 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20643 return kind; | 20643 return kind; |
| 20644 } | 20644 } |
| 20645 } | 20645 } |
| 20646 | 20646 |
| 20647 } // namespace internal | 20647 } // namespace internal |
| 20648 } // namespace v8 | 20648 } // namespace v8 |
| OLD | NEW |