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 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 delete data.GetParameter(); | 1848 delete data.GetParameter(); |
1849 } | 1849 } |
1850 | 1850 |
1851 | 1851 |
1852 TEST(WeakGlobalHandle) { | 1852 TEST(WeakGlobalHandle) { |
1853 LocalContext env; | 1853 LocalContext env; |
1854 v8::HandleScope scope(env->GetIsolate()); | 1854 v8::HandleScope scope(env->GetIsolate()); |
1855 | 1855 |
1856 CHECK(!HasWeakGlobalHandle()); | 1856 CHECK(!HasWeakGlobalHandle()); |
1857 | 1857 |
1858 v8::Persistent<v8::Object>* handle = | 1858 v8::Persistent<v8::Object> handle(env->GetIsolate(), |
1859 new v8::Persistent<v8::Object>(env->GetIsolate(), | 1859 v8::Object::New(env->GetIsolate())); |
1860 v8::Object::New(env->GetIsolate())); | 1860 handle.SetWeak(&handle, PersistentHandleCallback); |
1861 handle->SetWeak(handle, PersistentHandleCallback); | |
1862 | 1861 |
1863 CHECK(HasWeakGlobalHandle()); | 1862 CHECK(HasWeakGlobalHandle()); |
1864 } | 1863 } |
1865 | 1864 |
1866 | 1865 |
1867 TEST(SfiAndJsFunctionWeakRefs) { | 1866 TEST(SfiAndJsFunctionWeakRefs) { |
1868 LocalContext env; | 1867 LocalContext env; |
1869 v8::HandleScope scope(env->GetIsolate()); | 1868 v8::HandleScope scope(env->GetIsolate()); |
1870 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 1869 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
1871 | 1870 |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); | 2404 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
2406 const v8::HeapGraphNode* box_node = | 2405 const v8::HeapGraphNode* box_node = |
2407 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); | 2406 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); |
2408 CHECK_NE(NULL, box_node); | 2407 CHECK_NE(NULL, box_node); |
2409 v8::String::Utf8Value box_node_name(box_node->GetName()); | 2408 v8::String::Utf8Value box_node_name(box_node->GetName()); |
2410 CHECK_EQ("system / Box", *box_node_name); | 2409 CHECK_EQ("system / Box", *box_node_name); |
2411 const v8::HeapGraphNode* box_value = | 2410 const v8::HeapGraphNode* box_value = |
2412 GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); | 2411 GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); |
2413 CHECK_NE(NULL, box_value); | 2412 CHECK_NE(NULL, box_value); |
2414 } | 2413 } |
OLD | NEW |