| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 559 |
| 560 // | 560 // |
| 561 // Accessors::FunctionArguments | 561 // Accessors::FunctionArguments |
| 562 // | 562 // |
| 563 | 563 |
| 564 static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { | 564 static Address SlotAddress(JavaScriptFrame* frame, int slot_index) { |
| 565 if (slot_index >= 0) { | 565 if (slot_index >= 0) { |
| 566 const int offset = JavaScriptFrameConstants::kLocal0Offset; | 566 const int offset = JavaScriptFrameConstants::kLocal0Offset; |
| 567 return frame->fp() + offset - (slot_index * kPointerSize); | 567 return frame->fp() + offset - (slot_index * kPointerSize); |
| 568 } else { | 568 } else { |
| 569 const int offset = JavaScriptFrameConstants::kReceiverOffset; | 569 const int offset = JavaScriptFrameConstants::kSavedRegistersOffset; |
| 570 return frame->caller_sp() + offset + (slot_index * kPointerSize); | 570 return frame->fp() + offset - ((slot_index + 1) * kPointerSize); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 | 573 |
| 574 | 574 |
| 575 // We can't intermix stack decoding and allocations because | 575 // We can't intermix stack decoding and allocations because |
| 576 // deoptimization infrastracture is not GC safe. | 576 // deoptimization infrastracture is not GC safe. |
| 577 // Thus we build a temporary structure in malloced space. | 577 // Thus we build a temporary structure in malloced space. |
| 578 class SlotRef BASE_EMBEDDED { | 578 class SlotRef BASE_EMBEDDED { |
| 579 public: | 579 public: |
| 580 enum SlotRepresentation { | 580 enum SlotRepresentation { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 } | 784 } |
| 785 | 785 |
| 786 // If there is no arguments variable in the stack or we have an | 786 // If there is no arguments variable in the stack or we have an |
| 787 // optimized frame, we find the frame that holds the actual arguments | 787 // optimized frame, we find the frame that holds the actual arguments |
| 788 // passed to the function. | 788 // passed to the function. |
| 789 it.AdvanceToArgumentsFrame(); | 789 it.AdvanceToArgumentsFrame(); |
| 790 frame = it.frame(); | 790 frame = it.frame(); |
| 791 | 791 |
| 792 // Get the number of arguments and construct an arguments object | 792 // Get the number of arguments and construct an arguments object |
| 793 // mirror for the right frame. | 793 // mirror for the right frame. |
| 794 const int length = frame->GetProvidedParametersCount(); | 794 const int length = frame->ComputeParametersCount(); |
| 795 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, | 795 Handle<JSObject> arguments = Factory::NewArgumentsObject(function, |
| 796 length); | 796 length); |
| 797 Handle<FixedArray> array = Factory::NewFixedArray(length); | 797 Handle<FixedArray> array = Factory::NewFixedArray(length); |
| 798 | 798 |
| 799 // Copy the parameters to the arguments object. | 799 // Copy the parameters to the arguments object. |
| 800 ASSERT(array->length() == length); | 800 ASSERT(array->length() == length); |
| 801 for (int i = 0; i < length; i++) array->set(i, frame->GetParameter(i)); | 801 for (int i = 0; i < length; i++) { |
| 802 array->set(i, frame->GetParameter(i)); |
| 803 } |
| 802 arguments->set_elements(*array); | 804 arguments->set_elements(*array); |
| 803 | 805 |
| 804 // Return the freshly allocated arguments object. | 806 // Return the freshly allocated arguments object. |
| 805 return *arguments; | 807 return *arguments; |
| 806 } | 808 } |
| 807 functions.Rewind(0); | 809 functions.Rewind(0); |
| 808 } | 810 } |
| 809 | 811 |
| 810 // No frame corresponding to the given function found. Return null. | 812 // No frame corresponding to the given function found. Return null. |
| 811 return Heap::null_value(); | 813 return Heap::null_value(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 } | 900 } |
| 899 | 901 |
| 900 | 902 |
| 901 const AccessorDescriptor Accessors::ObjectPrototype = { | 903 const AccessorDescriptor Accessors::ObjectPrototype = { |
| 902 ObjectGetPrototype, | 904 ObjectGetPrototype, |
| 903 ObjectSetPrototype, | 905 ObjectSetPrototype, |
| 904 0 | 906 0 |
| 905 }; | 907 }; |
| 906 | 908 |
| 907 } } // namespace v8::internal | 909 } } // namespace v8::internal |
| OLD | NEW |