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

Side by Side Diff: src/frames.cc

Issue 1148007: Merge bleeding_edge from version 2.1.3 up to revision 4205... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/frame-element.h ('k') | src/globals.h » ('j') | src/heap.cc » ('J')
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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (frame()->is_java_script()) return; 299 if (frame()->is_java_script()) return;
300 } 300 }
301 } 301 }
302 #endif 302 #endif
303 303
304 304
305 // ------------------------------------------------------------------------- 305 // -------------------------------------------------------------------------
306 306
307 307
308 void StackHandler::Cook(Code* code) { 308 void StackHandler::Cook(Code* code) {
309 ASSERT(MarkCompactCollector::IsCompacting());
310 ASSERT(code->contains(pc())); 309 ASSERT(code->contains(pc()));
311 set_pc(AddressFrom<Address>(pc() - code->instruction_start())); 310 set_pc(AddressFrom<Address>(pc() - code->instruction_start()));
312 } 311 }
313 312
314 313
315 void StackHandler::Uncook(Code* code) { 314 void StackHandler::Uncook(Code* code) {
316 ASSERT(MarkCompactCollector::HasCompacted());
317 set_pc(code->instruction_start() + OffsetFrom(pc())); 315 set_pc(code->instruction_start() + OffsetFrom(pc()));
318 ASSERT(code->contains(pc())); 316 ASSERT(code->contains(pc()));
319 } 317 }
320 318
321 319
322 // ------------------------------------------------------------------------- 320 // -------------------------------------------------------------------------
323 321
324 322
325 bool StackFrame::HasHandler() const { 323 bool StackFrame::HasHandler() const {
326 StackHandlerIterator it(this, top_handler()); 324 StackHandlerIterator it(this, top_handler());
327 return !it.done(); 325 return !it.done();
328 } 326 }
329 327
330 328
331 void StackFrame::CookFramesForThread(ThreadLocalTop* thread) { 329 void StackFrame::CookFramesForThread(ThreadLocalTop* thread) {
332 // Only cooking frames when the collector is compacting and thus moving code
333 // around.
334 ASSERT(MarkCompactCollector::IsCompacting());
335 ASSERT(!thread->stack_is_cooked()); 330 ASSERT(!thread->stack_is_cooked());
336 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { 331 for (StackFrameIterator it(thread); !it.done(); it.Advance()) {
337 it.frame()->Cook(); 332 it.frame()->Cook();
338 } 333 }
339 thread->set_stack_is_cooked(true); 334 thread->set_stack_is_cooked(true);
340 } 335 }
341 336
342 337
343 void StackFrame::UncookFramesForThread(ThreadLocalTop* thread) { 338 void StackFrame::UncookFramesForThread(ThreadLocalTop* thread) {
344 // Only uncooking frames when the collector is compacting and thus moving code
345 // around.
346 ASSERT(MarkCompactCollector::HasCompacted());
347 ASSERT(thread->stack_is_cooked()); 339 ASSERT(thread->stack_is_cooked());
348 for (StackFrameIterator it(thread); !it.done(); it.Advance()) { 340 for (StackFrameIterator it(thread); !it.done(); it.Advance()) {
349 it.frame()->Uncook(); 341 it.frame()->Uncook();
350 } 342 }
351 thread->set_stack_is_cooked(false); 343 thread->set_stack_is_cooked(false);
352 } 344 }
353 345
354 346
355 void StackFrame::Cook() { 347 void StackFrame::Cook() {
356 Code* code = this->code(); 348 Code* code = this->code();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 int index) const { 507 int index) const {
516 HandleScope scope; 508 HandleScope scope;
517 Object* receiver = this->receiver(); 509 Object* receiver = this->receiver();
518 Object* function = this->function(); 510 Object* function = this->function();
519 511
520 accumulator->PrintSecurityTokenIfChanged(function); 512 accumulator->PrintSecurityTokenIfChanged(function);
521 PrintIndex(accumulator, mode, index); 513 PrintIndex(accumulator, mode, index);
522 Code* code = NULL; 514 Code* code = NULL;
523 if (IsConstructor()) accumulator->Add("new "); 515 if (IsConstructor()) accumulator->Add("new ");
524 accumulator->PrintFunction(function, receiver, &code); 516 accumulator->PrintFunction(function, receiver, &code);
517
518 if (function->IsJSFunction()) {
519 Handle<SharedFunctionInfo> shared(JSFunction::cast(function)->shared());
520 Object* script_obj = shared->script();
521 if (script_obj->IsScript()) {
522 Handle<Script> script(Script::cast(script_obj));
523 accumulator->Add(" [");
524 accumulator->PrintName(script->name());
525
526 Address pc = this->pc();
527 if (code != NULL && code->kind() == Code::FUNCTION &&
528 pc >= code->instruction_start() && pc < code->relocation_start()) {
529 int source_pos = code->SourcePosition(pc);
530 int line = GetScriptLineNumberSafe(script, source_pos) + 1;
531 accumulator->Add(":%d", line);
532 } else {
533 int function_start_pos = shared->start_position();
534 int line = GetScriptLineNumberSafe(script, function_start_pos) + 1;
535 accumulator->Add(":~%d", line);
536 }
537
538 accumulator->Add("] ");
539 }
540 }
541
525 accumulator->Add("(this=%o", receiver); 542 accumulator->Add("(this=%o", receiver);
526 543
527 // Get scope information for nicer output, if possible. If code is 544 // Get scope information for nicer output, if possible. If code is
528 // NULL, or doesn't contain scope info, info will return 0 for the 545 // NULL, or doesn't contain scope info, info will return 0 for the
529 // number of parameters, stack slots, or context slots. 546 // number of parameters, stack slots, or context slots.
530 ScopeInfo<PreallocatedStorage> info(code); 547 ScopeInfo<PreallocatedStorage> info(code);
531 548
532 // Print the parameters. 549 // Print the parameters.
533 int parameters_count = ComputeParametersCount(); 550 int parameters_count = ComputeParametersCount();
534 for (int i = 0; i < parameters_count; i++) { 551 for (int i = 0; i < parameters_count; i++) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 reg_code[i++] = r; 761 reg_code[i++] = r;
745 762
746 ASSERT(i == kNumJSCallerSaved); 763 ASSERT(i == kNumJSCallerSaved);
747 } 764 }
748 ASSERT(0 <= n && n < kNumJSCallerSaved); 765 ASSERT(0 <= n && n < kNumJSCallerSaved);
749 return reg_code[n]; 766 return reg_code[n];
750 } 767 }
751 768
752 769
753 } } // namespace v8::internal 770 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frame-element.h ('k') | src/globals.h » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698