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

Side by Side Diff: src/frames.cc

Issue 1118007: LiveEdit: implement frame dropping (Closed)
Patch Set: adding rule to mjsunit.status Created 10 years, 8 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 | « src/frames.h ('k') | src/ia32/debug-ia32.cc » ('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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 Code* EntryFrame::code() const { 375 Code* EntryFrame::code() const {
376 return Heap::js_entry_code(); 376 return Heap::js_entry_code();
377 } 377 }
378 378
379 379
380 void EntryFrame::ComputeCallerState(State* state) const { 380 void EntryFrame::ComputeCallerState(State* state) const {
381 GetCallerState(state); 381 GetCallerState(state);
382 } 382 }
383 383
384 384
385 void EntryFrame::SetCallerFp(Address caller_fp) {
386 const int offset = EntryFrameConstants::kCallerFPOffset;
387 Memory::Address_at(this->fp() + offset) = caller_fp;
388 }
389
390
385 StackFrame::Type EntryFrame::GetCallerState(State* state) const { 391 StackFrame::Type EntryFrame::GetCallerState(State* state) const {
386 const int offset = EntryFrameConstants::kCallerFPOffset; 392 const int offset = EntryFrameConstants::kCallerFPOffset;
387 Address fp = Memory::Address_at(this->fp() + offset); 393 Address fp = Memory::Address_at(this->fp() + offset);
388 return ExitFrame::GetStateForFramePointer(fp, state); 394 return ExitFrame::GetStateForFramePointer(fp, state);
389 } 395 }
390 396
391 397
392 Code* EntryConstructFrame::code() const { 398 Code* EntryConstructFrame::code() const {
393 return Heap::js_construct_entry_code(); 399 return Heap::js_construct_entry_code();
394 } 400 }
(...skipping 12 matching lines...) Expand all
407 413
408 void ExitFrame::ComputeCallerState(State* state) const { 414 void ExitFrame::ComputeCallerState(State* state) const {
409 // Setup the caller state. 415 // Setup the caller state.
410 state->sp = caller_sp(); 416 state->sp = caller_sp();
411 state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); 417 state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset);
412 state->pc_address 418 state->pc_address
413 = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset); 419 = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset);
414 } 420 }
415 421
416 422
423 void ExitFrame::SetCallerFp(Address caller_fp) {
424 Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset) = caller_fp;
425 }
426
427
417 Address ExitFrame::GetCallerStackPointer() const { 428 Address ExitFrame::GetCallerStackPointer() const {
418 return fp() + ExitFrameConstants::kCallerSPDisplacement; 429 return fp() + ExitFrameConstants::kCallerSPDisplacement;
419 } 430 }
420 431
421 432
422 Address StandardFrame::GetExpressionAddress(int n) const { 433 Address StandardFrame::GetExpressionAddress(int n) const {
423 const int offset = StandardFrameConstants::kExpressionsOffset; 434 const int offset = StandardFrameConstants::kExpressionsOffset;
424 return fp() + offset - n * kPointerSize; 435 return fp() + offset - n * kPointerSize;
425 } 436 }
426 437
427 438
428 int StandardFrame::ComputeExpressionsCount() const { 439 int StandardFrame::ComputeExpressionsCount() const {
429 const int offset = 440 const int offset =
430 StandardFrameConstants::kExpressionsOffset + kPointerSize; 441 StandardFrameConstants::kExpressionsOffset + kPointerSize;
431 Address base = fp() + offset; 442 Address base = fp() + offset;
432 Address limit = sp(); 443 Address limit = sp();
433 ASSERT(base >= limit); // stack grows downwards 444 ASSERT(base >= limit); // stack grows downwards
434 // Include register-allocated locals in number of expressions. 445 // Include register-allocated locals in number of expressions.
435 return static_cast<int>((base - limit) / kPointerSize); 446 return static_cast<int>((base - limit) / kPointerSize);
436 } 447 }
437 448
438 449
439 void StandardFrame::ComputeCallerState(State* state) const { 450 void StandardFrame::ComputeCallerState(State* state) const {
440 state->sp = caller_sp(); 451 state->sp = caller_sp();
441 state->fp = caller_fp(); 452 state->fp = caller_fp();
442 state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp())); 453 state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp()));
443 } 454 }
444 455
445 456
457 void StandardFrame::SetCallerFp(Address caller_fp) {
458 Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) =
459 caller_fp;
460 }
461
462
446 bool StandardFrame::IsExpressionInsideHandler(int n) const { 463 bool StandardFrame::IsExpressionInsideHandler(int n) const {
447 Address address = GetExpressionAddress(n); 464 Address address = GetExpressionAddress(n);
448 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { 465 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) {
449 if (it.handler()->includes(address)) return true; 466 if (it.handler()->includes(address)) return true;
450 } 467 }
451 return false; 468 return false;
452 } 469 }
453 470
454 471
455 Object* JavaScriptFrame::GetParameter(int index) const { 472 Object* JavaScriptFrame::GetParameter(int index) const {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 if ((kJSCallerSaved & (1 << r)) != 0) 777 if ((kJSCallerSaved & (1 << r)) != 0)
761 reg_code[i++] = r; 778 reg_code[i++] = r;
762 779
763 ASSERT(i == kNumJSCallerSaved); 780 ASSERT(i == kNumJSCallerSaved);
764 } 781 }
765 ASSERT(0 <= n && n < kNumJSCallerSaved); 782 ASSERT(0 <= n && n < kNumJSCallerSaved);
766 return reg_code[n]; 783 return reg_code[n];
767 } 784 }
768 785
769 786
787 #define DEFINE_WRAPPER(type, field) \
788 class field##_Wrapper : public ZoneObject { \
789 public: /* NOLINT */ \
790 field##_Wrapper(const field& original) : frame_(original) { \
791 } \
792 field frame_; \
793 };
794 STACK_FRAME_TYPE_LIST(DEFINE_WRAPPER)
795 #undef DEFINE_WRAPPER
796
797 static StackFrame* AllocateFrameCopy(StackFrame* frame) {
798 #define FRAME_TYPE_CASE(type, field) \
799 case StackFrame::type: { \
800 field##_Wrapper* wrapper = \
801 new field##_Wrapper(*(reinterpret_cast<field*>(frame))); \
802 return &wrapper->frame_; \
803 }
804
805 switch (frame->type()) {
806 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE)
807 default: UNREACHABLE();
808 }
809 #undef FRAME_TYPE_CASE
810 return NULL;
811 }
812
813 Vector<StackFrame*> CreateStackMap() {
814 ZoneList<StackFrame*> list(10);
815 for (StackFrameIterator it; !it.done(); it.Advance()) {
816 StackFrame* frame = AllocateFrameCopy(it.frame());
817 list.Add(frame);
818 }
819 return list.ToVector();
820 }
821
822
770 } } // namespace v8::internal 823 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698