| 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 v8::HandleScope scope(isolate); | 434 v8::HandleScope scope(isolate); |
| 435 v8::Local<v8::ObjectTemplate> global_template = | 435 v8::Local<v8::ObjectTemplate> global_template = |
| 436 v8::ObjectTemplate::New(isolate); | 436 v8::ObjectTemplate::New(isolate); |
| 437 global_template->SetInternalFieldCount(1); | 437 global_template->SetInternalFieldCount(1); |
| 438 LocalContext env(NULL, global_template); | 438 LocalContext env(NULL, global_template); |
| 439 v8::Handle<v8::Object> global_proxy = env->Global(); | 439 v8::Handle<v8::Object> global_proxy = env->Global(); |
| 440 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 440 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
| 441 CHECK_EQ(1, global->InternalFieldCount()); | 441 CHECK_EQ(1, global->InternalFieldCount()); |
| 442 | 442 |
| 443 i::Factory* factory = CcTest::i_isolate()->factory(); | 443 i::Factory* factory = CcTest::i_isolate()->factory(); |
| 444 i::Handle<i::String> first = | 444 i::Handle<i::String> first = factory->NewStringFromStaticAscii("0123456789"); |
| 445 factory->NewStringFromAscii(i::CStrVector("0123456789")); | 445 i::Handle<i::String> second = factory->NewStringFromStaticAscii("0123456789"); |
| 446 i::Handle<i::String> second = | |
| 447 factory->NewStringFromAscii(i::CStrVector("0123456789")); | |
| 448 i::Handle<i::String> cons_string = | 446 i::Handle<i::String> cons_string = |
| 449 factory->NewConsString(first, second).ToHandleChecked(); | 447 factory->NewConsString(first, second).ToHandleChecked(); |
| 450 | 448 |
| 451 global->SetInternalField(0, v8::ToApiHandle<v8::String>(cons_string)); | 449 global->SetInternalField(0, v8::ToApiHandle<v8::String>(cons_string)); |
| 452 | 450 |
| 453 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | 451 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
| 454 const v8::HeapSnapshot* snapshot = | 452 const v8::HeapSnapshot* snapshot = |
| 455 heap_profiler->TakeHeapSnapshot(v8_str("cons_strings")); | 453 heap_profiler->TakeHeapSnapshot(v8_str("cons_strings")); |
| 456 CHECK(ValidateSnapshot(snapshot)); | 454 CHECK(ValidateSnapshot(snapshot)); |
| 457 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); | 455 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
| (...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2479 |
| 2482 | 2480 |
| 2483 TEST(BoxObject) { | 2481 TEST(BoxObject) { |
| 2484 v8::Isolate* isolate = CcTest::isolate(); | 2482 v8::Isolate* isolate = CcTest::isolate(); |
| 2485 v8::HandleScope scope(isolate); | 2483 v8::HandleScope scope(isolate); |
| 2486 LocalContext env; | 2484 LocalContext env; |
| 2487 v8::Handle<v8::Object> global_proxy = env->Global(); | 2485 v8::Handle<v8::Object> global_proxy = env->Global(); |
| 2488 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 2486 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
| 2489 | 2487 |
| 2490 i::Factory* factory = CcTest::i_isolate()->factory(); | 2488 i::Factory* factory = CcTest::i_isolate()->factory(); |
| 2491 i::Handle<i::String> string = | 2489 i::Handle<i::String> string = factory->NewStringFromStaticAscii("string"); |
| 2492 factory->NewStringFromAscii(i::CStrVector("string")); | |
| 2493 i::Handle<i::Object> box = factory->NewBox(string); | 2490 i::Handle<i::Object> box = factory->NewBox(string); |
| 2494 global->Set(0, v8::ToApiHandle<v8::Object>(box)); | 2491 global->Set(0, v8::ToApiHandle<v8::Object>(box)); |
| 2495 | 2492 |
| 2496 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); | 2493 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
| 2497 const v8::HeapSnapshot* snapshot = | 2494 const v8::HeapSnapshot* snapshot = |
| 2498 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | 2495 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
| 2499 CHECK(ValidateSnapshot(snapshot)); | 2496 CHECK(ValidateSnapshot(snapshot)); |
| 2500 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); | 2497 const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
| 2501 const v8::HeapGraphNode* box_node = | 2498 const v8::HeapGraphNode* box_node = |
| 2502 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); | 2499 GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2595 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2592 map.AddRange(ToAddress(0x180), 0x80, 6U); |
| 2596 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2593 map.AddRange(ToAddress(0x180), 0x80, 7U); |
| 2597 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); | 2594 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
| 2598 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2595 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
| 2599 CHECK_EQ(3, static_cast<int>(map.size())); | 2596 CHECK_EQ(3, static_cast<int>(map.size())); |
| 2600 | 2597 |
| 2601 map.Clear(); | 2598 map.Clear(); |
| 2602 CHECK_EQ(0, static_cast<int>(map.size())); | 2599 CHECK_EQ(0, static_cast<int>(map.size())); |
| 2603 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); | 2600 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
| 2604 } | 2601 } |
| OLD | NEW |