Revision: 11251
Author: [email protected]
Date: Tue Apr 10 04:07:16 2012
Log: Do not assume that names of function expressions are
context-allocated.
The heap profile generator assumes that for named function expressions, the
name is context allocated. This is not necessary true.
BUG=v8:2051
TEST=WebKit layout test
inspector/profiler/heap-snapshot-inspect-dom-wrapper.html
Review URL: https://chromiumcodereview.appspot.com/9960065
http://code.google.com/p/v8/source/detail?r=11251
Modified:
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/profile-generator.cc
=======================================
--- /branches/bleeding_edge/src/objects.h Tue Apr 3 10:22:05 2012
+++ /branches/bleeding_edge/src/objects.h Tue Apr 10 04:07:16 2012
@@ -3413,8 +3413,8 @@
// otherwise returns a value < 0. The name must be a symbol
(canonicalized).
int ParameterIndex(String* name);
- // Lookup support for serialized scope info. Returns the
- // function context slot index if the function name is present (named
+ // Lookup support for serialized scope info. Returns the function context
+ // slot index if the function name is present and context-allocated
(named
// function expressions, only), otherwise returns a value < 0. The name
// must be a symbol (canonicalized).
int FunctionContextSlotIndex(String* name, VariableMode* mode);
=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Sun Apr 8 12:18:06
2012
+++ /branches/bleeding_edge/src/profile-generator.cc Tue Apr 10 04:07:16
2012
@@ -2109,12 +2109,11 @@
// Add function variable.
if (scope_info->HasFunctionName()) {
String* name = scope_info->FunctionName();
- int idx = Context::MIN_CONTEXT_SLOTS + context_locals;
-#ifdef DEBUG
VariableMode mode;
- ASSERT(idx == scope_info->FunctionContextSlotIndex(name, &mode));
-#endif
- SetClosureReference(js_obj, entry, name, context->get(idx));
+ int idx = scope_info->FunctionContextSlotIndex(name, &mode);
+ if (idx >= 0) {
+ SetClosureReference(js_obj, entry, name, context->get(idx));
+ }
}
}
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev