Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/snapshot/deserializer.cc

Issue 2790573002: Encode any deoptimizer entry in serialized data. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/deserializer.h" 5 #include "src/snapshot/deserializer.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/assembler-inl.h" 8 #include "src/assembler-inl.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/deoptimizer.h"
10 #include "src/external-reference-table.h" 11 #include "src/external-reference-table.h"
11 #include "src/heap/heap-inl.h" 12 #include "src/heap/heap-inl.h"
12 #include "src/isolate.h" 13 #include "src/isolate.h"
13 #include "src/macro-assembler.h" 14 #include "src/macro-assembler.h"
14 #include "src/objects-inl.h" 15 #include "src/objects-inl.h"
15 #include "src/snapshot/natives.h" 16 #include "src/snapshot/natives.h"
16 #include "src/v8.h" 17 #include "src/v8.h"
17 #include "src/v8threads.h" 18 #include "src/v8threads.h"
18 19
19 namespace v8 { 20 namespace v8 {
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 #undef CASE_BODY 726 #undef CASE_BODY
726 #undef ALL_SPACES 727 #undef ALL_SPACES
727 728
728 case kSkip: { 729 case kSkip: {
729 int size = source_.GetInt(); 730 int size = source_.GetInt();
730 current = reinterpret_cast<Object**>( 731 current = reinterpret_cast<Object**>(
731 reinterpret_cast<intptr_t>(current) + size); 732 reinterpret_cast<intptr_t>(current) + size);
732 break; 733 break;
733 } 734 }
734 735
736 case kDeoptimizerEntryFromCode:
737 case kDeoptimizerEntryPlain: {
738 int skip = source_.GetInt();
739 current = reinterpret_cast<Object**>(
740 reinterpret_cast<intptr_t>(current) + skip);
741 Deoptimizer::BailoutType bailout_type =
742 static_cast<Deoptimizer::BailoutType>(source_.Get());
743 int entry_id = source_.GetInt();
744 HandleScope scope(isolate);
745 Address address = Deoptimizer::GetDeoptimizationEntry(
746 isolate_, entry_id, bailout_type, Deoptimizer::ENSURE_ENTRY_CODE);
747 if (data == kDeoptimizerEntryFromCode) {
748 Address location_of_branch_data = reinterpret_cast<Address>(current);
749 Assembler::deserialization_set_special_target_at(
750 isolate, location_of_branch_data,
751 Code::cast(HeapObject::FromAddress(current_object_address)),
752 address);
753 location_of_branch_data += Assembler::kSpecialTargetSize;
754 current = reinterpret_cast<Object**>(location_of_branch_data);
755 } else {
756 Object* new_object = reinterpret_cast<Object*>(address);
757 UnalignedCopy(current, &new_object);
758 current++;
759 }
760 break;
761 }
762
735 case kInternalReferenceEncoded: 763 case kInternalReferenceEncoded:
736 case kInternalReference: { 764 case kInternalReference: {
737 // Internal reference address is not encoded via skip, but by offset 765 // Internal reference address is not encoded via skip, but by offset
738 // from code entry. 766 // from code entry.
739 int pc_offset = source_.GetInt(); 767 int pc_offset = source_.GetInt();
740 int target_offset = source_.GetInt(); 768 int target_offset = source_.GetInt();
741 Code* code = 769 Code* code =
742 Code::cast(HeapObject::FromAddress(current_object_address)); 770 Code::cast(HeapObject::FromAddress(current_object_address));
743 DCHECK(0 <= pc_offset && pc_offset <= code->instruction_size()); 771 DCHECK(0 <= pc_offset && pc_offset <= code->instruction_size());
744 DCHECK(0 <= target_offset && target_offset <= code->instruction_size()); 772 DCHECK(0 <= target_offset && target_offset <= code->instruction_size());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 918
891 default: 919 default:
892 CHECK(false); 920 CHECK(false);
893 } 921 }
894 } 922 }
895 CHECK_EQ(limit, current); 923 CHECK_EQ(limit, current);
896 return true; 924 return true;
897 } 925 }
898 } // namespace internal 926 } // namespace internal
899 } // namespace v8 927 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/snapshot/serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698