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/code-serializer.h" | 5 #include "src/snapshot/code-serializer.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/log.h" | 8 #include "src/log.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 #include "src/snapshot/deserializer.h" | 10 #include "src/snapshot/deserializer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 double ms = timer.Elapsed().InMillisecondsF(); | 40 double ms = timer.Elapsed().InMillisecondsF(); |
41 int length = script_data->length(); | 41 int length = script_data->length(); |
42 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); | 42 PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms); |
43 } | 43 } |
44 | 44 |
45 return script_data; | 45 return script_data; |
46 } | 46 } |
47 | 47 |
48 void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, | 48 void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, |
49 WhereToPoint where_to_point, int skip) { | 49 WhereToPoint where_to_point, int skip) { |
| 50 if (SerializeHotObject(obj, how_to_code, where_to_point, skip)) return; |
| 51 |
50 int root_index = root_index_map_.Lookup(obj); | 52 int root_index = root_index_map_.Lookup(obj); |
51 if (root_index != RootIndexMap::kInvalidRootIndex) { | 53 if (root_index != RootIndexMap::kInvalidRootIndex) { |
52 PutRoot(root_index, obj, how_to_code, where_to_point, skip); | 54 PutRoot(root_index, obj, how_to_code, where_to_point, skip); |
53 return; | 55 return; |
54 } | 56 } |
55 | 57 |
56 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 58 if (SerializeBackReference(obj, how_to_code, where_to_point, skip)) return; |
57 | 59 |
58 FlushSkip(skip); | 60 FlushSkip(skip); |
59 | 61 |
60 if (obj->IsCode()) { | 62 if (obj->IsCode()) { |
61 Code* code_object = Code::cast(obj); | 63 Code* code_object = Code::cast(obj); |
62 switch (code_object->kind()) { | 64 switch (code_object->kind()) { |
63 case Code::OPTIMIZED_FUNCTION: // No optimized code compiled yet. | 65 case Code::OPTIMIZED_FUNCTION: // No optimized code compiled yet. |
64 case Code::HANDLER: // No handlers patched in yet. | 66 case Code::HANDLER: // No handlers patched in yet. |
65 case Code::REGEXP: // No regexp literals initialized yet. | 67 case Code::REGEXP: // No regexp literals initialized yet. |
66 case Code::NUMBER_OF_KINDS: // Pseudo enum value. | 68 case Code::NUMBER_OF_KINDS: // Pseudo enum value. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 SanityCheckResult r = scd->SanityCheck(isolate, source); | 356 SanityCheckResult r = scd->SanityCheck(isolate, source); |
355 if (r == CHECK_SUCCESS) return scd; | 357 if (r == CHECK_SUCCESS) return scd; |
356 cached_data->Reject(); | 358 cached_data->Reject(); |
357 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 359 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
358 delete scd; | 360 delete scd; |
359 return NULL; | 361 return NULL; |
360 } | 362 } |
361 | 363 |
362 } // namespace internal | 364 } // namespace internal |
363 } // namespace v8 | 365 } // namespace v8 |
OLD | NEW |