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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 virtual void EndOfStream() { ++eos_signaled_; } | 861 virtual void EndOfStream() { ++eos_signaled_; } |
862 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { | 862 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { |
863 if (abort_countdown_ > 0) --abort_countdown_; | 863 if (abort_countdown_ > 0) --abort_countdown_; |
864 if (abort_countdown_ == 0) return kAbort; | 864 if (abort_countdown_ == 0) return kAbort; |
865 CHECK_GT(chars_written, 0); | 865 CHECK_GT(chars_written, 0); |
866 i::Vector<char> chunk = buffer_.AddBlock(chars_written, '\0'); | 866 i::Vector<char> chunk = buffer_.AddBlock(chars_written, '\0'); |
867 i::MemCopy(chunk.start(), buffer, chars_written); | 867 i::MemCopy(chunk.start(), buffer, chars_written); |
868 return kContinue; | 868 return kContinue; |
869 } | 869 } |
870 virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) { | 870 virtual WriteResult WriteUint32Chunk(uint32_t* buffer, int chars_written) { |
871 ASSERT(false); | 871 DCHECK(false); |
872 return kAbort; | 872 return kAbort; |
873 } | 873 } |
874 void WriteTo(i::Vector<char> dest) { buffer_.WriteTo(dest); } | 874 void WriteTo(i::Vector<char> dest) { buffer_.WriteTo(dest); } |
875 int eos_signaled() { return eos_signaled_; } | 875 int eos_signaled() { return eos_signaled_; } |
876 int size() { return buffer_.size(); } | 876 int size() { return buffer_.size(); } |
877 | 877 |
878 private: | 878 private: |
879 i::Collector<char> buffer_; | 879 i::Collector<char> buffer_; |
880 int eos_signaled_; | 880 int eos_signaled_; |
881 int abort_countdown_; | 881 int abort_countdown_; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 : v8::OutputStream(stream), | 1030 : v8::OutputStream(stream), |
1031 eos_signaled_(stream.eos_signaled_), | 1031 eos_signaled_(stream.eos_signaled_), |
1032 updates_written_(stream.updates_written_), | 1032 updates_written_(stream.updates_written_), |
1033 entries_count_(stream.entries_count_), | 1033 entries_count_(stream.entries_count_), |
1034 entries_size_(stream.entries_size_), | 1034 entries_size_(stream.entries_size_), |
1035 intervals_count_(stream.intervals_count_), | 1035 intervals_count_(stream.intervals_count_), |
1036 first_interval_index_(stream.first_interval_index_) { } | 1036 first_interval_index_(stream.first_interval_index_) { } |
1037 virtual ~TestStatsStream() {} | 1037 virtual ~TestStatsStream() {} |
1038 virtual void EndOfStream() { ++eos_signaled_; } | 1038 virtual void EndOfStream() { ++eos_signaled_; } |
1039 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { | 1039 virtual WriteResult WriteAsciiChunk(char* buffer, int chars_written) { |
1040 ASSERT(false); | 1040 DCHECK(false); |
1041 return kAbort; | 1041 return kAbort; |
1042 } | 1042 } |
1043 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, | 1043 virtual WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* buffer, |
1044 int updates_written) { | 1044 int updates_written) { |
1045 ++intervals_count_; | 1045 ++intervals_count_; |
1046 ASSERT(updates_written); | 1046 DCHECK(updates_written); |
1047 updates_written_ += updates_written; | 1047 updates_written_ += updates_written; |
1048 entries_count_ = 0; | 1048 entries_count_ = 0; |
1049 if (first_interval_index_ == -1 && updates_written != 0) | 1049 if (first_interval_index_ == -1 && updates_written != 0) |
1050 first_interval_index_ = buffer[0].index; | 1050 first_interval_index_ = buffer[0].index; |
1051 for (int i = 0; i < updates_written; ++i) { | 1051 for (int i = 0; i < updates_written; ++i) { |
1052 entries_count_ += buffer[i].count; | 1052 entries_count_ += buffer[i].count; |
1053 entries_size_ += buffer[i].size; | 1053 entries_size_ += buffer[i].size; |
1054 } | 1054 } |
1055 | 1055 |
1056 return kContinue; | 1056 return kContinue; |
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | 2610 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
2611 | 2611 |
2612 v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 1024); | 2612 v8::Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 1024); |
2613 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); | 2613 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); |
2614 CHECK(!ab->IsExternal()); | 2614 CHECK(!ab->IsExternal()); |
2615 v8::ArrayBuffer::Contents ab_contents = ab->Externalize(); | 2615 v8::ArrayBuffer::Contents ab_contents = ab->Externalize(); |
2616 CHECK(ab->IsExternal()); | 2616 CHECK(ab->IsExternal()); |
2617 | 2617 |
2618 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); | 2618 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); |
2619 void* data = ab_contents.Data(); | 2619 void* data = ab_contents.Data(); |
2620 ASSERT(data != NULL); | 2620 DCHECK(data != NULL); |
2621 v8::Local<v8::ArrayBuffer> ab2 = | 2621 v8::Local<v8::ArrayBuffer> ab2 = |
2622 v8::ArrayBuffer::New(isolate, data, ab_contents.ByteLength()); | 2622 v8::ArrayBuffer::New(isolate, data, ab_contents.ByteLength()); |
2623 CHECK(ab2->IsExternal()); | 2623 CHECK(ab2->IsExternal()); |
2624 env->Global()->Set(v8_str("ab1"), ab); | 2624 env->Global()->Set(v8_str("ab1"), ab); |
2625 env->Global()->Set(v8_str("ab2"), ab2); | 2625 env->Global()->Set(v8_str("ab2"), ab2); |
2626 | 2626 |
2627 v8::Handle<v8::Value> result = CompileRun("ab2.byteLength"); | 2627 v8::Handle<v8::Value> result = CompileRun("ab2.byteLength"); |
2628 CHECK_EQ(1024, result->Int32Value()); | 2628 CHECK_EQ(1024, result->Int32Value()); |
2629 | 2629 |
2630 const v8::HeapSnapshot* snapshot = | 2630 const v8::HeapSnapshot* snapshot = |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2763 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2764 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2764 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2765 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); | 2765 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
2766 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2766 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
2767 CHECK_EQ(3, static_cast<int>(map.size())); | 2767 CHECK_EQ(3, static_cast<int>(map.size())); |
2768 | 2768 |
2769 map.Clear(); | 2769 map.Clear(); |
2770 CHECK_EQ(0, static_cast<int>(map.size())); | 2770 CHECK_EQ(0, static_cast<int>(map.size())); |
2771 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); | 2771 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
2772 } | 2772 } |
OLD | NEW |