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

Side by Side Diff: src/heap.cc

Issue 11649037: Fix several bugs in error stack trace formatting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: changed GetScriptWrapper fix. Created 7 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/handles.cc ('k') | src/messages.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7275 matching lines...) Expand 10 before | Expand all | Expand 10 after
7286 // recursively called. In that case, skip the recursive call, since 7286 // recursively called. In that case, skip the recursive call, since
7287 // the loop modifies the list while iterating over it. 7287 // the loop modifies the list while iterating over it.
7288 if (nested_ || isolate->has_pending_exception()) return; 7288 if (nested_ || isolate->has_pending_exception()) return;
7289 nested_ = true; 7289 nested_ = true;
7290 HandleScope scope(isolate); 7290 HandleScope scope(isolate);
7291 Handle<String> stack_key = isolate->factory()->stack_symbol(); 7291 Handle<String> stack_key = isolate->factory()->stack_symbol();
7292 int write_index = 0; 7292 int write_index = 0;
7293 int budget = kBudgetPerGC; 7293 int budget = kBudgetPerGC;
7294 for (int i = 0; i < list_.length(); i++) { 7294 for (int i = 0; i < list_.length(); i++) {
7295 Object* object = list_[i]; 7295 Object* object = list_[i];
7296 // Skip possible holes in the list. 7296 JSFunction* getter_fun;
7297 if (object->IsTheHole()) continue; 7297
7298 if (isolate->heap()->InNewSpace(object) || budget == 0) { 7298 { AssertNoAllocation assert;
7299 list_[write_index++] = object; 7299 // Skip possible holes in the list.
7300 continue; 7300 if (object->IsTheHole()) continue;
7301 if (isolate->heap()->InNewSpace(object) || budget == 0) {
7302 list_[write_index++] = object;
7303 continue;
7304 }
7305
7306 // Check whether the stack property is backed by the original getter.
7307 LookupResult lookup(isolate);
7308 JSObject::cast(object)->LocalLookupRealNamedProperty(*stack_key, &lookup);
7309 if (!lookup.IsFound() || lookup.type() != CALLBACKS) continue;
7310 Object* callback = lookup.GetCallbackObject();
7311 if (!callback->IsAccessorPair()) continue;
7312 Object* getter_obj = AccessorPair::cast(callback)->getter();
7313 if (!getter_obj->IsJSFunction()) continue;
7314 getter_fun = JSFunction::cast(getter_obj);
7315 String* key = isolate->heap()->hidden_stack_trace_symbol();
7316 if (key != getter_fun->GetHiddenProperty(key)) continue;
7301 } 7317 }
7302 7318
7303 // Fire the stack property getter, if it is the original marked getter.
7304 LookupResult lookup(isolate);
7305 JSObject::cast(object)->LocalLookupRealNamedProperty(*stack_key, &lookup);
7306 if (!lookup.IsFound() || lookup.type() != CALLBACKS) continue;
7307 Object* callback = lookup.GetCallbackObject();
7308 if (!callback->IsAccessorPair()) continue;
7309 Object* getter_obj = AccessorPair::cast(callback)->getter();
7310 if (!getter_obj->IsJSFunction()) continue;
7311 JSFunction* getter_fun = JSFunction::cast(getter_obj);
7312 String* key = isolate->heap()->hidden_stack_trace_symbol();
7313 if (key != getter_fun->GetHiddenProperty(key)) continue;
7314 budget--; 7319 budget--;
7320 HandleScope scope(isolate);
7315 bool has_exception = false; 7321 bool has_exception = false;
7316 Execution::Call(Handle<Object>(getter_fun, isolate), 7322 Handle<Object> object_handle(object, isolate);
7317 Handle<Object>(object, isolate), 7323 Handle<Object> getter_handle(getter_fun, isolate);
7318 0, 7324 Execution::Call(getter_handle, object_handle, 0, NULL, &has_exception);
7319 NULL,
7320 &has_exception);
7321 if (has_exception) { 7325 if (has_exception) {
7322 // Hit an exception (most likely a stack overflow). 7326 // Hit an exception (most likely a stack overflow).
7323 // Wrap up this pass and retry after another GC. 7327 // Wrap up this pass and retry after another GC.
7324 isolate->clear_pending_exception(); 7328 isolate->clear_pending_exception();
7325 list_[write_index++] = object; 7329 // We use the handle since calling the getter might have caused a GC.
7330 list_[write_index++] = *object_handle;
7326 budget = 0; 7331 budget = 0;
7327 } 7332 }
7328 } 7333 }
7329 list_.Rewind(write_index); 7334 list_.Rewind(write_index);
7330 list_.Trim(); 7335 list_.Trim();
7331 nested_ = false; 7336 nested_ = false;
7332 } 7337 }
7333 7338
7334 7339
7335 void ErrorObjectList::RemoveUnmarked(Heap* heap) { 7340 void ErrorObjectList::RemoveUnmarked(Heap* heap) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
7468 static_cast<int>(object_sizes_last_time_[index])); 7473 static_cast<int>(object_sizes_last_time_[index]));
7469 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7474 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7470 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7475 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7471 7476
7472 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7477 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7473 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7478 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7474 ClearObjectStats(); 7479 ClearObjectStats();
7475 } 7480 }
7476 7481
7477 } } // namespace v8::internal 7482 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698