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/v8.h" | 5 #include "src/v8.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 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 | 1525 |
1526 int root_index = root_index_map_.Lookup(obj); | 1526 int root_index = root_index_map_.Lookup(obj); |
1527 // We can only encode roots as such if it has already been serialized. | 1527 // We can only encode roots as such if it has already been serialized. |
1528 // That applies to root indices below the wave front. | 1528 // That applies to root indices below the wave front. |
1529 if (root_index != RootIndexMap::kInvalidRootIndex && | 1529 if (root_index != RootIndexMap::kInvalidRootIndex && |
1530 root_index < root_index_wave_front_) { | 1530 root_index < root_index_wave_front_) { |
1531 PutRoot(root_index, obj, how_to_code, where_to_point, skip); | 1531 PutRoot(root_index, obj, how_to_code, where_to_point, skip); |
1532 return; | 1532 return; |
1533 } | 1533 } |
1534 | 1534 |
| 1535 if (obj->IsCode() && Code::cast(obj)->kind() == Code::FUNCTION) { |
| 1536 obj = isolate()->builtins()->builtin(Builtins::kCompileLazy); |
| 1537 } |
| 1538 |
1535 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 1539 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; |
1536 | 1540 |
1537 FlushSkip(skip); | 1541 FlushSkip(skip); |
1538 | 1542 |
1539 // Object has not yet been serialized. Serialize it here. | 1543 // Object has not yet been serialized. Serialize it here. |
1540 ObjectSerializer object_serializer(this, obj, sink_, how_to_code, | 1544 ObjectSerializer object_serializer(this, obj, sink_, how_to_code, |
1541 where_to_point); | 1545 where_to_point); |
1542 object_serializer.Serialize(); | 1546 object_serializer.Serialize(); |
1543 } | 1547 } |
1544 | 1548 |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 DisallowHeapAllocation no_gc; | 2561 DisallowHeapAllocation no_gc; |
2558 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2562 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2559 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2563 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2560 if (r == CHECK_SUCCESS) return scd; | 2564 if (r == CHECK_SUCCESS) return scd; |
2561 cached_data->Reject(); | 2565 cached_data->Reject(); |
2562 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2566 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2563 delete scd; | 2567 delete scd; |
2564 return NULL; | 2568 return NULL; |
2565 } | 2569 } |
2566 } } // namespace v8::internal | 2570 } } // namespace v8::internal |
OLD | NEW |