| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 virtual void EndOfStream() { ++eos_signaled_; } | 855 virtual void EndOfStream() { ++eos_signaled_; } |
| 856 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { | 856 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { |
| 857 if (abort_countdown_ > 0) --abort_countdown_; | 857 if (abort_countdown_ > 0) --abort_countdown_; |
| 858 if (abort_countdown_ == 0) return kAbort; | 858 if (abort_countdown_ == 0) return kAbort; |
| 859 CHECK_GT(chars_written, 0); | 859 CHECK_GT(chars_written, 0); |
| 860 i::Vector<char> chunk = buffer_.AddBlock(chars_written, '\0'); | 860 i::Vector<char> chunk = buffer_.AddBlock(chars_written, '\0'); |
| 861 i::MemCopy(chunk.start(), buffer, chars_written); | 861 i::MemCopy(chunk.start(), buffer, chars_written); |
| 862 return kContinue; | 862 return kContinue; |
| 863 } | 863 } |
| 864 virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) { | 864 virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) { |
| 865 DCHECK(false); | 865 CHECK(false); |
| 866 return kAbort; | 866 return kAbort; |
| 867 } | 867 } |
| 868 void WriteTo(i::Vector<char> dest) { buffer_.WriteTo(dest); } | 868 void WriteTo(i::Vector<char> dest) { buffer_.WriteTo(dest); } |
| 869 int eos_signaled() { return eos_signaled_; } | 869 int eos_signaled() { return eos_signaled_; } |
| 870 int size() { return buffer_.size(); } | 870 int size() { return buffer_.size(); } |
| 871 | 871 |
| 872 private: | 872 private: |
| 873 i::Collector<char> buffer_; | 873 i::Collector<char> buffer_; |
| 874 int eos_signaled_; | 874 int eos_signaled_; |
| 875 int abort_countdown_; | 875 int abort_countdown_; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 : v8::OutputStream(stream), | 1024 : v8::OutputStream(stream), |
| 1025 eos_signaled_(stream.eos_signaled_), | 1025 eos_signaled_(stream.eos_signaled_), |
| 1026 updates_written_(stream.updates_written_), | 1026 updates_written_(stream.updates_written_), |
| 1027 entries_count_(stream.entries_count_), | 1027 entries_count_(stream.entries_count_), |
| 1028 entries_size_(stream.entries_size_), | 1028 entries_size_(stream.entries_size_), |
| 1029 intervals_count_(stream.intervals_count_), | 1029 intervals_count_(stream.intervals_count_), |
| 1030 first_interval_index_(stream.first_interval_index_) { } | 1030 first_interval_index_(stream.first_interval_index_) { } |
| 1031 virtual ~TestStatsStream() {} | 1031 virtual ~TestStatsStream() {} |
| 1032 virtual void EndOfStream() { ++eos_signaled_; } | 1032 virtual void EndOfStream() { ++eos_signaled_; } |
| 1033 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { | 1033 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { |
| 1034 DCHECK(false); | 1034 CHECK(false); |
| 1035 return kAbort; | 1035 return kAbort; |
| 1036 } | 1036 } |
| 1037 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, | 1037 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, |
| 1038 int updates_written) { | 1038 int updates_written) { |
| 1039 ++intervals_count_; | 1039 ++intervals_count_; |
| 1040 DCHECK(updates_written); | 1040 CHECK(updates_written); |
| 1041 updates_written_ += updates_written; | 1041 updates_written_ += updates_written; |
| 1042 entries_count_ = 0; | 1042 entries_count_ = 0; |
| 1043 if (first_interval_index_ == -1 && updates_written != 0) | 1043 if (first_interval_index_ == -1 && updates_written != 0) |
| 1044 first_interval_index_ = buffer[0].index; | 1044 first_interval_index_ = buffer[0].index; |
| 1045 for (int i = 0; i < updates_written; ++i) { | 1045 for (int i = 0; i < updates_written; ++i) { |
| 1046 entries_count_ += buffer[i].count; | 1046 entries_count_ += buffer[i].count; |
| 1047 entries_size_ += buffer[i].size; | 1047 entries_size_ += buffer[i].size; |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 return kContinue; | 1050 return kContinue; |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | 2645 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
| 2646 | 2646 |
| 2647 v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 1024); | 2647 v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 1024); |
| 2648 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); | 2648 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); |
| 2649 CHECK(!ab->IsExternal()); | 2649 CHECK(!ab->IsExternal()); |
| 2650 v8::ArrayBuffer::Contents ab_contents = ab->Externalize(); | 2650 v8::ArrayBuffer::Contents ab_contents = ab->Externalize(); |
| 2651 CHECK(ab->IsExternal()); | 2651 CHECK(ab->IsExternal()); |
| 2652 | 2652 |
| 2653 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); | 2653 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); |
| 2654 void* data = ab_contents.Data(); | 2654 void* data = ab_contents.Data(); |
| 2655 DCHECK(data != NULL); | 2655 CHECK(data != NULL); |
| 2656 v8::Local<v8::ArrayBuffer> ab2 = | 2656 v8::Local<v8::ArrayBuffer> ab2 = |
| 2657 v8::ArrayBuffer::New(isolate, data, ab_contents.ByteLength()); | 2657 v8::ArrayBuffer::New(isolate, data, ab_contents.ByteLength()); |
| 2658 CHECK(ab2->IsExternal()); | 2658 CHECK(ab2->IsExternal()); |
| 2659 env->Global()->Set(v8_str("ab1"), ab); | 2659 env->Global()->Set(v8_str("ab1"), ab); |
| 2660 env->Global()->Set(v8_str("ab2"), ab2); | 2660 env->Global()->Set(v8_str("ab2"), ab2); |
| 2661 | 2661 |
| 2662 v8::Handle<v8::Value> result = CompileRun("ab2.byteLength"); | 2662 v8::Handle<v8::Value> result = CompileRun("ab2.byteLength"); |
| 2663 CHECK_EQ(1024, result->Int32Value()); | 2663 CHECK_EQ(1024, result->Int32Value()); |
| 2664 | 2664 |
| 2665 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); | 2665 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2795 map.AddRange(ToAddress(0x180), 0x80, 6U); |
| 2796 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2796 map.AddRange(ToAddress(0x180), 0x80, 7U); |
| 2797 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); | 2797 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); |
| 2798 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); | 2798 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
| 2799 CHECK_EQ(3u, map.size()); | 2799 CHECK_EQ(3u, map.size()); |
| 2800 | 2800 |
| 2801 map.Clear(); | 2801 map.Clear(); |
| 2802 CHECK_EQ(0u, map.size()); | 2802 CHECK_EQ(0u, map.size()); |
| 2803 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); | 2803 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); |
| 2804 } | 2804 } |
| OLD | NEW |