| OLD | NEW |
| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } | 429 } |
| 430 | 430 |
| 431 | 431 |
| 432 int StandardFrame::ComputeExpressionsCount() const { | 432 int StandardFrame::ComputeExpressionsCount() const { |
| 433 const int offset = | 433 const int offset = |
| 434 StandardFrameConstants::kExpressionsOffset + kPointerSize; | 434 StandardFrameConstants::kExpressionsOffset + kPointerSize; |
| 435 Address base = fp() + offset; | 435 Address base = fp() + offset; |
| 436 Address limit = sp(); | 436 Address limit = sp(); |
| 437 ASSERT(base >= limit); // stack grows downwards | 437 ASSERT(base >= limit); // stack grows downwards |
| 438 // Include register-allocated locals in number of expressions. | 438 // Include register-allocated locals in number of expressions. |
| 439 return (base - limit) / kPointerSize; | 439 return static_cast<int>((base - limit) / kPointerSize); |
| 440 } | 440 } |
| 441 | 441 |
| 442 | 442 |
| 443 void StandardFrame::ComputeCallerState(State* state) const { | 443 void StandardFrame::ComputeCallerState(State* state) const { |
| 444 state->sp = caller_sp(); | 444 state->sp = caller_sp(); |
| 445 state->fp = caller_fp(); | 445 state->fp = caller_fp(); |
| 446 state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp())); | 446 state->pc_address = reinterpret_cast<Address*>(ComputePCAddress(fp())); |
| 447 } | 447 } |
| 448 | 448 |
| 449 | 449 |
| 450 bool StandardFrame::IsExpressionInsideHandler(int n) const { | 450 bool StandardFrame::IsExpressionInsideHandler(int n) const { |
| 451 Address address = GetExpressionAddress(n); | 451 Address address = GetExpressionAddress(n); |
| 452 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { | 452 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { |
| 453 if (it.handler()->includes(address)) return true; | 453 if (it.handler()->includes(address)) return true; |
| 454 } | 454 } |
| 455 return false; | 455 return false; |
| 456 } | 456 } |
| 457 | 457 |
| 458 | 458 |
| 459 Object* JavaScriptFrame::GetParameter(int index) const { | 459 Object* JavaScriptFrame::GetParameter(int index) const { |
| 460 ASSERT(index >= 0 && index < ComputeParametersCount()); | 460 ASSERT(index >= 0 && index < ComputeParametersCount()); |
| 461 const int offset = JavaScriptFrameConstants::kParam0Offset; | 461 const int offset = JavaScriptFrameConstants::kParam0Offset; |
| 462 return Memory::Object_at(caller_sp() + offset - (index * kPointerSize)); | 462 return Memory::Object_at(caller_sp() + offset - (index * kPointerSize)); |
| 463 } | 463 } |
| 464 | 464 |
| 465 | 465 |
| 466 int JavaScriptFrame::ComputeParametersCount() const { | 466 int JavaScriptFrame::ComputeParametersCount() const { |
| 467 Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset; | 467 Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset; |
| 468 Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; | 468 Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; |
| 469 return (base - limit) / kPointerSize; | 469 return static_cast<int>((base - limit) / kPointerSize); |
| 470 } | 470 } |
| 471 | 471 |
| 472 | 472 |
| 473 bool JavaScriptFrame::IsConstructor() const { | 473 bool JavaScriptFrame::IsConstructor() const { |
| 474 Address fp = caller_fp(); | 474 Address fp = caller_fp(); |
| 475 if (has_adapted_arguments()) { | 475 if (has_adapted_arguments()) { |
| 476 // Skip the arguments adaptor frame and look at the real caller. | 476 // Skip the arguments adaptor frame and look at the real caller. |
| 477 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); | 477 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); |
| 478 } | 478 } |
| 479 return IsConstructFrame(fp); | 479 return IsConstructFrame(fp); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 reg_code[i++] = r; | 740 reg_code[i++] = r; |
| 741 | 741 |
| 742 ASSERT(i == kNumJSCallerSaved); | 742 ASSERT(i == kNumJSCallerSaved); |
| 743 } | 743 } |
| 744 ASSERT(0 <= n && n < kNumJSCallerSaved); | 744 ASSERT(0 <= n && n < kNumJSCallerSaved); |
| 745 return reg_code[n]; | 745 return reg_code[n]; |
| 746 } | 746 } |
| 747 | 747 |
| 748 | 748 |
| 749 } } // namespace v8::internal | 749 } } // namespace v8::internal |
| OLD | NEW |