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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) { | 47 ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) { |
48 // Miscellaneous | 48 // Miscellaneous |
49 Add(ExternalReference::roots_array_start(isolate).address(), | 49 Add(ExternalReference::roots_array_start(isolate).address(), |
50 "Heap::roots_array_start()"); | 50 "Heap::roots_array_start()"); |
51 Add(ExternalReference::address_of_stack_limit(isolate).address(), | 51 Add(ExternalReference::address_of_stack_limit(isolate).address(), |
52 "StackGuard::address_of_jslimit()"); | 52 "StackGuard::address_of_jslimit()"); |
53 Add(ExternalReference::address_of_real_stack_limit(isolate).address(), | 53 Add(ExternalReference::address_of_real_stack_limit(isolate).address(), |
54 "StackGuard::address_of_real_jslimit()"); | 54 "StackGuard::address_of_real_jslimit()"); |
55 Add(ExternalReference::new_space_start(isolate).address(), | 55 Add(ExternalReference::new_space_start(isolate).address(), |
56 "Heap::NewSpaceStart()"); | 56 "Heap::NewSpaceStart()"); |
57 Add(ExternalReference::new_space_mask(isolate).address(), | |
58 "Heap::NewSpaceMask()"); | |
59 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(), | 57 Add(ExternalReference::new_space_allocation_limit_address(isolate).address(), |
60 "Heap::NewSpaceAllocationLimitAddress()"); | 58 "Heap::NewSpaceAllocationLimitAddress()"); |
61 Add(ExternalReference::new_space_allocation_top_address(isolate).address(), | 59 Add(ExternalReference::new_space_allocation_top_address(isolate).address(), |
62 "Heap::NewSpaceAllocationTopAddress()"); | 60 "Heap::NewSpaceAllocationTopAddress()"); |
63 Add(ExternalReference::mod_two_doubles_operation(isolate).address(), | 61 Add(ExternalReference::mod_two_doubles_operation(isolate).address(), |
64 "mod_two_doubles"); | 62 "mod_two_doubles"); |
65 // Keyed lookup cache. | 63 // Keyed lookup cache. |
66 Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(), | 64 Add(ExternalReference::keyed_lookup_cache_keys(isolate).address(), |
67 "KeyedLookupCache::keys()"); | 65 "KeyedLookupCache::keys()"); |
68 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(), | 66 Add(ExternalReference::keyed_lookup_cache_field_offsets(isolate).address(), |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1009 reinterpret_cast<Address>(new_object)); \ | 1007 reinterpret_cast<Address>(new_object)); \ |
1010 location_of_branch_data += Assembler::kSpecialTargetSize; \ | 1008 location_of_branch_data += Assembler::kSpecialTargetSize; \ |
1011 current = reinterpret_cast<Object**>(location_of_branch_data); \ | 1009 current = reinterpret_cast<Object**>(location_of_branch_data); \ |
1012 current_was_incremented = true; \ | 1010 current_was_incremented = true; \ |
1013 } else { \ | 1011 } else { \ |
1014 UnalignedCopy(current, &new_object); \ | 1012 UnalignedCopy(current, &new_object); \ |
1015 } \ | 1013 } \ |
1016 } \ | 1014 } \ |
1017 if (emit_write_barrier && write_barrier_needed) { \ | 1015 if (emit_write_barrier && write_barrier_needed) { \ |
1018 Address current_address = reinterpret_cast<Address>(current); \ | 1016 Address current_address = reinterpret_cast<Address>(current); \ |
1017 /* Builtins have been filtered above, so we are on-heap. */ \ | |
Yang
2016/02/09 09:54:26
This comment makes no sense to me. Maybe you mean
Michael Lippautz
2016/02/09 13:28:53
Thanks for the clarification!
As discussed offlin
| |
1019 isolate->heap()->RecordWrite( \ | 1018 isolate->heap()->RecordWrite( \ |
1020 current_object_address, \ | 1019 reinterpret_cast<Object*>(current_object_address + 1), \ |
1021 static_cast<int>(current_address - current_object_address)); \ | 1020 static_cast<int>(current_address - current_object_address), \ |
1021 *reinterpret_cast<Object**>(current_address)); \ | |
1022 } \ | 1022 } \ |
1023 if (!current_was_incremented) { \ | 1023 if (!current_was_incremented) { \ |
1024 current++; \ | 1024 current++; \ |
1025 } \ | 1025 } \ |
1026 break; \ | 1026 break; \ |
1027 } | 1027 } |
1028 | 1028 |
1029 // This generates a case and a body for the new space (which has to do extra | 1029 // This generates a case and a body for the new space (which has to do extra |
1030 // write barrier handling) and handles the other spaces with fall-through cases | 1030 // write barrier handling) and handles the other spaces with fall-through cases |
1031 // and one body. | 1031 // and one body. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1243 current = reinterpret_cast<Object**>( | 1243 current = reinterpret_cast<Object**>( |
1244 reinterpret_cast<Address>(current) + skip); | 1244 reinterpret_cast<Address>(current) + skip); |
1245 // Fall through. | 1245 // Fall through. |
1246 } | 1246 } |
1247 | 1247 |
1248 FOUR_CASES(kHotObject) | 1248 FOUR_CASES(kHotObject) |
1249 FOUR_CASES(kHotObject + 4) { | 1249 FOUR_CASES(kHotObject + 4) { |
1250 int index = data & kHotObjectMask; | 1250 int index = data & kHotObjectMask; |
1251 Object* hot_object = hot_objects_.Get(index); | 1251 Object* hot_object = hot_objects_.Get(index); |
1252 UnalignedCopy(current, &hot_object); | 1252 UnalignedCopy(current, &hot_object); |
1253 if (write_barrier_needed && isolate->heap()->InNewSpace(hot_object)) { | 1253 if (write_barrier_needed) { |
1254 Address current_address = reinterpret_cast<Address>(current); | 1254 Address current_address = reinterpret_cast<Address>(current); |
1255 isolate->heap()->RecordWrite( | 1255 isolate->heap()->RecordWrite( |
1256 current_object_address, | 1256 reinterpret_cast<Object*>(current_object_address + 1), |
1257 static_cast<int>(current_address - current_object_address)); | 1257 static_cast<int>(current_address - current_object_address), |
1258 hot_object); | |
1258 } | 1259 } |
1259 current++; | 1260 current++; |
1260 break; | 1261 break; |
1261 } | 1262 } |
1262 | 1263 |
1263 // Deserialize raw data of fixed length from 1 to 32 words. | 1264 // Deserialize raw data of fixed length from 1 to 32 words. |
1264 STATIC_ASSERT(kNumberOfFixedRawData == 32); | 1265 STATIC_ASSERT(kNumberOfFixedRawData == 32); |
1265 SIXTEEN_CASES(kFixedRawData) | 1266 SIXTEEN_CASES(kFixedRawData) |
1266 SIXTEEN_CASES(kFixedRawData + 16) { | 1267 SIXTEEN_CASES(kFixedRawData + 16) { |
1267 byte* raw_data_out = reinterpret_cast<byte*>(current); | 1268 byte* raw_data_out = reinterpret_cast<byte*>(current); |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2854 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2855 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2855 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2856 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2856 if (r == CHECK_SUCCESS) return scd; | 2857 if (r == CHECK_SUCCESS) return scd; |
2857 cached_data->Reject(); | 2858 cached_data->Reject(); |
2858 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2859 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2859 delete scd; | 2860 delete scd; |
2860 return NULL; | 2861 return NULL; |
2861 } | 2862 } |
2862 } // namespace internal | 2863 } // namespace internal |
2863 } // namespace v8 | 2864 } // namespace v8 |
OLD | NEW |