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 1396 matching lines...) Loading... |
1407 CHECK(js_obj == obj->GetHeapValue()); | 1407 CHECK(js_obj == obj->GetHeapValue()); |
1408 const v8::HeapGraphNode* s_prop = | 1408 const v8::HeapGraphNode* s_prop = |
1409 GetProperty(obj, v8::HeapGraphEdge::kProperty, "s_prop"); | 1409 GetProperty(obj, v8::HeapGraphEdge::kProperty, "s_prop"); |
1410 v8::Local<v8::String> js_s_prop = | 1410 v8::Local<v8::String> js_s_prop = |
1411 js_obj->Get(v8_str("s_prop")).As<v8::String>(); | 1411 js_obj->Get(v8_str("s_prop")).As<v8::String>(); |
1412 CHECK(js_s_prop == s_prop->GetHeapValue()); | 1412 CHECK(js_s_prop == s_prop->GetHeapValue()); |
1413 const v8::HeapGraphNode* n_prop = | 1413 const v8::HeapGraphNode* n_prop = |
1414 GetProperty(obj, v8::HeapGraphEdge::kProperty, "n_prop"); | 1414 GetProperty(obj, v8::HeapGraphEdge::kProperty, "n_prop"); |
1415 v8::Local<v8::Number> js_n_prop = | 1415 v8::Local<v8::Number> js_n_prop = |
1416 js_obj->Get(v8_str("n_prop")).As<v8::Number>(); | 1416 js_obj->Get(v8_str("n_prop")).As<v8::Number>(); |
1417 CHECK(js_n_prop == n_prop->GetHeapValue()); | 1417 CHECK(js_n_prop->NumberValue() == n_prop->GetHeapValue()->NumberValue()); |
1418 } | 1418 } |
1419 | 1419 |
1420 | 1420 |
1421 TEST(GetHeapValueForDeletedObject) { | 1421 TEST(GetHeapValueForDeletedObject) { |
1422 LocalContext env; | 1422 LocalContext env; |
1423 v8::HandleScope scope(env->GetIsolate()); | 1423 v8::HandleScope scope(env->GetIsolate()); |
1424 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 1424 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
1425 | 1425 |
1426 // It is impossible to delete a global property, so we are about to delete a | 1426 // It is impossible to delete a global property, so we are about to delete a |
1427 // property of the "a" object. Also, the "p" object can't be an empty one | 1427 // property of the "a" object. Also, the "p" object can't be an empty one |
(...skipping 349 matching lines...) Loading... |
1777 // Check all the objects have got their names. | 1777 // Check all the objects have got their names. |
1778 // ... well check just every 8th because otherwise it's too slow in debug. | 1778 // ... well check just every 8th because otherwise it's too slow in debug. |
1779 for (int i = 0; i < num_objects - 1; i += 8) { | 1779 for (int i = 0; i < num_objects - 1; i += 8) { |
1780 i::EmbeddedVector<char, 100> var_name; | 1780 i::EmbeddedVector<char, 100> var_name; |
1781 i::OS::SNPrintF(var_name, "f_%d", i); | 1781 i::OS::SNPrintF(var_name, "f_%d", i); |
1782 const v8::HeapGraphNode* f_object = GetProperty( | 1782 const v8::HeapGraphNode* f_object = GetProperty( |
1783 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); | 1783 context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); |
1784 CHECK_NE(NULL, f_object); | 1784 CHECK_NE(NULL, f_object); |
1785 } | 1785 } |
1786 } | 1786 } |
OLD | NEW |