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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 const v8::HeapGraphNode* parent = | 416 const v8::HeapGraphNode* parent = |
417 GetProperty(child_string, v8::HeapGraphEdge::kInternal, "parent"); | 417 GetProperty(child_string, v8::HeapGraphEdge::kInternal, "parent"); |
418 CHECK_EQ(parent_string, parent); | 418 CHECK_EQ(parent_string, parent); |
419 heap_profiler->DeleteAllHeapSnapshots(); | 419 heap_profiler->DeleteAllHeapSnapshots(); |
420 } | 420 } |
421 | 421 |
422 | 422 |
423 TEST(HeapSnapshotConsString) { | 423 TEST(HeapSnapshotConsString) { |
424 v8::Isolate* isolate = CcTest::isolate(); | 424 v8::Isolate* isolate = CcTest::isolate(); |
425 v8::HandleScope scope(isolate); | 425 v8::HandleScope scope(isolate); |
426 v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 426 v8::Local<v8::ObjectTemplate> global_template = |
| 427 v8::ObjectTemplate::New(isolate); |
427 global_template->SetInternalFieldCount(1); | 428 global_template->SetInternalFieldCount(1); |
428 LocalContext env(NULL, global_template); | 429 LocalContext env(NULL, global_template); |
429 v8::Handle<v8::Object> global_proxy = env->Global(); | 430 v8::Handle<v8::Object> global_proxy = env->Global(); |
430 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 431 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
431 CHECK_EQ(1, global->InternalFieldCount()); | 432 CHECK_EQ(1, global->InternalFieldCount()); |
432 | 433 |
433 i::Factory* factory = CcTest::i_isolate()->factory(); | 434 i::Factory* factory = CcTest::i_isolate()->factory(); |
434 i::Handle<i::String> first = | 435 i::Handle<i::String> first = |
435 factory->NewStringFromAscii(i::CStrVector("0123456789")); | 436 factory->NewStringFromAscii(i::CStrVector("0123456789")); |
436 i::Handle<i::String> second = | 437 i::Handle<i::String> second = |
(...skipping 22 matching lines...) Expand all Loading... |
459 CHECK_EQ(v8::HeapGraphNode::kString, second_node->GetType()); | 460 CHECK_EQ(v8::HeapGraphNode::kString, second_node->GetType()); |
460 | 461 |
461 heap_profiler->DeleteAllHeapSnapshots(); | 462 heap_profiler->DeleteAllHeapSnapshots(); |
462 } | 463 } |
463 | 464 |
464 | 465 |
465 | 466 |
466 TEST(HeapSnapshotInternalReferences) { | 467 TEST(HeapSnapshotInternalReferences) { |
467 v8::Isolate* isolate = CcTest::isolate(); | 468 v8::Isolate* isolate = CcTest::isolate(); |
468 v8::HandleScope scope(isolate); | 469 v8::HandleScope scope(isolate); |
469 v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); | 470 v8::Local<v8::ObjectTemplate> global_template = |
| 471 v8::ObjectTemplate::New(isolate); |
470 global_template->SetInternalFieldCount(2); | 472 global_template->SetInternalFieldCount(2); |
471 LocalContext env(NULL, global_template); | 473 LocalContext env(NULL, global_template); |
472 v8::Handle<v8::Object> global_proxy = env->Global(); | 474 v8::Handle<v8::Object> global_proxy = env->Global(); |
473 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 475 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
474 CHECK_EQ(2, global->InternalFieldCount()); | 476 CHECK_EQ(2, global->InternalFieldCount()); |
475 v8::Local<v8::Object> obj = v8::Object::New(isolate); | 477 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
476 global->SetInternalField(0, v8_num(17)); | 478 global->SetInternalField(0, v8_num(17)); |
477 global->SetInternalField(1, obj); | 479 global->SetInternalField(1, obj); |
478 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | 480 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
479 const v8::HeapSnapshot* snapshot = | 481 const v8::HeapSnapshot* snapshot = |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2361 | 2363 |
2362 AllocationTraceNode* node = | 2364 AllocationTraceNode* node = |
2363 FindNode(tracker, Vector<const char*>(names, ARRAY_SIZE(names))); | 2365 FindNode(tracker, Vector<const char*>(names, ARRAY_SIZE(names))); |
2364 CHECK_NE(NULL, node); | 2366 CHECK_NE(NULL, node); |
2365 CHECK_LT(node->allocation_count(), 100); | 2367 CHECK_LT(node->allocation_count(), 100); |
2366 | 2368 |
2367 CcTest::heap()->DisableInlineAllocation(); | 2369 CcTest::heap()->DisableInlineAllocation(); |
2368 heap_profiler->StopTrackingHeapObjects(); | 2370 heap_profiler->StopTrackingHeapObjects(); |
2369 } | 2371 } |
2370 } | 2372 } |
OLD | NEW |