| 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 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 Handle<String> source) { | 2068 Handle<String> source) { |
| 2069 base::ElapsedTimer timer; | 2069 base::ElapsedTimer timer; |
| 2070 if (FLAG_profile_deserialization) timer.Start(); | 2070 if (FLAG_profile_deserialization) timer.Start(); |
| 2071 if (FLAG_trace_serializer) { | 2071 if (FLAG_trace_serializer) { |
| 2072 PrintF("[Serializing from"); | 2072 PrintF("[Serializing from"); |
| 2073 Object* script = info->script(); | 2073 Object* script = info->script(); |
| 2074 if (script->IsScript()) Script::cast(script)->name()->ShortPrint(); | 2074 if (script->IsScript()) Script::cast(script)->name()->ShortPrint(); |
| 2075 PrintF("]\n"); | 2075 PrintF("]\n"); |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 // The type feedback vector of this function must be clear. |
| 2079 if (info->feedback_vector()->IsCleared()) { |
| 2080 UNREACHABLE(); |
| 2081 info->ClearTypeFeedbackInfo(); |
| 2082 } |
| 2083 |
| 2078 // Serialize code object. | 2084 // Serialize code object. |
| 2079 SnapshotByteSink sink(info->code()->CodeSize() * 2); | 2085 SnapshotByteSink sink(info->code()->CodeSize() * 2); |
| 2080 CodeSerializer cs(isolate, &sink, *source, info->code()); | 2086 CodeSerializer cs(isolate, &sink, *source, info->code()); |
| 2081 DisallowHeapAllocation no_gc; | 2087 DisallowHeapAllocation no_gc; |
| 2082 Object** location = Handle<Object>::cast(info).location(); | 2088 Object** location = Handle<Object>::cast(info).location(); |
| 2083 cs.VisitPointer(location); | 2089 cs.VisitPointer(location); |
| 2084 cs.Pad(); | 2090 cs.Pad(); |
| 2085 | 2091 |
| 2086 SerializedCodeData data(sink.data(), cs); | 2092 SerializedCodeData data(sink.data(), cs); |
| 2087 ScriptData* script_data = data.GetScriptData(); | 2093 ScriptData* script_data = data.GetScriptData(); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2477 return GetHeaderValue(kNumInternalizedStringsOffset); | 2483 return GetHeaderValue(kNumInternalizedStringsOffset); |
| 2478 } | 2484 } |
| 2479 | 2485 |
| 2480 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 2486 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
| 2481 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; | 2487 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; |
| 2482 const byte* start = data_ + kHeaderSize + reservations_size; | 2488 const byte* start = data_ + kHeaderSize + reservations_size; |
| 2483 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 2489 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
| 2484 GetHeaderValue(kNumCodeStubKeysOffset)); | 2490 GetHeaderValue(kNumCodeStubKeysOffset)); |
| 2485 } | 2491 } |
| 2486 } } // namespace v8::internal | 2492 } } // namespace v8::internal |
| OLD | NEW |