| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/snapshot/serializer.h" | 5 #include "src/snapshot/serializer.h" |
| 6 | 6 |
| 7 #include "src/macro-assembler.h" | 7 #include "src/macro-assembler.h" |
| 8 #include "src/snapshot/natives.h" | 8 #include "src/snapshot/natives.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 bytes_processed_so_far_ += kPointerSize; | 616 bytes_processed_so_far_ += kPointerSize; |
| 617 } | 617 } |
| 618 | 618 |
| 619 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) { | 619 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) { |
| 620 int skip = OutputRawData(rinfo->target_address_address(), | 620 int skip = OutputRawData(rinfo->target_address_address(), |
| 621 kCanReturnSkipInsteadOfSkipping); | 621 kCanReturnSkipInsteadOfSkipping); |
| 622 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; | 622 HowToCode how_to_code = rinfo->IsCodedSpecially() ? kFromCode : kPlain; |
| 623 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef"); | 623 sink_->Put(kExternalReference + how_to_code + kStartOfObject, "ExternalRef"); |
| 624 sink_->PutInt(skip, "SkipB4ExternalRef"); | 624 sink_->PutInt(skip, "SkipB4ExternalRef"); |
| 625 Address target = rinfo->target_external_reference(); | 625 Address target = rinfo->target_external_reference(); |
| 626 DCHECK_NOT_NULL(target); // Code does not reference null. |
| 626 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id"); | 627 sink_->PutInt(serializer_->EncodeExternalReference(target), "reference id"); |
| 627 bytes_processed_so_far_ += rinfo->target_address_size(); | 628 bytes_processed_so_far_ += rinfo->target_address_size(); |
| 628 } | 629 } |
| 629 | 630 |
| 630 void Serializer::ObjectSerializer::VisitInternalReference(RelocInfo* rinfo) { | 631 void Serializer::ObjectSerializer::VisitInternalReference(RelocInfo* rinfo) { |
| 631 // We can only reference to internal references of code that has been output. | 632 // We can only reference to internal references of code that has been output. |
| 632 DCHECK(object_->IsCode() && code_has_been_output_); | 633 DCHECK(object_->IsCode() && code_has_been_output_); |
| 633 // We do not use skip from last patched pc to find the pc to patch, since | 634 // We do not use skip from last patched pc to find the pc to patch, since |
| 634 // target_address_address may not return addresses in ascending order when | 635 // target_address_address may not return addresses in ascending order when |
| 635 // used for internal references. External references may be stored at the | 636 // used for internal references. External references may be stored at the |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 if (to_skip != 0 && return_skip == kIgnoringReturn) { | 796 if (to_skip != 0 && return_skip == kIgnoringReturn) { |
| 796 sink_->Put(kSkip, "Skip"); | 797 sink_->Put(kSkip, "Skip"); |
| 797 sink_->PutInt(to_skip, "SkipDistance"); | 798 sink_->PutInt(to_skip, "SkipDistance"); |
| 798 to_skip = 0; | 799 to_skip = 0; |
| 799 } | 800 } |
| 800 return to_skip; | 801 return to_skip; |
| 801 } | 802 } |
| 802 | 803 |
| 803 } // namespace internal | 804 } // namespace internal |
| 804 } // namespace v8 | 805 } // namespace v8 |
| OLD | NEW |