Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 7230047: Remove the fcontext field from all contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } else if (function != NULL) { 673 } else if (function != NULL) {
674 VisitForAccumulatorValue(function); 674 VisitForAccumulatorValue(function);
675 __ movq(Operand(rbp, SlotOffset(slot)), result_register()); 675 __ movq(Operand(rbp, SlotOffset(slot)), result_register());
676 } 676 }
677 break; 677 break;
678 678
679 case Slot::CONTEXT: 679 case Slot::CONTEXT:
680 // We bypass the general EmitSlotSearch because we know more about 680 // We bypass the general EmitSlotSearch because we know more about
681 // this specific context. 681 // this specific context.
682 682
683 // The variable in the decl always resides in the current context. 683 // The variable in the decl always resides in the current function
684 // context.
684 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); 685 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope()));
685 if (FLAG_debug_code) { 686 if (FLAG_debug_code) {
686 // Check if we have the correct context pointer. 687 // Check that we're not inside a with or catch context.
687 __ movq(rbx, ContextOperand(rsi, Context::FCONTEXT_INDEX)); 688 __ movq(rbx, FieldOperand(rsi, HeapObject::kMapOffset));
688 __ cmpq(rbx, rsi); 689 __ CompareRoot(rbx, Heap::kWithContextMapRootIndex);
689 __ Check(equal, "Unexpected declaration in current context."); 690 __ Check(not_equal, "Declaration in with context.");
691 __ CompareRoot(rbx, Heap::kCatchContextMapRootIndex);
692 __ Check(not_equal, "Declaration in catch context.");
690 } 693 }
691 if (mode == Variable::CONST) { 694 if (mode == Variable::CONST) {
692 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); 695 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex);
693 __ movq(ContextOperand(rsi, slot->index()), kScratchRegister); 696 __ movq(ContextOperand(rsi, slot->index()), kScratchRegister);
694 // No write barrier since the hole value is in old space. 697 // No write barrier since the hole value is in old space.
695 } else if (function != NULL) { 698 } else if (function != NULL) {
696 VisitForAccumulatorValue(function); 699 VisitForAccumulatorValue(function);
697 __ movq(ContextOperand(rsi, slot->index()), result_register()); 700 __ movq(ContextOperand(rsi, slot->index()), result_register());
698 int offset = Context::SlotOffset(slot->index()); 701 int offset = Context::SlotOffset(slot->index());
699 __ movq(rbx, rsi); 702 __ movq(rbx, rsi);
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 case Slot::PARAMETER: 1774 case Slot::PARAMETER:
1772 // No const parameters. 1775 // No const parameters.
1773 UNREACHABLE(); 1776 UNREACHABLE();
1774 break; 1777 break;
1775 case Slot::LOCAL: 1778 case Slot::LOCAL:
1776 __ movq(rdx, Operand(rbp, SlotOffset(slot))); 1779 __ movq(rdx, Operand(rbp, SlotOffset(slot)));
1777 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); 1780 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
1778 __ j(not_equal, &skip); 1781 __ j(not_equal, &skip);
1779 __ movq(Operand(rbp, SlotOffset(slot)), rax); 1782 __ movq(Operand(rbp, SlotOffset(slot)), rax);
1780 break; 1783 break;
1781 case Slot::CONTEXT: { 1784 case Slot::CONTEXT:
1782 __ movq(rcx, ContextOperand(rsi, Context::FCONTEXT_INDEX));
1783 __ movq(rdx, ContextOperand(rcx, slot->index()));
1784 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
1785 __ j(not_equal, &skip);
1786 __ movq(ContextOperand(rcx, slot->index()), rax);
1787 int offset = Context::SlotOffset(slot->index());
1788 __ movq(rdx, rax); // Preserve the stored value in eax.
1789 __ RecordWrite(rcx, offset, rdx, rbx);
1790 break;
1791 }
1792 case Slot::LOOKUP: 1785 case Slot::LOOKUP:
1793 __ push(rax); 1786 __ push(rax);
1794 __ push(rsi); 1787 __ push(rsi);
1795 __ Push(var->name()); 1788 __ Push(var->name());
1796 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 1789 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
1797 break; 1790 break;
1798 } 1791 }
1799 __ bind(&skip); 1792 __ bind(&skip);
1800 1793
1801 } else if (var->mode() != Variable::CONST) { 1794 } else if (var->mode() != Variable::CONST) {
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 __ ret(0); 4223 __ ret(0);
4231 } 4224 }
4232 4225
4233 4226
4234 #undef __ 4227 #undef __
4235 4228
4236 4229
4237 } } // namespace v8::internal 4230 } } // namespace v8::internal
4238 4231
4239 #endif // V8_TARGET_ARCH_X64 4232 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698