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

Side by Side Diff: src/frames.cc

Issue 1002010: Show file name/line number in stack trace (Closed)
Patch Set: merge Created 10 years, 9 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
« no previous file with comments | « no previous file | src/handles.h » ('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 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 int index) const { 513 int index) const {
514 HandleScope scope; 514 HandleScope scope;
515 Object* receiver = this->receiver(); 515 Object* receiver = this->receiver();
516 Object* function = this->function(); 516 Object* function = this->function();
517 517
518 accumulator->PrintSecurityTokenIfChanged(function); 518 accumulator->PrintSecurityTokenIfChanged(function);
519 PrintIndex(accumulator, mode, index); 519 PrintIndex(accumulator, mode, index);
520 Code* code = NULL; 520 Code* code = NULL;
521 if (IsConstructor()) accumulator->Add("new "); 521 if (IsConstructor()) accumulator->Add("new ");
522 accumulator->PrintFunction(function, receiver, &code); 522 accumulator->PrintFunction(function, receiver, &code);
523
524 if (function->IsJSFunction()) {
525 Handle<SharedFunctionInfo> shared(JSFunction::cast(function)->shared());
526 Object* script_obj = shared->script();
527 if (script_obj->IsScript()) {
528 Handle<Script> script(Script::cast(script_obj));
529 accumulator->Add(" [");
530 accumulator->PrintName(script->name());
531
532 Address pc = this->pc();
533 if (code != NULL && code->kind() == Code::FUNCTION &&
534 pc >= code->instruction_start() && pc < code->relocation_start()) {
535 int source_pos = code->SourcePosition(pc);
536 int line = GetScriptLineNumberSafe(script, source_pos) + 1;
537 accumulator->Add(":%d", line);
538 } else {
539 int function_start_pos = shared->start_position();
540 int line = GetScriptLineNumberSafe(script, function_start_pos) + 1;
541 accumulator->Add(":~%d", line);
542 }
543
544 accumulator->Add("] ");
545 }
546 }
547
523 accumulator->Add("(this=%o", receiver); 548 accumulator->Add("(this=%o", receiver);
524 549
525 // Get scope information for nicer output, if possible. If code is 550 // Get scope information for nicer output, if possible. If code is
526 // NULL, or doesn't contain scope info, info will return 0 for the 551 // NULL, or doesn't contain scope info, info will return 0 for the
527 // number of parameters, stack slots, or context slots. 552 // number of parameters, stack slots, or context slots.
528 ScopeInfo<PreallocatedStorage> info(code); 553 ScopeInfo<PreallocatedStorage> info(code);
529 554
530 // Print the parameters. 555 // Print the parameters.
531 int parameters_count = ComputeParametersCount(); 556 int parameters_count = ComputeParametersCount();
532 for (int i = 0; i < parameters_count; i++) { 557 for (int i = 0; i < parameters_count; i++) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 reg_code[i++] = r; 767 reg_code[i++] = r;
743 768
744 ASSERT(i == kNumJSCallerSaved); 769 ASSERT(i == kNumJSCallerSaved);
745 } 770 }
746 ASSERT(0 <= n && n < kNumJSCallerSaved); 771 ASSERT(0 <= n && n < kNumJSCallerSaved);
747 return reg_code[n]; 772 return reg_code[n];
748 } 773 }
749 774
750 775
751 } } // namespace v8::internal 776 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698