| 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 // Find the top invocation of the function by traversing frames. | 505 // Find the top invocation of the function by traversing frames. |
| 506 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { | 506 for (JavaScriptFrameIterator it; !it.done(); it.Advance()) { |
| 507 // Skip all frames that aren't invocations of the given function. | 507 // Skip all frames that aren't invocations of the given function. |
| 508 JavaScriptFrame* frame = it.frame(); | 508 JavaScriptFrame* frame = it.frame(); |
| 509 if (frame->function() != *function) continue; | 509 if (frame->function() != *function) continue; |
| 510 | 510 |
| 511 // If there is an arguments variable in the stack, we return that. | 511 // If there is an arguments variable in the stack, we return that. |
| 512 int index = ScopeInfo<>::StackSlotIndex(frame->code(), | 512 int index = ScopeInfo<>::StackSlotIndex(frame->code(), |
| 513 Heap::arguments_symbol()); | 513 Heap::arguments_symbol()); |
| 514 if (index >= 0) return frame->GetExpression(index); | 514 if (index >= 0) { |
| 515 Handle<Object> arguments = Handle<Object>(frame->GetExpression(index)); |
| 516 if (!arguments->IsTheHole()) return *arguments; |
| 517 } |
| 515 | 518 |
| 516 // If there isn't an arguments variable in the stack, we need to | 519 // If there isn't an arguments variable in the stack, we need to |
| 517 // find the frame that holds the actual arguments passed to the | 520 // find the frame that holds the actual arguments passed to the |
| 518 // function on the stack. | 521 // function on the stack. |
| 519 it.AdvanceToArgumentsFrame(); | 522 it.AdvanceToArgumentsFrame(); |
| 520 frame = it.frame(); | 523 frame = it.frame(); |
| 521 | 524 |
| 522 // Get the number of arguments and construct an arguments object | 525 // Get the number of arguments and construct an arguments object |
| 523 // mirror for the right frame. | 526 // mirror for the right frame. |
| 524 const int length = frame->GetProvidedParametersCount(); | 527 const int length = frame->GetProvidedParametersCount(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 645 } |
| 643 | 646 |
| 644 | 647 |
| 645 const AccessorDescriptor Accessors::ObjectPrototype = { | 648 const AccessorDescriptor Accessors::ObjectPrototype = { |
| 646 ObjectGetPrototype, | 649 ObjectGetPrototype, |
| 647 ObjectSetPrototype, | 650 ObjectSetPrototype, |
| 648 0 | 651 0 |
| 649 }; | 652 }; |
| 650 | 653 |
| 651 } } // namespace v8::internal | 654 } } // namespace v8::internal |
| OLD | NEW |