OLD | NEW |
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 StackFrame::Type type; | 148 StackFrame::Type type; |
149 if (thread_ != NULL) { | 149 if (thread_ != NULL) { |
150 type = ExitFrame::GetStateForFramePointer( | 150 type = ExitFrame::GetStateForFramePointer( |
151 Isolate::c_entry_fp(thread_), &state); | 151 Isolate::c_entry_fp(thread_), &state); |
152 handler_ = StackHandler::FromAddress( | 152 handler_ = StackHandler::FromAddress( |
153 Isolate::handler(thread_)); | 153 Isolate::handler(thread_)); |
154 } else { | 154 } else { |
155 ASSERT(fp_ != NULL); | 155 ASSERT(fp_ != NULL); |
156 state.fp = fp_; | 156 state.fp = fp_; |
157 state.sp = sp_; | 157 state.sp = sp_; |
158 state.pc_address = | 158 state.pc_address = OS::ResolveReturnAddressLocation( |
159 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_)); | 159 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp_))); |
160 type = StackFrame::ComputeType(isolate(), &state); | 160 type = StackFrame::ComputeType(isolate(), &state); |
161 } | 161 } |
162 if (SingletonFor(type) == NULL) return; | 162 if (SingletonFor(type) == NULL) return; |
163 frame_ = SingletonFor(type, &state); | 163 frame_ = SingletonFor(type, &state); |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 StackFrame* StackFrameIterator::SingletonFor(StackFrame::Type type, | 167 StackFrame* StackFrameIterator::SingletonFor(StackFrame::Type type, |
168 StackFrame::State* state) { | 168 StackFrame::State* state) { |
169 if (type == StackFrame::NONE) return NULL; | 169 if (type == StackFrame::NONE) return NULL; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 481 |
482 Code* ExitFrame::unchecked_code() const { | 482 Code* ExitFrame::unchecked_code() const { |
483 return reinterpret_cast<Code*>(code_slot()); | 483 return reinterpret_cast<Code*>(code_slot()); |
484 } | 484 } |
485 | 485 |
486 | 486 |
487 void ExitFrame::ComputeCallerState(State* state) const { | 487 void ExitFrame::ComputeCallerState(State* state) const { |
488 // Set up the caller state. | 488 // Set up the caller state. |
489 state->sp = caller_sp(); | 489 state->sp = caller_sp(); |
490 state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); | 490 state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); |
491 state->pc_address | 491 state->pc_address = OS::ResolveReturnAddressLocation( |
492 = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset); | 492 reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset)); |
493 } | 493 } |
494 | 494 |
495 | 495 |
496 void ExitFrame::SetCallerFp(Address caller_fp) { | 496 void ExitFrame::SetCallerFp(Address caller_fp) { |
497 Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset) = caller_fp; | 497 Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset) = caller_fp; |
498 } | 498 } |
499 | 499 |
500 | 500 |
501 void ExitFrame::Iterate(ObjectVisitor* v) const { | 501 void ExitFrame::Iterate(ObjectVisitor* v) const { |
502 // The arguments are traversed as part of the expression stack of | 502 // The arguments are traversed as part of the expression stack of |
(...skipping 13 matching lines...) Expand all Loading... |
516 Address sp = ComputeStackPointer(fp); | 516 Address sp = ComputeStackPointer(fp); |
517 FillState(fp, sp, state); | 517 FillState(fp, sp, state); |
518 ASSERT(*state->pc_address != NULL); | 518 ASSERT(*state->pc_address != NULL); |
519 return EXIT; | 519 return EXIT; |
520 } | 520 } |
521 | 521 |
522 | 522 |
523 void ExitFrame::FillState(Address fp, Address sp, State* state) { | 523 void ExitFrame::FillState(Address fp, Address sp, State* state) { |
524 state->sp = sp; | 524 state->sp = sp; |
525 state->fp = fp; | 525 state->fp = fp; |
526 state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize); | 526 state->pc_address = OS::ResolveReturnAddressLocation( |
| 527 reinterpret_cast<Address*>(sp - 1 * kPointerSize)); |
527 } | 528 } |
528 | 529 |
529 | 530 |
530 Address StandardFrame::GetExpressionAddress(int n) const { | 531 Address StandardFrame::GetExpressionAddress(int n) const { |
531 const int offset = StandardFrameConstants::kExpressionsOffset; | 532 const int offset = StandardFrameConstants::kExpressionsOffset; |
532 return fp() + offset - n * kPointerSize; | 533 return fp() + offset - n * kPointerSize; |
533 } | 534 } |
534 | 535 |
535 | 536 |
536 Object* StandardFrame::GetExpression(Address fp, int index) { | 537 Object* StandardFrame::GetExpression(Address fp, int index) { |
(...skipping 14 matching lines...) Expand all Loading... |
551 Address limit = sp(); | 552 Address limit = sp(); |
552 ASSERT(base >= limit); // stack grows downwards | 553 ASSERT(base >= limit); // stack grows downwards |
553 // Include register-allocated locals in number of expressions. | 554 // Include register-allocated locals in number of expressions. |
554 return static_cast<int>((base - limit) / kPointerSize); | 555 return static_cast<int>((base - limit) / kPointerSize); |
555 } | 556 } |
556 | 557 |
557 | 558 |
558 void StandardFrame::ComputeCallerState(State* state) const { | 559 void StandardFrame::ComputeCallerState(State* state) const { |
559 state->sp = caller_sp(); | 560 state->sp = caller_sp(); |
560 state->fp = caller_fp(); | 561 state->fp = caller_fp(); |
561 state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp())); | 562 state->pc_address = OS::ResolveReturnAddressLocation( |
| 563 reinterpret_cast<Address*>(ComputePCAddress(fp()))); |
562 } | 564 } |
563 | 565 |
564 | 566 |
565 void StandardFrame::SetCallerFp(Address caller_fp) { | 567 void StandardFrame::SetCallerFp(Address caller_fp) { |
566 Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) = | 568 Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset) = |
567 caller_fp; | 569 caller_fp; |
568 } | 570 } |
569 | 571 |
570 | 572 |
571 bool StandardFrame::IsExpressionInsideHandler(int n) const { | 573 bool StandardFrame::IsExpressionInsideHandler(int n) const { |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 ZoneList<StackFrame*> list(10); | 1392 ZoneList<StackFrame*> list(10); |
1391 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1393 for (StackFrameIterator it; !it.done(); it.Advance()) { |
1392 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1394 StackFrame* frame = AllocateFrameCopy(it.frame()); |
1393 list.Add(frame); | 1395 list.Add(frame); |
1394 } | 1396 } |
1395 return list.ToVector(); | 1397 return list.ToVector(); |
1396 } | 1398 } |
1397 | 1399 |
1398 | 1400 |
1399 } } // namespace v8::internal | 1401 } } // namespace v8::internal |
OLD | NEW |