OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/global-handles.h" | 5 #include "src/global-handles.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 #include "src/vm-state-inl.h" | 9 #include "src/vm-state-inl.h" |
10 | 10 |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 void ObjectGroupsTracer::PrintObject(Object* object) { | 872 void ObjectGroupsTracer::PrintObject(Object* object) { |
873 if (object->IsJSObject()) { | 873 if (object->IsJSObject()) { |
874 JSObject* js_object = JSObject::cast(object); | 874 JSObject* js_object = JSObject::cast(object); |
875 | 875 |
876 PrintF("{ constructor_name: "); | 876 PrintF("{ constructor_name: "); |
877 PrintConstructor(js_object); | 877 PrintConstructor(js_object); |
878 PrintF(", hidden_fields: [ "); | 878 PrintF(", hidden_fields: [ "); |
879 PrintInternalFields(js_object); | 879 PrintInternalFields(js_object); |
880 PrintF(" ] }\n"); | 880 PrintF(" ] }\n"); |
881 } else { | 881 } else { |
882 PrintF("object of unexpected type: %p\n", object); | 882 PrintF("object of unexpected type: %p\n", static_cast<void*>(object)); |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 void ObjectGroupsTracer::PrintConstructor(JSObject* js_object) { | 886 void ObjectGroupsTracer::PrintConstructor(JSObject* js_object) { |
887 Object* maybe_constructor = js_object->map()->GetConstructor(); | 887 Object* maybe_constructor = js_object->map()->GetConstructor(); |
888 if (maybe_constructor->IsJSFunction()) { | 888 if (maybe_constructor->IsJSFunction()) { |
889 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 889 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
890 String* name = String::cast(constructor->shared()->name()); | 890 String* name = String::cast(constructor->shared()->name()); |
891 if (name->length() == 0) name = constructor->shared()->inferred_name(); | 891 if (name->length() == 0) name = constructor->shared()->inferred_name(); |
892 | 892 |
893 PrintF("%s", name->ToCString().get()); | 893 PrintF("%s", name->ToCString().get()); |
894 } else if (maybe_constructor->IsNull()) { | 894 } else if (maybe_constructor->IsNull()) { |
895 if (js_object->IsOddball()) { | 895 if (js_object->IsOddball()) { |
896 PrintF("<oddball>"); | 896 PrintF("<oddball>"); |
897 } else { | 897 } else { |
898 PrintF("<null>"); | 898 PrintF("<null>"); |
899 } | 899 } |
900 } else { | 900 } else { |
901 UNREACHABLE(); | 901 UNREACHABLE(); |
902 } | 902 } |
903 } | 903 } |
904 | 904 |
905 void ObjectGroupsTracer::PrintInternalFields(JSObject* js_object) { | 905 void ObjectGroupsTracer::PrintInternalFields(JSObject* js_object) { |
906 for (int i = 0; i < js_object->GetInternalFieldCount(); ++i) { | 906 for (int i = 0; i < js_object->GetInternalFieldCount(); ++i) { |
907 if (i != 0) { | 907 if (i != 0) { |
908 PrintF(", "); | 908 PrintF(", "); |
909 } | 909 } |
910 PrintF("%p", js_object->GetInternalField(i)); | 910 PrintF("%p", static_cast<void*>(js_object->GetInternalField(i))); |
911 } | 911 } |
912 } | 912 } |
913 | 913 |
914 void ObjectGroupsTracer::PrintObjectGroup(ObjectGroup* group) { | 914 void ObjectGroupsTracer::PrintObjectGroup(ObjectGroup* group) { |
915 PrintIsolate(isolate_, "ObjectGroup (size: %" PRIuS ")\n", group->length); | 915 PrintIsolate(isolate_, "ObjectGroup (size: %" PRIuS ")\n", group->length); |
916 Object*** objects = group->objects; | 916 Object*** objects = group->objects; |
917 | 917 |
918 for (size_t i = 0; i < group->length; ++i) { | 918 for (size_t i = 0; i < group->length; ++i) { |
919 PrintIsolate(isolate_, " - Member: "); | 919 PrintIsolate(isolate_, " - Member: "); |
920 PrintObject(*objects[i]); | 920 PrintObject(*objects[i]); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 blocks_[block][offset] = object; | 1505 blocks_[block][offset] = object; |
1506 if (isolate->heap()->InNewSpace(object)) { | 1506 if (isolate->heap()->InNewSpace(object)) { |
1507 new_space_indices_.Add(size_); | 1507 new_space_indices_.Add(size_); |
1508 } | 1508 } |
1509 *index = size_++; | 1509 *index = size_++; |
1510 } | 1510 } |
1511 | 1511 |
1512 | 1512 |
1513 } // namespace internal | 1513 } // namespace internal |
1514 } // namespace v8 | 1514 } // namespace v8 |
OLD | NEW |