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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 681 |
682 if (should_normalize) { | 682 if (should_normalize) { |
683 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 683 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
684 __ cmp(r0, ip); | 684 __ cmp(r0, ip); |
685 Split(eq, if_true, if_false, NULL); | 685 Split(eq, if_true, if_false, NULL); |
686 __ bind(&skip); | 686 __ bind(&skip); |
687 } | 687 } |
688 } | 688 } |
689 | 689 |
690 | 690 |
691 void FullCodeGenerator::EmitDeclaration(Variable* variable, | 691 void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, |
692 Variable::Mode mode, | 692 Variable::Mode mode, |
693 FunctionLiteral* function) { | 693 FunctionLiteral* function) { |
694 Comment cmnt(masm_, "[ Declaration"); | 694 Comment cmnt(masm_, "[ Declaration"); |
| 695 Variable* variable = proxy->var(); |
695 ASSERT(variable != NULL); // Must have been resolved. | 696 ASSERT(variable != NULL); // Must have been resolved. |
696 Slot* slot = variable->AsSlot(); | 697 Slot* slot = variable->AsSlot(); |
697 ASSERT(slot != NULL); | 698 ASSERT(slot != NULL); |
698 switch (slot->type()) { | 699 switch (slot->type()) { |
699 case Slot::PARAMETER: | 700 case Slot::PARAMETER: |
700 case Slot::LOCAL: | 701 case Slot::LOCAL: |
701 if (function != NULL) { | 702 if (function != NULL) { |
702 VisitForAccumulatorValue(function); | 703 VisitForAccumulatorValue(function); |
703 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); | 704 __ str(result_register(), MemOperand(fp, SlotOffset(slot))); |
704 } else if (mode == Variable::CONST || mode == Variable::LET) { | 705 } else if (mode == Variable::CONST || mode == Variable::LET) { |
(...skipping 17 matching lines...) Expand all Loading... |
722 __ CompareRoot(r1, Heap::kCatchContextMapRootIndex); | 723 __ CompareRoot(r1, Heap::kCatchContextMapRootIndex); |
723 __ Check(ne, "Declaration in catch context."); | 724 __ Check(ne, "Declaration in catch context."); |
724 } | 725 } |
725 if (function != NULL) { | 726 if (function != NULL) { |
726 VisitForAccumulatorValue(function); | 727 VisitForAccumulatorValue(function); |
727 __ str(result_register(), ContextOperand(cp, slot->index())); | 728 __ str(result_register(), ContextOperand(cp, slot->index())); |
728 int offset = Context::SlotOffset(slot->index()); | 729 int offset = Context::SlotOffset(slot->index()); |
729 // We know that we have written a function, which is not a smi. | 730 // We know that we have written a function, which is not a smi. |
730 __ mov(r1, Operand(cp)); | 731 __ mov(r1, Operand(cp)); |
731 __ RecordWrite(r1, Operand(offset), r2, result_register()); | 732 __ RecordWrite(r1, Operand(offset), r2, result_register()); |
| 733 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
732 } else if (mode == Variable::CONST || mode == Variable::LET) { | 734 } else if (mode == Variable::CONST || mode == Variable::LET) { |
733 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 735 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
734 __ str(ip, ContextOperand(cp, slot->index())); | 736 __ str(ip, ContextOperand(cp, slot->index())); |
735 // No write barrier since the_hole_value is in old space. | 737 // No write barrier since the_hole_value is in old space. |
| 738 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
736 } | 739 } |
737 break; | 740 break; |
738 | 741 |
739 case Slot::LOOKUP: { | 742 case Slot::LOOKUP: { |
740 __ mov(r2, Operand(variable->name())); | 743 __ mov(r2, Operand(variable->name())); |
741 // Declaration nodes are always introduced in one of two modes. | 744 // Declaration nodes are always introduced in one of two modes. |
742 ASSERT(mode == Variable::VAR || | 745 ASSERT(mode == Variable::VAR || |
743 mode == Variable::CONST || | 746 mode == Variable::CONST || |
744 mode == Variable::LET); | 747 mode == Variable::LET); |
745 PropertyAttributes attr = (mode == Variable::CONST) ? READ_ONLY : NONE; | 748 PropertyAttributes attr = (mode == Variable::CONST) ? READ_ONLY : NONE; |
(...skipping 14 matching lines...) Expand all Loading... |
760 __ Push(cp, r2, r1, r0); | 763 __ Push(cp, r2, r1, r0); |
761 } | 764 } |
762 __ CallRuntime(Runtime::kDeclareContextSlot, 4); | 765 __ CallRuntime(Runtime::kDeclareContextSlot, 4); |
763 break; | 766 break; |
764 } | 767 } |
765 } | 768 } |
766 } | 769 } |
767 | 770 |
768 | 771 |
769 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { | 772 void FullCodeGenerator::VisitDeclaration(Declaration* decl) { |
770 EmitDeclaration(decl->proxy()->var(), decl->mode(), decl->fun()); | 773 EmitDeclaration(decl->proxy(), decl->mode(), decl->fun()); |
771 } | 774 } |
772 | 775 |
773 | 776 |
774 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 777 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
775 // Call the runtime to declare the globals. | 778 // Call the runtime to declare the globals. |
776 // The context is the first argument. | 779 // The context is the first argument. |
777 __ mov(r1, Operand(pairs)); | 780 __ mov(r1, Operand(pairs)); |
778 __ mov(r0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); | 781 __ mov(r0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); |
779 __ Push(cp, r1, r0); | 782 __ Push(cp, r1, r0); |
780 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 783 __ CallRuntime(Runtime::kDeclareGlobals, 3); |
(...skipping 3489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4270 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4273 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4271 __ add(pc, r1, Operand(masm_->CodeObject())); | 4274 __ add(pc, r1, Operand(masm_->CodeObject())); |
4272 } | 4275 } |
4273 | 4276 |
4274 | 4277 |
4275 #undef __ | 4278 #undef __ |
4276 | 4279 |
4277 } } // namespace v8::internal | 4280 } } // namespace v8::internal |
4278 | 4281 |
4279 #endif // V8_TARGET_ARCH_ARM | 4282 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |