summaryrefslogtreecommitdiff
path: root/deps/v8/tools/profile.js
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-07-15 17:47:20 -0700
committerRyan Dahl <ry@tinyclouds.org>2011-07-15 17:47:20 -0700
commitef1be160d66b7da8bc2da857b1c33c6f680d86f1 (patch)
treea1ff31aa2841ebde94d9bff4b0f6692840ea811b /deps/v8/tools/profile.js
parente5564a3f29e0a818832a97c7c3b28d7c8b3b0460 (diff)
downloadandroid-node-v8-ef1be160d66b7da8bc2da857b1c33c6f680d86f1.tar.gz
android-node-v8-ef1be160d66b7da8bc2da857b1c33c6f680d86f1.tar.bz2
android-node-v8-ef1be160d66b7da8bc2da857b1c33c6f680d86f1.zip
Upgrade V8 to 3.4.12.1
Diffstat (limited to 'deps/v8/tools/profile.js')
-rw-r--r--deps/v8/tools/profile.js48
1 files changed, 46 insertions, 2 deletions
diff --git a/deps/v8/tools/profile.js b/deps/v8/tools/profile.js
index c9c9437e93..10a07f8246 100644
--- a/deps/v8/tools/profile.js
+++ b/deps/v8/tools/profile.js
@@ -162,8 +162,16 @@ Profile.prototype.addFuncCode = function(
// Function object has been overwritten with a new one.
func.name = name;
}
- var entry = new Profile.DynamicFuncCodeEntry(size, type, func, state);
- this.codeMap_.addCode(start, entry);
+ var entry = this.codeMap_.findDynamicEntryByStartAddress(start);
+ if (entry) {
+ if (entry.size === size && entry.func === func) {
+ // Entry state has changed.
+ entry.state = state;
+ }
+ } else {
+ entry = new Profile.DynamicFuncCodeEntry(size, type, func, state);
+ this.codeMap_.addCode(start, entry);
+ }
return entry;
};
@@ -374,6 +382,31 @@ Profile.prototype.getFlatProfile = function(opt_label) {
/**
+ * Cleans up function entries that are not referenced by code entries.
+ */
+Profile.prototype.cleanUpFuncEntries = function() {
+ var referencedFuncEntries = [];
+ var entries = this.codeMap_.getAllDynamicEntriesWithAddresses();
+ for (var i = 0, l = entries.length; i < l; ++i) {
+ if (entries[i][1].constructor === Profile.FunctionEntry) {
+ entries[i][1].used = false;
+ }
+ }
+ for (var i = 0, l = entries.length; i < l; ++i) {
+ if ("func" in entries[i][1]) {
+ entries[i][1].func.used = true;
+ }
+ }
+ for (var i = 0, l = entries.length; i < l; ++i) {
+ if (entries[i][1].constructor === Profile.FunctionEntry &&
+ !entries[i][1].used) {
+ this.codeMap_.deleteCode(entries[i][0]);
+ }
+ }
+};
+
+
+/**
* Creates a dynamic code entry.
*
* @param {number} size Code size.
@@ -408,6 +441,11 @@ Profile.DynamicCodeEntry.prototype.isJSFunction = function() {
};
+Profile.DynamicCodeEntry.prototype.toString = function() {
+ return this.getName() + ': ' + this.size.toString(16);
+};
+
+
/**
* Creates a dynamic code entry.
*
@@ -448,6 +486,11 @@ Profile.DynamicFuncCodeEntry.prototype.isJSFunction = function() {
};
+Profile.DynamicFuncCodeEntry.prototype.toString = function() {
+ return this.getName() + ': ' + this.size.toString(16);
+};
+
+
/**
* Creates a shared function object entry.
*
@@ -473,6 +516,7 @@ Profile.FunctionEntry.prototype.getName = function() {
return name;
};
+Profile.FunctionEntry.prototype.toString = CodeMap.CodeEntry.prototype.toString;
/**
* Constructs a call graph.