OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/serialize.h" | 5 #include "src/snapshot/serialize.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 reinterpret_cast<Object*>(new_code_object->instruction_start()); \ | 977 reinterpret_cast<Object*>(new_code_object->instruction_start()); \ |
978 } else { \ | 978 } else { \ |
979 DCHECK(space_number == CODE_SPACE); \ | 979 DCHECK(space_number == CODE_SPACE); \ |
980 Cell* cell = Cell::cast(new_object); \ | 980 Cell* cell = Cell::cast(new_object); \ |
981 new_object = reinterpret_cast<Object*>(cell->ValueAddress()); \ | 981 new_object = reinterpret_cast<Object*>(cell->ValueAddress()); \ |
982 } \ | 982 } \ |
983 } \ | 983 } \ |
984 if (how == kFromCode) { \ | 984 if (how == kFromCode) { \ |
985 Address location_of_branch_data = reinterpret_cast<Address>(current); \ | 985 Address location_of_branch_data = reinterpret_cast<Address>(current); \ |
986 Assembler::deserialization_set_special_target_at( \ | 986 Assembler::deserialization_set_special_target_at( \ |
987 location_of_branch_data, \ | 987 isolate, location_of_branch_data, \ |
988 Code::cast(HeapObject::FromAddress(current_object_address)), \ | 988 Code::cast(HeapObject::FromAddress(current_object_address)), \ |
989 reinterpret_cast<Address>(new_object)); \ | 989 reinterpret_cast<Address>(new_object)); \ |
990 location_of_branch_data += Assembler::kSpecialTargetSize; \ | 990 location_of_branch_data += Assembler::kSpecialTargetSize; \ |
991 current = reinterpret_cast<Object**>(location_of_branch_data); \ | 991 current = reinterpret_cast<Object**>(location_of_branch_data); \ |
992 current_was_incremented = true; \ | 992 current_was_incremented = true; \ |
993 } else { \ | 993 } else { \ |
994 UnalignedCopy(current, &new_object); \ | 994 UnalignedCopy(current, &new_object); \ |
995 } \ | 995 } \ |
996 } \ | 996 } \ |
997 if (emit_write_barrier && write_barrier_needed) { \ | 997 if (emit_write_barrier && write_barrier_needed) { \ |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 // from code entry. | 1116 // from code entry. |
1117 int pc_offset = source_.GetInt(); | 1117 int pc_offset = source_.GetInt(); |
1118 int target_offset = source_.GetInt(); | 1118 int target_offset = source_.GetInt(); |
1119 Code* code = | 1119 Code* code = |
1120 Code::cast(HeapObject::FromAddress(current_object_address)); | 1120 Code::cast(HeapObject::FromAddress(current_object_address)); |
1121 DCHECK(0 <= pc_offset && pc_offset <= code->instruction_size()); | 1121 DCHECK(0 <= pc_offset && pc_offset <= code->instruction_size()); |
1122 DCHECK(0 <= target_offset && target_offset <= code->instruction_size()); | 1122 DCHECK(0 <= target_offset && target_offset <= code->instruction_size()); |
1123 Address pc = code->entry() + pc_offset; | 1123 Address pc = code->entry() + pc_offset; |
1124 Address target = code->entry() + target_offset; | 1124 Address target = code->entry() + target_offset; |
1125 Assembler::deserialization_set_target_internal_reference_at( | 1125 Assembler::deserialization_set_target_internal_reference_at( |
1126 pc, target, data == kInternalReference | 1126 isolate, pc, target, data == kInternalReference |
1127 ? RelocInfo::INTERNAL_REFERENCE | 1127 ? RelocInfo::INTERNAL_REFERENCE |
1128 : RelocInfo::INTERNAL_REFERENCE_ENCODED); | 1128 : RelocInfo::INTERNAL_REFERENCE_ENCODED); |
1129 break; | 1129 break; |
1130 } | 1130 } |
1131 | 1131 |
1132 case kNop: | 1132 case kNop: |
1133 break; | 1133 break; |
1134 | 1134 |
1135 case kNextChunk: { | 1135 case kNextChunk: { |
1136 int space = source_.Get(); | 1136 int space = source_.Get(); |
1137 DCHECK(space < kNumberOfPreallocatedSpaces); | 1137 DCHECK(space < kNumberOfPreallocatedSpaces); |
1138 int chunk_index = current_chunk_[space]; | 1138 int chunk_index = current_chunk_[space]; |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2856 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2857 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2857 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2858 if (r == CHECK_SUCCESS) return scd; | 2858 if (r == CHECK_SUCCESS) return scd; |
2859 cached_data->Reject(); | 2859 cached_data->Reject(); |
2860 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2860 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2861 delete scd; | 2861 delete scd; |
2862 return NULL; | 2862 return NULL; |
2863 } | 2863 } |
2864 } // namespace internal | 2864 } // namespace internal |
2865 } // namespace v8 | 2865 } // namespace v8 |
OLD | NEW |