| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "ic-inl.h" | 34 #include "ic-inl.h" |
| 35 #include "natives.h" | 35 #include "natives.h" |
| 36 #include "platform.h" | 36 #include "platform.h" |
| 37 #include "runtime.h" | 37 #include "runtime.h" |
| 38 #include "serialize.h" | 38 #include "serialize.h" |
| 39 #include "stub-cache.h" | 39 #include "stub-cache.h" |
| 40 #include "v8threads.h" | 40 #include "v8threads.h" |
| 41 | 41 |
| 42 namespace v8 { namespace internal { | 42 namespace v8 { namespace internal { |
| 43 | 43 |
| 44 #ifdef DEBUG | |
| 45 DEFINE_bool(debug_serialization, false, | |
| 46 "write debug information into the snapshot."); | |
| 47 #endif | |
| 48 | |
| 49 | |
| 50 // Encoding: a RelativeAddress must be able to fit in a pointer: | 44 // Encoding: a RelativeAddress must be able to fit in a pointer: |
| 51 // it is encoded as an Address with (from MS to LS bits): | 45 // it is encoded as an Address with (from MS to LS bits): |
| 52 // 27 bits identifying a word in the space, in one of three formats: | 46 // 27 bits identifying a word in the space, in one of three formats: |
| 53 // - MAP and OLD spaces: 16 bits of page number, 11 bits of word offset in page | 47 // - MAP and OLD spaces: 16 bits of page number, 11 bits of word offset in page |
| 54 // - NEW space: 27 bits of word offset | 48 // - NEW space: 27 bits of word offset |
| 55 // - LO space: 27 bits of page number | 49 // - LO space: 27 bits of page number |
| 56 // 3 bits to encode the AllocationSpace (special values for code in LO space) | 50 // 3 bits to encode the AllocationSpace (special values for code in LO space) |
| 57 // 2 bits identifying this as a HeapObject | 51 // 2 bits identifying this as a HeapObject |
| 58 | 52 |
| 59 const int kSpaceShift = kHeapObjectTagSize; | 53 const int kSpaceShift = kHeapObjectTagSize; |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 writer_->PutC('['); | 1008 writer_->PutC('['); |
| 1015 GlobalHandlesRetriever ghr(&global_handles_); | 1009 GlobalHandlesRetriever ghr(&global_handles_); |
| 1016 GlobalHandles::IterateRoots(&ghr); | 1010 GlobalHandles::IterateRoots(&ghr); |
| 1017 for (int i = 0; i < global_handles_.length(); i++) { | 1011 for (int i = 0; i < global_handles_.length(); i++) { |
| 1018 writer_->PutC('N'); | 1012 writer_->PutC('N'); |
| 1019 } | 1013 } |
| 1020 writer_->PutC(']'); | 1014 writer_->PutC(']'); |
| 1021 } | 1015 } |
| 1022 | 1016 |
| 1023 | 1017 |
| 1024 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 1025 DECLARE_bool(log_code); | |
| 1026 DECLARE_string(logfile); | |
| 1027 #endif | |
| 1028 | |
| 1029 | |
| 1030 void Serializer::PutLog() { | 1018 void Serializer::PutLog() { |
| 1031 #ifdef ENABLE_LOGGING_AND_PROFILING | 1019 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 1032 if (FLAG_log_code) { | 1020 if (FLAG_log_code) { |
| 1033 Logger::TearDown(); | 1021 Logger::TearDown(); |
| 1034 int pos = writer_->InsertC('L', flags_end_); | 1022 int pos = writer_->InsertC('L', flags_end_); |
| 1035 bool exists; | 1023 bool exists; |
| 1036 Vector<const char> log = ReadFile(FLAG_logfile, &exists); | 1024 Vector<const char> log = ReadFile(FLAG_logfile, &exists); |
| 1037 writer_->InsertString(log.start(), pos); | 1025 writer_->InsertString(log.start(), pos); |
| 1038 log.Dispose(); | 1026 log.Dispose(); |
| 1039 } | 1027 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 | 1282 |
| 1295 | 1283 |
| 1296 void Deserializer::VisitRuntimeEntry(RelocInfo* rinfo) { | 1284 void Deserializer::VisitRuntimeEntry(RelocInfo* rinfo) { |
| 1297 uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->pc()); | 1285 uint32_t* pc = reinterpret_cast<uint32_t*>(rinfo->pc()); |
| 1298 uint32_t encoding = *pc; | 1286 uint32_t encoding = *pc; |
| 1299 Address target = reference_decoder_->Decode(encoding); | 1287 Address target = reference_decoder_->Decode(encoding); |
| 1300 rinfo->set_target_address(target); | 1288 rinfo->set_target_address(target); |
| 1301 } | 1289 } |
| 1302 | 1290 |
| 1303 | 1291 |
| 1304 DECLARE_bool(use_ic); | |
| 1305 DECLARE_bool(debug_code); | |
| 1306 DECLARE_bool(lazy); | |
| 1307 | |
| 1308 void Deserializer::GetFlags() { | 1292 void Deserializer::GetFlags() { |
| 1309 reader_.ExpectC('F'); | 1293 reader_.ExpectC('F'); |
| 1310 int argc = reader_.GetInt() + 1; | 1294 int argc = reader_.GetInt() + 1; |
| 1311 char** argv = NewArray<char*>(argc); | 1295 char** argv = NewArray<char*>(argc); |
| 1312 reader_.ExpectC('['); | 1296 reader_.ExpectC('['); |
| 1313 for (int i = 1; i < argc; i++) { | 1297 for (int i = 1; i < argc; i++) { |
| 1314 if (i > 1) reader_.ExpectC('|'); | 1298 if (i > 1) reader_.ExpectC('|'); |
| 1315 argv[i] = reader_.GetString(); | 1299 argv[i] = reader_.GetString(); |
| 1316 } | 1300 } |
| 1317 reader_.ExpectC(']'); | 1301 reader_.ExpectC(']'); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 ASSERT(index < large_objects_.length()); | 1531 ASSERT(index < large_objects_.length()); |
| 1548 } | 1532 } |
| 1549 return large_objects_[index]; // s.page_offset() is ignored. | 1533 return large_objects_[index]; // s.page_offset() is ignored. |
| 1550 } | 1534 } |
| 1551 UNREACHABLE(); | 1535 UNREACHABLE(); |
| 1552 return NULL; | 1536 return NULL; |
| 1553 } | 1537 } |
| 1554 | 1538 |
| 1555 | 1539 |
| 1556 } } // namespace v8::internal | 1540 } } // namespace v8::internal |
| OLD | NEW |