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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 174317: Reapply ARM root array change to reduce const pool size... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 LSL, 167 LSL,
168 assembler::arm::Instr::kInstrSizeLog2 - kSmiTagSize)); 168 assembler::arm::Instr::kInstrSizeLog2 - kSmiTagSize));
169 BlockConstPoolBefore(pc_offset() + (targets.length() + 1) * sizeof(Instr)); 169 BlockConstPoolBefore(pc_offset() + (targets.length() + 1) * sizeof(Instr));
170 nop(); // Jump table alignment. 170 nop(); // Jump table alignment.
171 for (int i = 0; i < targets.length(); i++) { 171 for (int i = 0; i < targets.length(); i++) {
172 b(targets[i]); 172 b(targets[i]);
173 } 173 }
174 } 174 }
175 175
176 176
177 void MacroAssembler::LoadRoot(Register destination,
178 Heap::RootListIndex index,
179 Condition cond) {
180 ldr(destination, MemOperand(r10, index << kPointerSizeLog2), cond);
181 }
182
183
177 // Will clobber 4 registers: object, offset, scratch, ip. The 184 // Will clobber 4 registers: object, offset, scratch, ip. The
178 // register 'object' contains a heap object pointer. The heap object 185 // register 'object' contains a heap object pointer. The heap object
179 // tag is shifted away. 186 // tag is shifted away.
180 void MacroAssembler::RecordWrite(Register object, Register offset, 187 void MacroAssembler::RecordWrite(Register object, Register offset,
181 Register scratch) { 188 Register scratch) {
182 // This is how much we shift the remembered set bit offset to get the 189 // This is how much we shift the remembered set bit offset to get the
183 // offset of the word in the remembered set. We divide by kBitsPerInt (32, 190 // offset of the word in the remembered set. We divide by kBitsPerInt (32,
184 // shift right 5) and then multiply by kIntSize (4, shift left 2). 191 // shift right 5) and then multiply by kIntSize (4, shift left 2).
185 const int kRSetWordShift = 3; 192 const int kRSetWordShift = 3;
186 193
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); 714 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
708 715
709 // Check the context is a global context. 716 // Check the context is a global context.
710 if (FLAG_debug_code) { 717 if (FLAG_debug_code) {
711 // TODO(119): avoid push(holder_reg)/pop(holder_reg) 718 // TODO(119): avoid push(holder_reg)/pop(holder_reg)
712 // Cannot use ip as a temporary in this verification code. Due to the fact 719 // Cannot use ip as a temporary in this verification code. Due to the fact
713 // that ip is clobbered as part of cmp with an object Operand. 720 // that ip is clobbered as part of cmp with an object Operand.
714 push(holder_reg); // Temporarily save holder on the stack. 721 push(holder_reg); // Temporarily save holder on the stack.
715 // Read the first word and compare to the global_context_map. 722 // Read the first word and compare to the global_context_map.
716 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); 723 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
717 cmp(holder_reg, Operand(Factory::global_context_map())); 724 LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
725 cmp(holder_reg, ip);
718 Check(eq, "JSGlobalObject::global_context should be a global context."); 726 Check(eq, "JSGlobalObject::global_context should be a global context.");
719 pop(holder_reg); // Restore holder. 727 pop(holder_reg); // Restore holder.
720 } 728 }
721 729
722 // Check if both contexts are the same. 730 // Check if both contexts are the same.
723 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); 731 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset));
724 cmp(scratch, Operand(ip)); 732 cmp(scratch, Operand(ip));
725 b(eq, &same_contexts); 733 b(eq, &same_contexts);
726 734
727 // Check the context is a global context. 735 // Check the context is a global context.
728 if (FLAG_debug_code) { 736 if (FLAG_debug_code) {
729 // TODO(119): avoid push(holder_reg)/pop(holder_reg) 737 // TODO(119): avoid push(holder_reg)/pop(holder_reg)
730 // Cannot use ip as a temporary in this verification code. Due to the fact 738 // Cannot use ip as a temporary in this verification code. Due to the fact
731 // that ip is clobbered as part of cmp with an object Operand. 739 // that ip is clobbered as part of cmp with an object Operand.
732 push(holder_reg); // Temporarily save holder on the stack. 740 push(holder_reg); // Temporarily save holder on the stack.
733 mov(holder_reg, ip); // Move ip to its holding place. 741 mov(holder_reg, ip); // Move ip to its holding place.
734 cmp(holder_reg, Operand(Factory::null_value())); 742 LoadRoot(ip, Heap::kNullValueRootIndex);
743 cmp(holder_reg, ip);
735 Check(ne, "JSGlobalProxy::context() should not be null."); 744 Check(ne, "JSGlobalProxy::context() should not be null.");
736 745
737 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); 746 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset));
738 cmp(holder_reg, Operand(Factory::global_context_map())); 747 LoadRoot(ip, Heap::kGlobalContextMapRootIndex);
748 cmp(holder_reg, ip);
739 Check(eq, "JSGlobalObject::global_context should be a global context."); 749 Check(eq, "JSGlobalObject::global_context should be a global context.");
740 // Restore ip is not needed. ip is reloaded below. 750 // Restore ip is not needed. ip is reloaded below.
741 pop(holder_reg); // Restore holder. 751 pop(holder_reg); // Restore holder.
742 // Restore ip to holder's context. 752 // Restore ip to holder's context.
743 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); 753 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset));
744 } 754 }
745 755
746 // Check that the security token in the calling global object is 756 // Check that the security token in the calling global object is
747 // compatible with the security token in the receiving global 757 // compatible with the security token in the receiving global
748 // object. 758 // object.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); 795 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype));
786 b(ne, &non_instance); 796 b(ne, &non_instance);
787 797
788 // Get the prototype or initial map from the function. 798 // Get the prototype or initial map from the function.
789 ldr(result, 799 ldr(result,
790 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 800 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
791 801
792 // If the prototype or initial map is the hole, don't return it and 802 // If the prototype or initial map is the hole, don't return it and
793 // simply miss the cache instead. This will allow us to allocate a 803 // simply miss the cache instead. This will allow us to allocate a
794 // prototype object on-demand in the runtime system. 804 // prototype object on-demand in the runtime system.
795 cmp(result, Operand(Factory::the_hole_value())); 805 LoadRoot(ip, Heap::kTheHoleValueRootIndex);
806 cmp(result, ip);
796 b(eq, miss); 807 b(eq, miss);
797 808
798 // If the function does not have an initial map, we're done. 809 // If the function does not have an initial map, we're done.
799 Label done; 810 Label done;
800 CompareObjectType(result, scratch, scratch, MAP_TYPE); 811 CompareObjectType(result, scratch, scratch, MAP_TYPE);
801 b(ne, &done); 812 b(ne, &done);
802 813
803 // Get the prototype from the initial map. 814 // Get the prototype from the initial map.
804 ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); 815 ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
805 jmp(&done); 816 jmp(&done);
(...skipping 19 matching lines...) Expand all
825 if (argc > 1) 836 if (argc > 1)
826 add(sp, sp, Operand((argc - 1) * kPointerSize)); 837 add(sp, sp, Operand((argc - 1) * kPointerSize));
827 Ret(); 838 Ret();
828 } 839 }
829 840
830 841
831 void MacroAssembler::IllegalOperation(int num_arguments) { 842 void MacroAssembler::IllegalOperation(int num_arguments) {
832 if (num_arguments > 0) { 843 if (num_arguments > 0) {
833 add(sp, sp, Operand(num_arguments * kPointerSize)); 844 add(sp, sp, Operand(num_arguments * kPointerSize));
834 } 845 }
835 mov(r0, Operand(Factory::undefined_value())); 846 LoadRoot(r0, Heap::kUndefinedValueRootIndex);
836 } 847 }
837 848
838 849
839 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { 850 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
840 // All parameters are on the stack. r0 has the return value after call. 851 // All parameters are on the stack. r0 has the return value after call.
841 852
842 // If the expected number of arguments of the runtime function is 853 // If the expected number of arguments of the runtime function is
843 // constant, we check that the actual number of arguments match the 854 // constant, we check that the actual number of arguments match the
844 // expectation. 855 // expectation.
845 if (f->nargs >= 0 && f->nargs != num_arguments) { 856 if (f->nargs >= 0 && f->nargs != num_arguments) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 #endif 1016 #endif
1006 mov(r0, Operand(p0)); 1017 mov(r0, Operand(p0));
1007 push(r0); 1018 push(r0);
1008 mov(r0, Operand(Smi::FromInt(p1 - p0))); 1019 mov(r0, Operand(Smi::FromInt(p1 - p0)));
1009 push(r0); 1020 push(r0);
1010 CallRuntime(Runtime::kAbort, 2); 1021 CallRuntime(Runtime::kAbort, 2);
1011 // will not return here 1022 // will not return here
1012 } 1023 }
1013 1024
1014 } } // namespace v8::internal 1025 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698