| 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 <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 13964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13975 | 13975 |
| 13976 void Code::Relocate(intptr_t delta) { | 13976 void Code::Relocate(intptr_t delta) { |
| 13977 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 13977 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 13978 it.rinfo()->apply(delta); | 13978 it.rinfo()->apply(delta); |
| 13979 } | 13979 } |
| 13980 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); | 13980 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); |
| 13981 } | 13981 } |
| 13982 | 13982 |
| 13983 | 13983 |
| 13984 void Code::CopyFrom(const CodeDesc& desc) { | 13984 void Code::CopyFrom(const CodeDesc& desc) { |
| 13985 DCHECK(Marking::Color(this) == Marking::WHITE_OBJECT); | |
| 13986 | |
| 13987 // copy code | 13985 // copy code |
| 13988 CopyBytes(instruction_start(), desc.buffer, | 13986 CopyBytes(instruction_start(), desc.buffer, |
| 13989 static_cast<size_t>(desc.instr_size)); | 13987 static_cast<size_t>(desc.instr_size)); |
| 13990 | 13988 |
| 13991 // copy reloc info | 13989 // copy reloc info |
| 13992 CopyBytes(relocation_start(), | 13990 CopyBytes(relocation_start(), |
| 13993 desc.buffer + desc.buffer_size - desc.reloc_size, | 13991 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 13994 static_cast<size_t>(desc.reloc_size)); | 13992 static_cast<size_t>(desc.reloc_size)); |
| 13995 | 13993 |
| 13996 // unbox handles and relocate | 13994 // unbox handles and relocate |
| 13997 intptr_t delta = instruction_start() - desc.buffer; | 13995 intptr_t delta = instruction_start() - desc.buffer; |
| 13998 int mode_mask = RelocInfo::kCodeTargetMask | | 13996 int mode_mask = RelocInfo::kCodeTargetMask | |
| 13999 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 13997 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 14000 RelocInfo::ModeMask(RelocInfo::CELL) | | 13998 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 14001 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | 13999 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
| 14002 RelocInfo::kApplyMask; | 14000 RelocInfo::kApplyMask; |
| 14003 // Needed to find target_object and runtime_entry on X64 | 14001 // Needed to find target_object and runtime_entry on X64 |
| 14004 Assembler* origin = desc.origin; | 14002 Assembler* origin = desc.origin; |
| 14005 AllowDeferredHandleDereference embedding_raw_address; | 14003 AllowDeferredHandleDereference embedding_raw_address; |
| 14006 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 14004 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 14007 RelocInfo::Mode mode = it.rinfo()->rmode(); | 14005 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 14008 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 14006 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 14009 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 14007 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 14010 it.rinfo()->set_target_object(*p, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); | 14008 it.rinfo()->set_target_object(*p, UPDATE_WRITE_BARRIER, |
| 14009 SKIP_ICACHE_FLUSH); |
| 14011 } else if (mode == RelocInfo::CELL) { | 14010 } else if (mode == RelocInfo::CELL) { |
| 14012 Handle<Cell> cell = it.rinfo()->target_cell_handle(); | 14011 Handle<Cell> cell = it.rinfo()->target_cell_handle(); |
| 14013 it.rinfo()->set_target_cell(*cell, SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH); | 14012 it.rinfo()->set_target_cell(*cell, UPDATE_WRITE_BARRIER, |
| 14013 SKIP_ICACHE_FLUSH); |
| 14014 } else if (RelocInfo::IsCodeTarget(mode)) { | 14014 } else if (RelocInfo::IsCodeTarget(mode)) { |
| 14015 // rewrite code handles in inline cache targets to direct | 14015 // rewrite code handles in inline cache targets to direct |
| 14016 // pointers to the first instruction in the code object | 14016 // pointers to the first instruction in the code object |
| 14017 Handle<Object> p = it.rinfo()->target_object_handle(origin); | 14017 Handle<Object> p = it.rinfo()->target_object_handle(origin); |
| 14018 Code* code = Code::cast(*p); | 14018 Code* code = Code::cast(*p); |
| 14019 it.rinfo()->set_target_address(code->instruction_start(), | 14019 it.rinfo()->set_target_address(code->instruction_start(), |
| 14020 SKIP_WRITE_BARRIER, | 14020 UPDATE_WRITE_BARRIER, SKIP_ICACHE_FLUSH); |
| 14021 SKIP_ICACHE_FLUSH); | |
| 14022 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 14021 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
| 14023 Address p = it.rinfo()->target_runtime_entry(origin); | 14022 Address p = it.rinfo()->target_runtime_entry(origin); |
| 14024 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, | 14023 it.rinfo()->set_target_runtime_entry(p, UPDATE_WRITE_BARRIER, |
| 14025 SKIP_ICACHE_FLUSH); | 14024 SKIP_ICACHE_FLUSH); |
| 14026 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { | 14025 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { |
| 14027 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); | 14026 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); |
| 14028 Code* code = Code::cast(*p); | 14027 Code* code = Code::cast(*p); |
| 14029 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); | 14028 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); |
| 14030 } else { | 14029 } else { |
| 14031 it.rinfo()->apply(delta); | 14030 it.rinfo()->apply(delta); |
| 14032 } | 14031 } |
| 14033 } | 14032 } |
| 14034 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); | 14033 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); |
| (...skipping 5755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19790 if (cell->value() != *new_value) { | 19789 if (cell->value() != *new_value) { |
| 19791 cell->set_value(*new_value); | 19790 cell->set_value(*new_value); |
| 19792 Isolate* isolate = cell->GetIsolate(); | 19791 Isolate* isolate = cell->GetIsolate(); |
| 19793 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19792 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19794 isolate, DependentCode::kPropertyCellChangedGroup); | 19793 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19795 } | 19794 } |
| 19796 } | 19795 } |
| 19797 | 19796 |
| 19798 } // namespace internal | 19797 } // namespace internal |
| 19799 } // namespace v8 | 19798 } // namespace v8 |
| OLD | NEW |