| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 for (int i = 0; i < entries.length(); ++i) { | 153 for (int i = 0; i < entries.length(); ++i) { |
| 154 i::HashMap::Entry* entry = visited.Lookup( | 154 i::HashMap::Entry* entry = visited.Lookup( |
| 155 reinterpret_cast<void*>(&entries[i]), | 155 reinterpret_cast<void*>(&entries[i]), |
| 156 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&entries[i])), | 156 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(&entries[i])), |
| 157 false); | 157 false); |
| 158 if (!entry && entries[i].id() != 1) { | 158 if (!entry && entries[i].id() != 1) { |
| 159 entries[i].Print("entry with no retainer", "", depth, 0); | 159 entries[i].Print("entry with no retainer", "", depth, 0); |
| 160 ++unretained_entries_count; | 160 ++unretained_entries_count; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 return unretained_entries_count > 1 ? false : true; | 163 return unretained_entries_count == 0; |
| 164 } | 164 } |
| 165 | 165 |
| 166 | 166 |
| 167 TEST(HeapSnapshot) { | 167 TEST(HeapSnapshot) { |
| 168 LocalContext env2; | 168 LocalContext env2; |
| 169 v8::HandleScope scope(env2->GetIsolate()); | 169 v8::HandleScope scope(env2->GetIsolate()); |
| 170 v8::HeapProfiler* heap_profiler = env2->GetIsolate()->GetHeapProfiler(); | 170 v8::HeapProfiler* heap_profiler = env2->GetIsolate()->GetHeapProfiler(); |
| 171 | 171 |
| 172 CompileRun( | 172 CompileRun( |
| 173 "function A2() {}\n" | 173 "function A2() {}\n" |
| (...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 | 1956 |
| 1957 CHECK(transition_info->GetHeapValue()->IsArray()); | 1957 CHECK(transition_info->GetHeapValue()->IsArray()); |
| 1958 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast( | 1958 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast( |
| 1959 transition_info->GetHeapValue()); | 1959 transition_info->GetHeapValue()); |
| 1960 // Verify the array is "a" in the code above. | 1960 // Verify the array is "a" in the code above. |
| 1961 CHECK_EQ(3, array->Length()); | 1961 CHECK_EQ(3, array->Length()); |
| 1962 CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0))); | 1962 CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0))); |
| 1963 CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1))); | 1963 CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1))); |
| 1964 CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2))); | 1964 CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2))); |
| 1965 } | 1965 } |
| OLD | NEW |