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 2365 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 } |
2386 | |
2387 | |
2388 TEST(BoxObject) { | |
2389 v8::Isolate* isolate = CcTest::isolate(); | |
2390 v8::HandleScope scope(isolate); | |
2391 v8::Local<v8::ObjectTemplate> global_template = | |
2392 v8::ObjectTemplate::New(isolate); | |
2393 global_template->SetInternalFieldCount(1); | |
2394 LocalContext env(NULL, global_template); | |
2395 v8::Handle<v8::Object> global_proxy = env->Global(); | |
2396 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | |
2397 CHECK_EQ(1, global->InternalFieldCount()); | |
yurys
2014/02/03 09:26:27
Do you really need this check in this test?
alph
2014/02/04 09:41:54
Done.
| |
2398 | |
2399 i::Factory* factory = CcTest::i_isolate()->factory(); | |
2400 i::Handle<i::String> string = | |
2401 factory->NewStringFromAscii(i::CStrVector("string")); | |
2402 i::Handle<i::Object> box = factory->NewBox(string); | |
2403 global->Set(0, v8::ToApiHandle<v8::Object>(box)); | |
2404 | |
2405 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | |
2406 const v8::HeapSnapshot* snapshot = | |
2407 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | |
2408 CHECK(ValidateSnapshot(snapshot)); | |
2409 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); | |
2410 const v8::HeapGraphNode* box_node = | |
2411 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); | |
2412 CHECK_NE(NULL, box_node); | |
2413 v8::String::Utf8Value box_node_name(box_node->GetName()); | |
2414 CHECK_EQ("system / Box", *box_node_name); | |
2415 const v8::HeapGraphNode* box_value = | |
2416 GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); | |
2417 CHECK_NE(NULL, box_value); | |
2418 } | |
OLD | NEW |