OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 641 |
642 MemOperand FullCodeGenerator::StackOperand(Variable* var) { | 642 MemOperand FullCodeGenerator::StackOperand(Variable* var) { |
643 ASSERT(var->IsStackAllocated()); | 643 ASSERT(var->IsStackAllocated()); |
644 // Offset is negative because higher indexes are at lower addresses. | 644 // Offset is negative because higher indexes are at lower addresses. |
645 int offset = -var->index() * kPointerSize; | 645 int offset = -var->index() * kPointerSize; |
646 // Adjust by a (parameter or local) base offset. | 646 // Adjust by a (parameter or local) base offset. |
647 if (var->IsParameter()) { | 647 if (var->IsParameter()) { |
648 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; | 648 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; |
649 } else { | 649 } else { |
650 offset += JavaScriptFrameConstants::kLocal0Offset; | 650 offset += JavaScriptFrameConstants::kLocal0Offset; |
| 651 // Test if the variable is from a nested block scope. |
| 652 if (info_->scope() != var->scope()) { |
| 653 // Skip handlers and stack locals from enclosing block scopes. |
| 654 offset -= var->scope()->stack_slots_depth() * kPointerSize; |
| 655 } |
651 } | 656 } |
652 return MemOperand(fp, offset); | 657 return MemOperand(fp, offset); |
653 } | 658 } |
654 | 659 |
655 | 660 |
656 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { | 661 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { |
657 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); | 662 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); |
658 if (var->IsContextSlot()) { | 663 if (var->IsContextSlot()) { |
659 int context_chain_length = scope()->ContextChainLength(var->scope()); | 664 int context_chain_length = scope()->ContextChainLength(var->scope()); |
660 __ LoadContext(scratch, context_chain_length); | 665 __ LoadContext(scratch, context_chain_length); |
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4438 *context_length = 0; | 4443 *context_length = 0; |
4439 return previous_; | 4444 return previous_; |
4440 } | 4445 } |
4441 | 4446 |
4442 | 4447 |
4443 #undef __ | 4448 #undef __ |
4444 | 4449 |
4445 } } // namespace v8::internal | 4450 } } // namespace v8::internal |
4446 | 4451 |
4447 #endif // V8_TARGET_ARCH_MIPS | 4452 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |