| Index: src/log.cc
|
| diff --git a/src/log.cc b/src/log.cc
|
| index d225c3b49515a4df9d3574fe6246d92bcc95d62d..1c82f8525c95f954e87091a7d3b964e7c6fe24aa 100644
|
| --- a/src/log.cc
|
| +++ b/src/log.cc
|
| @@ -1070,37 +1070,33 @@ int Logger::GetLogLines(int from_pos, char* dest_buf, int max_size) {
|
| }
|
|
|
|
|
| -void Logger::LogCompiledFunctions() {
|
| - HandleScope scope;
|
| - Handle<SharedFunctionInfo>* sfis = NULL;
|
| +static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis) {
|
| + AssertNoAllocation no_alloc;
|
| int compiled_funcs_count = 0;
|
| -
|
| - {
|
| - AssertNoAllocation no_alloc;
|
| -
|
| - HeapIterator iterator;
|
| - while (iterator.has_next()) {
|
| - HeapObject* obj = iterator.next();
|
| - ASSERT(obj != NULL);
|
| - if (obj->IsSharedFunctionInfo()
|
| - && SharedFunctionInfo::cast(obj)->is_compiled()) {
|
| - ++compiled_funcs_count;
|
| - }
|
| + HeapIterator iterator;
|
| + while (iterator.has_next()) {
|
| + HeapObject* obj = iterator.next();
|
| + ASSERT(obj != NULL);
|
| + if (!obj->IsSharedFunctionInfo()) continue;
|
| + SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj);
|
| + if (sfi->is_compiled()
|
| + && (!sfi->script()->IsScript()
|
| + || Script::cast(sfi->script())->HasValidSource())) {
|
| + if (sfis != NULL)
|
| + sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi);
|
| + ++compiled_funcs_count;
|
| }
|
| + }
|
| + return compiled_funcs_count;
|
| +}
|
|
|
| - sfis = NewArray< Handle<SharedFunctionInfo> >(compiled_funcs_count);
|
| - iterator.reset();
|
|
|
| - int i = 0;
|
| - while (iterator.has_next()) {
|
| - HeapObject* obj = iterator.next();
|
| - ASSERT(obj != NULL);
|
| - if (obj->IsSharedFunctionInfo()
|
| - && SharedFunctionInfo::cast(obj)->is_compiled()) {
|
| - sfis[i++] = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(obj));
|
| - }
|
| - }
|
| - }
|
| +void Logger::LogCompiledFunctions() {
|
| + HandleScope scope;
|
| + const int compiled_funcs_count = EnumerateCompiledFunctions(NULL);
|
| + Handle<SharedFunctionInfo>* sfis =
|
| + NewArray< Handle<SharedFunctionInfo> >(compiled_funcs_count);
|
| + EnumerateCompiledFunctions(sfis);
|
|
|
| // During iteration, there can be heap allocation due to
|
| // GetScriptLineNumber call.
|
|
|