| 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 CHECK(ValidateSnapshot(snapshot)); | 739 CHECK(ValidateSnapshot(snapshot)); |
| 740 | 740 |
| 741 TestJSONStream stream; | 741 TestJSONStream stream; |
| 742 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); | 742 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); |
| 743 CHECK_GT(stream.size(), 0); | 743 CHECK_GT(stream.size(), 0); |
| 744 CHECK_EQ(1, stream.eos_signaled()); | 744 CHECK_EQ(1, stream.eos_signaled()); |
| 745 i::ScopedVector<char> json(stream.size()); | 745 i::ScopedVector<char> json(stream.size()); |
| 746 stream.WriteTo(json); | 746 stream.WriteTo(json); |
| 747 | 747 |
| 748 // Verify that snapshot string is valid JSON. | 748 // Verify that snapshot string is valid JSON. |
| 749 AsciiResource json_res(json); | 749 AsciiResource* json_res = new AsciiResource(json); |
| 750 v8::Local<v8::String> json_string = | 750 v8::Local<v8::String> json_string = |
| 751 v8::String::NewExternal(env->GetIsolate(), &json_res); | 751 v8::String::NewExternal(env->GetIsolate(), json_res); |
| 752 env->Global()->Set(v8_str("json_snapshot"), json_string); | 752 env->Global()->Set(v8_str("json_snapshot"), json_string); |
| 753 v8::Local<v8::Value> snapshot_parse_result = CompileRun( | 753 v8::Local<v8::Value> snapshot_parse_result = CompileRun( |
| 754 "var parsed = JSON.parse(json_snapshot); true;"); | 754 "var parsed = JSON.parse(json_snapshot); true;"); |
| 755 CHECK(!snapshot_parse_result.IsEmpty()); | 755 CHECK(!snapshot_parse_result.IsEmpty()); |
| 756 | 756 |
| 757 // Verify that snapshot object has required fields. | 757 // Verify that snapshot object has required fields. |
| 758 v8::Local<v8::Object> parsed_snapshot = | 758 v8::Local<v8::Object> parsed_snapshot = |
| 759 env->Global()->Get(v8_str("parsed"))->ToObject(); | 759 env->Global()->Get(v8_str("parsed"))->ToObject(); |
| 760 CHECK(parsed_snapshot->Has(v8_str("snapshot"))); | 760 CHECK(parsed_snapshot->Has(v8_str("snapshot"))); |
| 761 CHECK(parsed_snapshot->Has(v8_str("nodes"))); | 761 CHECK(parsed_snapshot->Has(v8_str("nodes"))); |
| (...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2376 const v8::HeapGraphNode* arr1_obj = | 2376 const v8::HeapGraphNode* arr1_obj = |
| 2377 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); | 2377 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); |
| 2378 CHECK_NE(NULL, arr1_obj); | 2378 CHECK_NE(NULL, arr1_obj); |
| 2379 const v8::HeapGraphNode* arr1_buffer = | 2379 const v8::HeapGraphNode* arr1_buffer = |
| 2380 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); | 2380 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); |
| 2381 CHECK_NE(NULL, arr1_buffer); | 2381 CHECK_NE(NULL, arr1_buffer); |
| 2382 const v8::HeapGraphNode* first_view = | 2382 const v8::HeapGraphNode* first_view = |
| 2383 GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); | 2383 GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); |
| 2384 CHECK_NE(NULL, first_view); | 2384 CHECK_NE(NULL, first_view); |
| 2385 } | 2385 } |
| OLD | NEW |