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

Side by Side Diff: src/top.cc

Issue 2147005: Fix GC issue... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return Factory::empty_symbol(); 363 return Factory::empty_symbol();
364 } 364 }
365 } 365 }
366 366
367 367
368 Local<StackTrace> Top::CaptureCurrentStackTrace( 368 Local<StackTrace> Top::CaptureCurrentStackTrace(
369 int frame_limit, StackTrace::StackTraceOptions options) { 369 int frame_limit, StackTrace::StackTraceOptions options) {
370 v8::HandleScope scope; 370 v8::HandleScope scope;
371 // Ensure no negative values. 371 // Ensure no negative values.
372 int limit = Max(frame_limit, 0); 372 int limit = Max(frame_limit, 0);
373 Handle<JSArray> stackTrace = Factory::NewJSArray(frame_limit); 373 Handle<JSArray> stack_trace = Factory::NewJSArray(frame_limit);
374 FixedArray* frames = FixedArray::cast(stackTrace->elements());
375 374
376 Handle<String> column_key = Factory::LookupAsciiSymbol("column"); 375 Handle<String> column_key = Factory::LookupAsciiSymbol("column");
377 Handle<String> line_key = Factory::LookupAsciiSymbol("lineNumber"); 376 Handle<String> line_key = Factory::LookupAsciiSymbol("lineNumber");
378 Handle<String> script_key = Factory::LookupAsciiSymbol("scriptName"); 377 Handle<String> script_key = Factory::LookupAsciiSymbol("scriptName");
379 Handle<String> function_key = Factory::LookupAsciiSymbol("functionName"); 378 Handle<String> function_key = Factory::LookupAsciiSymbol("functionName");
380 Handle<String> eval_key = Factory::LookupAsciiSymbol("isEval"); 379 Handle<String> eval_key = Factory::LookupAsciiSymbol("isEval");
381 Handle<String> constructor_key = Factory::LookupAsciiSymbol("isConstructor"); 380 Handle<String> constructor_key = Factory::LookupAsciiSymbol("isConstructor");
382 381
383 StackTraceFrameIterator it; 382 StackTraceFrameIterator it;
384 int frames_seen = 0; 383 int frames_seen = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 Factory::true_value() : Factory::false_value(); 430 Factory::true_value() : Factory::false_value();
432 SetProperty(stackFrame, eval_key, is_eval, NONE); 431 SetProperty(stackFrame, eval_key, is_eval, NONE);
433 } 432 }
434 433
435 if (options & StackTrace::kIsConstructor) { 434 if (options & StackTrace::kIsConstructor) {
436 Handle<Object> is_constructor = (frame->IsConstructor()) ? 435 Handle<Object> is_constructor = (frame->IsConstructor()) ?
437 Factory::true_value() : Factory::false_value(); 436 Factory::true_value() : Factory::false_value();
438 SetProperty(stackFrame, constructor_key, is_constructor, NONE); 437 SetProperty(stackFrame, constructor_key, is_constructor, NONE);
439 } 438 }
440 439
441 frames->set(frames_seen, *stackFrame); 440 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stackFrame);
442 frames_seen++; 441 frames_seen++;
443 it.Advance(); 442 it.Advance();
444 } 443 }
445 444
446 stackTrace->set_length(Smi::FromInt(frames_seen)); 445 stack_trace->set_length(Smi::FromInt(frames_seen));
447 return scope.Close(Utils::StackTraceToLocal(stackTrace)); 446 return scope.Close(Utils::StackTraceToLocal(stack_trace));
448 } 447 }
449 448
450 449
451 void Top::PrintStack() { 450 void Top::PrintStack() {
452 if (stack_trace_nesting_level == 0) { 451 if (stack_trace_nesting_level == 0) {
453 stack_trace_nesting_level++; 452 stack_trace_nesting_level++;
454 453
455 StringAllocator* allocator; 454 StringAllocator* allocator;
456 if (preallocated_message_space == NULL) { 455 if (preallocated_message_space == NULL) {
457 allocator = new HeapStringAllocator(); 456 allocator = new HeapStringAllocator();
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 Top::break_access_->Lock(); 1059 Top::break_access_->Lock();
1061 } 1060 }
1062 1061
1063 1062
1064 ExecutionAccess::~ExecutionAccess() { 1063 ExecutionAccess::~ExecutionAccess() {
1065 Top::break_access_->Unlock(); 1064 Top::break_access_->Unlock();
1066 } 1065 }
1067 1066
1068 1067
1069 } } // namespace v8::internal 1068 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698