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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 600 |
601 MemOperand FullCodeGenerator::StackOperand(Variable* var) { | 601 MemOperand FullCodeGenerator::StackOperand(Variable* var) { |
602 ASSERT(var->IsStackAllocated()); | 602 ASSERT(var->IsStackAllocated()); |
603 // Offset is negative because higher indexes are at lower addresses. | 603 // Offset is negative because higher indexes are at lower addresses. |
604 int offset = -var->index() * kPointerSize; | 604 int offset = -var->index() * kPointerSize; |
605 // Adjust by a (parameter or local) base offset. | 605 // Adjust by a (parameter or local) base offset. |
606 if (var->IsParameter()) { | 606 if (var->IsParameter()) { |
607 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; | 607 offset += (info_->scope()->num_parameters() + 1) * kPointerSize; |
608 } else { | 608 } else { |
609 offset += JavaScriptFrameConstants::kLocal0Offset; | 609 offset += JavaScriptFrameConstants::kLocal0Offset; |
| 610 // Test if the variable is from a nested block scope. |
| 611 if (info_->scope() != var->scope()) { |
| 612 // Skip handlers and stack locals from enclosing block scopes. |
| 613 offset -= var->scope()->stack_slots_depth() * kPointerSize; |
| 614 } |
610 } | 615 } |
611 return Operand(rbp, offset); | 616 return Operand(rbp, offset); |
612 } | 617 } |
613 | 618 |
614 | 619 |
615 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { | 620 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { |
616 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); | 621 ASSERT(var->IsContextSlot() || var->IsStackAllocated()); |
617 if (var->IsContextSlot()) { | 622 if (var->IsContextSlot()) { |
618 int context_chain_length = scope()->ContextChainLength(var->scope()); | 623 int context_chain_length = scope()->ContextChainLength(var->scope()); |
619 __ LoadContext(scratch, context_chain_length); | 624 __ LoadContext(scratch, context_chain_length); |
(...skipping 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4346 *context_length = 0; | 4351 *context_length = 0; |
4347 return previous_; | 4352 return previous_; |
4348 } | 4353 } |
4349 | 4354 |
4350 | 4355 |
4351 #undef __ | 4356 #undef __ |
4352 | 4357 |
4353 } } // namespace v8::internal | 4358 } } // namespace v8::internal |
4354 | 4359 |
4355 #endif // V8_TARGET_ARCH_X64 | 4360 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |