Chromium Code Reviews| 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 13450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13461 | 13461 |
| 13462 | 13462 |
| 13463 void Code::Relocate(intptr_t delta) { | 13463 void Code::Relocate(intptr_t delta) { |
| 13464 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 13464 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 13465 it.rinfo()->apply(delta); | 13465 it.rinfo()->apply(delta); |
| 13466 } | 13466 } |
| 13467 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); | 13467 Assembler::FlushICache(GetIsolate(), instruction_start(), instruction_size()); |
| 13468 } | 13468 } |
| 13469 | 13469 |
| 13470 | 13470 |
| 13471 void Code::CopyFrom(const CodeDesc& desc) { | 13471 void Code::CopyFrom(const CodeDesc& desc) { |
|
rmcilroy
2016/06/21 13:47:43
Please add a cctest which tests this function both
Stefano Sanfilippo
2016/06/23 15:23:44
Done.
| |
| 13472 // copy code | 13472 // copy code |
| 13473 CopyBytes(instruction_start(), desc.buffer, | 13473 CopyBytes(instruction_start(), desc.buffer, |
| 13474 static_cast<size_t>(desc.instr_size)); | 13474 static_cast<size_t>(desc.instr_size)); |
| 13475 | 13475 |
| 13476 // copy unwinding info, if any | |
| 13477 if (desc.unwinding_info && desc.unwinding_info_size > 0) { | |
| 13478 // pad to 2**3 boundary | |
|
rmcilroy
2016/06/21 13:47:43
please write number of bytes instead of 2**3.
Stefano Sanfilippo
2016/06/23 15:23:44
Done.
| |
| 13479 static const byte padding[8] = {0}; | |
| 13480 int padding_size = ((desc.instr_size + 7) & (~7)) - desc.instr_size; | |
|
rmcilroy
2016/06/21 13:47:43
I don't think it's necessary to copy zero's into t
Stefano Sanfilippo
2016/06/23 15:23:44
Done.
| |
| 13481 CopyBytes(instruction_end(), padding, padding_size); | |
| 13482 | |
| 13483 uint64_t unwinding_info_size = desc.unwinding_info_size; | |
| 13484 CopyBytes(RoundUp(instruction_end(), kInt64Size), | |
|
rmcilroy
2016/06/21 13:47:43
Just use set_unwinding_size
Stefano Sanfilippo
2016/06/23 15:23:44
Done.
| |
| 13485 reinterpret_cast<byte*>(&unwinding_info_size), | |
| 13486 sizeof(unwinding_info_size)); | |
| 13487 CopyBytes(unwinding_info_start(), desc.unwinding_info, | |
| 13488 static_cast<size_t>(desc.unwinding_info_size)); | |
| 13489 } | |
| 13490 | |
| 13476 // copy reloc info | 13491 // copy reloc info |
| 13477 CopyBytes(relocation_start(), | 13492 CopyBytes(relocation_start(), |
| 13478 desc.buffer + desc.buffer_size - desc.reloc_size, | 13493 desc.buffer + desc.buffer_size - desc.reloc_size, |
| 13479 static_cast<size_t>(desc.reloc_size)); | 13494 static_cast<size_t>(desc.reloc_size)); |
| 13480 | 13495 |
| 13481 // unbox handles and relocate | 13496 // unbox handles and relocate |
| 13482 intptr_t delta = instruction_start() - desc.buffer; | 13497 intptr_t delta = instruction_start() - desc.buffer; |
| 13483 int mode_mask = RelocInfo::kCodeTargetMask | | 13498 int mode_mask = RelocInfo::kCodeTargetMask | |
| 13484 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 13499 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 13485 RelocInfo::ModeMask(RelocInfo::CELL) | | 13500 RelocInfo::ModeMask(RelocInfo::CELL) | |
| (...skipping 5372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18858 if (cell->value() != *new_value) { | 18873 if (cell->value() != *new_value) { |
| 18859 cell->set_value(*new_value); | 18874 cell->set_value(*new_value); |
| 18860 Isolate* isolate = cell->GetIsolate(); | 18875 Isolate* isolate = cell->GetIsolate(); |
| 18861 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18876 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18862 isolate, DependentCode::kPropertyCellChangedGroup); | 18877 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18863 } | 18878 } |
| 18864 } | 18879 } |
| 18865 | 18880 |
| 18866 } // namespace internal | 18881 } // namespace internal |
| 18867 } // namespace v8 | 18882 } // namespace v8 |
| OLD | NEW |