| 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> |
| 32 | 34 |
| 33 #include "v8.h" | 35 #include "v8.h" |
| 34 | 36 |
| 35 #include "bootstrapper.h" | 37 #include "bootstrapper.h" |
| 36 #include "natives.h" | 38 #include "natives.h" |
| 37 #include "platform.h" | 39 #include "platform.h" |
| 38 #include "serialize.h" | 40 #include "serialize.h" |
| 39 #include "list.h" | 41 #include "list.h" |
| 40 | 42 |
| 41 using namespace v8; | 43 using namespace v8; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 79 } |
| 78 private: | 80 private: |
| 79 uint32_t magic_number_; | 81 uint32_t magic_number_; |
| 80 uint32_t max_counters_; | 82 uint32_t max_counters_; |
| 81 uint32_t max_name_size_; | 83 uint32_t max_name_size_; |
| 82 uint32_t counters_in_use_; | 84 uint32_t counters_in_use_; |
| 83 Counter counters_[kMaxCounters]; | 85 Counter counters_[kMaxCounters]; |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 | 88 |
| 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 |
| 87 class Compressor { | 99 class Compressor { |
| 88 public: | 100 public: |
| 89 virtual ~Compressor() {} | 101 virtual ~Compressor() {} |
| 90 virtual bool Compress(i::Vector<char> input) = 0; | 102 virtual bool Compress(i::Vector<char> input) = 0; |
| 91 virtual i::Vector<char>* output() = 0; | 103 virtual i::Vector<char>* output() = 0; |
| 92 }; | 104 }; |
| 93 | 105 |
| 94 | 106 |
| 95 class PartialSnapshotSink : public i::SnapshotByteSink { | 107 class PartialSnapshotSink : public i::SnapshotByteSink { |
| 96 public: | 108 public: |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 sink.WriteSpaceUsed( | 351 sink.WriteSpaceUsed( |
| 340 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), | 352 partial_ser.CurrentAllocationAddress(i::NEW_SPACE), |
| 341 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), | 353 partial_ser.CurrentAllocationAddress(i::OLD_POINTER_SPACE), |
| 342 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), | 354 partial_ser.CurrentAllocationAddress(i::OLD_DATA_SPACE), |
| 343 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), | 355 partial_ser.CurrentAllocationAddress(i::CODE_SPACE), |
| 344 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), | 356 partial_ser.CurrentAllocationAddress(i::MAP_SPACE), |
| 345 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), | 357 partial_ser.CurrentAllocationAddress(i::CELL_SPACE), |
| 346 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); | 358 partial_ser.CurrentAllocationAddress(i::LO_SPACE)); |
| 347 return 0; | 359 return 0; |
| 348 } | 360 } |
| OLD | NEW |