| 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 28 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
| 29 #include <bzlib.h> | 29 #include <bzlib.h> |
| 30 #endif | 30 #endif |
| 31 #include <signal.h> | 31 #include <signal.h> |
| 32 #include <string> | |
| 33 #include <map> | |
| 34 | 32 |
| 35 #include "v8.h" | 33 #include "v8.h" |
| 36 | 34 |
| 37 #include "bootstrapper.h" | 35 #include "bootstrapper.h" |
| 38 #include "natives.h" | 36 #include "natives.h" |
| 39 #include "platform.h" | 37 #include "platform.h" |
| 40 #include "serialize.h" | 38 #include "serialize.h" |
| 41 #include "list.h" | 39 #include "list.h" |
| 42 | 40 |
| 43 using namespace v8; | 41 using namespace v8; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 77 } |
| 80 private: | 78 private: |
| 81 uint32_t magic_number_; | 79 uint32_t magic_number_; |
| 82 uint32_t max_counters_; | 80 uint32_t max_counters_; |
| 83 uint32_t max_name_size_; | 81 uint32_t max_name_size_; |
| 84 uint32_t counters_in_use_; | 82 uint32_t counters_in_use_; |
| 85 Counter counters_[kMaxCounters]; | 83 Counter counters_[kMaxCounters]; |
| 86 }; | 84 }; |
| 87 | 85 |
| 88 | 86 |
| 89 // We statically allocate a set of local counters to be used if we | |
| 90 // don't want to store the stats in a memory-mapped file | |
| 91 static CounterCollection local_counters; | |
| 92 | |
| 93 | |
| 94 typedef std::map<std::string, int*> CounterMap; | |
| 95 typedef std::map<std::string, int*>::iterator CounterMapIterator; | |
| 96 static CounterMap counter_table_; | |
| 97 | |
| 98 | |
| 99 class Compressor { | 87 class Compressor { |
| 100 public: | 88 public: |
| 101 virtual ~Compressor() {} | 89 virtual ~Compressor() {} |
| 102 virtual bool Compress(i::Vector<char> input) = 0; | 90 virtual bool Compress(i::Vector<char> input) = 0; |
| 103 virtual i::Vector<char>* output() = 0; | 91 virtual i::Vector<char>* output() = 0; |
| 104 }; | 92 }; |
| 105 | 93 |
| 106 | 94 |
| 107 class PartialSnapshotSink : public i::SnapshotByteSink { | 95 class PartialSnapshotSink : public i::SnapshotByteSink { |
| 108 public: | 96 public: |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 sink.WriteSpaceUsed( | 339 sink.WriteSpaceUsed( |
| 352 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), | 340 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), |
| 353 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 341 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
| 354 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 342 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
| 355 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), | 343 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), |
| 356 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), | 344 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), |
| 357 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), | 345 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), |
| 358 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); | 346 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); |
| 359 return 0; | 347 return 0; |
| 360 } | 348 } |
| OLD | NEW |