| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 450 } |
| 451 | 451 |
| 452 | 452 |
| 453 Object* JavaScriptFrame::GetParameter(int index) const { | 453 Object* JavaScriptFrame::GetParameter(int index) const { |
| 454 ASSERT(index >= 0 && index < ComputeParametersCount()); | 454 ASSERT(index >= 0 && index < ComputeParametersCount()); |
| 455 const int offset = JavaScriptFrameConstants::kParam0Offset; | 455 const int offset = JavaScriptFrameConstants::kParam0Offset; |
| 456 return Memory::Object_at(caller_sp() + offset - (index * kPointerSize)); | 456 return Memory::Object_at(caller_sp() + offset - (index * kPointerSize)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 void JavaScriptFrame::SetParameter(int index, Object* value) { |
| 461 ASSERT(index >= 0 && index < ComputeParametersCount()); |
| 462 const int offset = JavaScriptFrameConstants::kParam0Offset; |
| 463 Memory::Object_at(caller_sp() + offset - (index * kPointerSize)) = value; |
| 464 } |
| 465 |
| 466 |
| 460 int JavaScriptFrame::ComputeParametersCount() const { | 467 int JavaScriptFrame::ComputeParametersCount() const { |
| 461 Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset; | 468 Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset; |
| 462 Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; | 469 Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; |
| 463 return (base - limit) / kPointerSize; | 470 return (base - limit) / kPointerSize; |
| 464 } | 471 } |
| 465 | 472 |
| 466 | 473 |
| 467 bool JavaScriptFrame::IsConstructor() const { | 474 bool JavaScriptFrame::IsConstructor() const { |
| 468 Address fp = caller_fp(); | 475 Address fp = caller_fp(); |
| 469 if (has_adapted_arguments()) { | 476 if (has_adapted_arguments()) { |
| 470 // Skip the arguments adaptor frame and look at the real caller. | 477 // Skip the arguments adaptor frame and look at the real caller. |
| 471 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); | 478 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); |
| 472 } | 479 } |
| 473 return IsConstructFrame(fp); | 480 return IsConstructFrame(fp); |
| 474 } | 481 } |
| 475 | 482 |
| 476 | 483 |
| 477 Code* JavaScriptFrame::code() const { | 484 Code* JavaScriptFrame::code() const { |
| 478 JSFunction* function = JSFunction::cast(this->function()); | 485 JSFunction* function = JSFunction::cast(this->function()); |
| 479 return function->shared()->code(); | 486 return function->shared()->code(); |
| 480 } | 487 } |
| 481 | 488 |
| 482 | 489 |
| 490 Address JavaScriptFrame::GetParameterAddress(int n) const { |
| 491 ASSERT(n >= 0 && n < ComputeParametersCount()); |
| 492 const int offset = JavaScriptFrameConstants::kParam0Offset; |
| 493 return caller_sp() + offset - (n * kPointerSize); |
| 494 } |
| 495 |
| 496 |
| 483 Code* ArgumentsAdaptorFrame::code() const { | 497 Code* ArgumentsAdaptorFrame::code() const { |
| 484 return Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline); | 498 return Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline); |
| 485 } | 499 } |
| 486 | 500 |
| 487 | 501 |
| 488 Code* InternalFrame::code() const { | 502 Code* InternalFrame::code() const { |
| 489 const int offset = InternalFrameConstants::kCodeOffset; | 503 const int offset = InternalFrameConstants::kCodeOffset; |
| 490 Object* code = Memory::Object_at(fp() + offset); | 504 Object* code = Memory::Object_at(fp() + offset); |
| 491 ASSERT(code != NULL); | 505 ASSERT(code != NULL); |
| 492 return Code::cast(code); | 506 return Code::cast(code); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 reg_code[i++] = r; | 748 reg_code[i++] = r; |
| 735 | 749 |
| 736 ASSERT(i == kNumJSCallerSaved); | 750 ASSERT(i == kNumJSCallerSaved); |
| 737 } | 751 } |
| 738 ASSERT(0 <= n && n < kNumJSCallerSaved); | 752 ASSERT(0 <= n && n < kNumJSCallerSaved); |
| 739 return reg_code[n]; | 753 return reg_code[n]; |
| 740 } | 754 } |
| 741 | 755 |
| 742 | 756 |
| 743 } } // namespace v8::internal | 757 } } // namespace v8::internal |
| OLD | NEW |