Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: src/objects.cc

Issue 202018: Heap profiler: account primitive string objects as being constructed using 'String'. (Closed)
Patch Set: Fixed comments Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9ea131fa7b77e46ab1d19d86d6af3f46a30b3ebb..583af7c58a2f645b3fea67ee43f66f72d9888b62 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -1186,7 +1186,9 @@ void HeapNumber::HeapNumberPrint(StringStream* accumulator) {
String* JSObject::class_name() {
- if (IsJSFunction()) return Heap::function_class_symbol();
+ if (IsJSFunction()) {
+ return Heap::function_class_symbol();
+ }
if (map()->constructor()->IsJSFunction()) {
JSFunction* constructor = JSFunction::cast(map()->constructor());
return String::cast(constructor->shared()->instance_class_name());
@@ -1196,6 +1198,20 @@ String* JSObject::class_name() {
}
+String* JSObject::constructor_name() {
+ if (IsJSFunction()) {
+ return Heap::function_class_symbol();
+ }
+ if (map()->constructor()->IsJSFunction()) {
+ JSFunction* constructor = JSFunction::cast(map()->constructor());
+ String* name = String::cast(constructor->shared()->name());
+ return name->length() > 0 ? name : constructor->shared()->inferred_name();
+ }
+ // If the constructor is not present, return "Object".
+ return Heap::Object_symbol();
+}
+
+
void JSObject::JSObjectIterateBody(int object_size, ObjectVisitor* v) {
// Iterate over all fields in the body. Assumes all are Object*.
IteratePointers(v, kPropertiesOffset, object_size);
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698