| 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 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); | 2470 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
| 2471 const v8::HeapGraphNode* box_node = | 2471 const v8::HeapGraphNode* box_node = |
| 2472 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); | 2472 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); |
| 2473 CHECK_NE(NULL, box_node); | 2473 CHECK_NE(NULL, box_node); |
| 2474 v8::String::Utf8Value box_node_name(box_node->GetName()); | 2474 v8::String::Utf8Value box_node_name(box_node->GetName()); |
| 2475 CHECK_EQ("system / Box", *box_node_name); | 2475 CHECK_EQ("system / Box", *box_node_name); |
| 2476 const v8::HeapGraphNode* box_value = | 2476 const v8::HeapGraphNode* box_value = |
| 2477 GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); | 2477 GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); |
| 2478 CHECK_NE(NULL, box_value); | 2478 CHECK_NE(NULL, box_value); |
| 2479 } | 2479 } |
| 2480 |
| 2481 |
| 2482 TEST(JSObjectHiddenProperty) { |
| 2483 LocalContext env; |
| 2484 v8::Isolate* isolate = env->GetIsolate(); |
| 2485 v8::HandleScope handle_scope(isolate); |
| 2486 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
| 2487 |
| 2488 v8::Local<v8::Object> an_object = v8::Object::New(isolate); |
| 2489 env->Global()->Set(v8_str("an_object"), an_object); |
| 2490 CHECK(an_object->SetHiddenValue(v8_str("hidden_key"), |
| 2491 v8_str("hidden_value"))); |
| 2492 |
| 2493 const v8::HeapSnapshot* snapshot = |
| 2494 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
| 2495 CHECK(ValidateSnapshot(snapshot)); |
| 2496 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| 2497 const v8::HeapGraphNode* object_node = |
| 2498 GetProperty(global, v8::HeapGraphEdge::kProperty, "an_object"); |
| 2499 CHECK_NE(NULL, object_node); |
| 2500 const v8::HeapGraphNode* hidden_node = |
| 2501 GetProperty(object_node, v8::HeapGraphEdge::kProperty, "hidden_key"); |
| 2502 CHECK_NE(NULL, hidden_node); |
| 2503 CHECK_EQ(v8::String::NewFromUtf8(env->GetIsolate(), "hidden_value"), |
| 2504 hidden_node->GetName()); |
| 2505 } |
| OLD | NEW |