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

Side by Side Diff: src/arm/deoptimizer-arm.cc

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize; 93 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize;
94 ASSERT(call_size_in_bytes % Assembler::kInstrSize == 0); 94 ASSERT(call_size_in_bytes % Assembler::kInstrSize == 0);
95 ASSERT(call_size_in_bytes <= patch_size()); 95 ASSERT(call_size_in_bytes <= patch_size());
96 CodePatcher patcher(code->instruction_start() + last_pc_offset, 96 CodePatcher patcher(code->instruction_start() + last_pc_offset,
97 call_size_in_words); 97 call_size_in_words);
98 patcher.masm()->Call(deoptimization_entry, RelocInfo::NONE); 98 patcher.masm()->Call(deoptimization_entry, RelocInfo::NONE);
99 last_pc_offset += call_size_in_bytes; 99 last_pc_offset += call_size_in_bytes;
100 } 100 }
101 } 101 }
102 102
103
104 #ifdef DEBUG 103 #ifdef DEBUG
105 // Destroy the code which is not supposed to be run again. 104 // Destroy the code which is not supposed to be run again.
106 int instructions = 105 int instructions =
107 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize; 106 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize;
108 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 107 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
109 instructions); 108 instructions);
110 for (int x = 0; x < instructions; x++) { 109 for (int x = 0; x < instructions; x++) {
111 destroyer.masm()->bkpt(0); 110 destroyer.masm()->bkpt(0);
112 } 111 }
113 #endif 112 #endif
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Replace the stack check address in the constant pool 170 // Replace the stack check address in the constant pool
172 // with the entry address of the replacement code. 171 // with the entry address of the replacement code.
173 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - 172 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
174 2 * kInstrSize) & 0xfff; 173 2 * kInstrSize) & 0xfff;
175 Address stack_check_address_pointer = pc_after + stack_check_address_offset; 174 Address stack_check_address_pointer = pc_after + stack_check_address_offset;
176 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 175 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
177 reinterpret_cast<uint32_t>(check_code->entry())); 176 reinterpret_cast<uint32_t>(check_code->entry()));
178 Memory::uint32_at(stack_check_address_pointer) = 177 Memory::uint32_at(stack_check_address_pointer) =
179 reinterpret_cast<uint32_t>(replacement_code->entry()); 178 reinterpret_cast<uint32_t>(replacement_code->entry());
180 179
181 RelocInfo rinfo(pc_after - 2 * kInstrSize, 180 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
182 RelocInfo::CODE_TARGET, 181 unoptimized_code, pc_after - 2 * kInstrSize, replacement_code);
183 0,
184 unoptimized_code);
185 unoptimized_code->GetHeap()->incremental_marking()->RecordWriteIntoCode(
186 unoptimized_code, &rinfo, replacement_code);
187 } 182 }
188 183
189 184
190 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 185 void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code,
186 Address pc_after,
191 Code* check_code, 187 Code* check_code,
192 Code* replacement_code) { 188 Code* replacement_code) {
193 const int kInstrSize = Assembler::kInstrSize; 189 const int kInstrSize = Assembler::kInstrSize;
194 ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c); 190 ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c);
195 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5); 191 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5);
196 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f); 192 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f);
197 193
198 // Replace NOP with conditional jump. 194 // Replace NOP with conditional jump.
199 CodePatcher patcher(pc_after - 3 * kInstrSize, 1); 195 CodePatcher patcher(pc_after - 3 * kInstrSize, 1);
200 patcher.masm()->b(+4, cs); 196 patcher.masm()->b(+4, cs);
201 197
202 // Replace the stack check address in the constant pool 198 // Replace the stack check address in the constant pool
203 // with the entry address of the replacement code. 199 // with the entry address of the replacement code.
204 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - 200 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
205 2 * kInstrSize) & 0xfff; 201 2 * kInstrSize) & 0xfff;
206 Address stack_check_address_pointer = pc_after + stack_check_address_offset; 202 Address stack_check_address_pointer = pc_after + stack_check_address_offset;
207 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 203 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
208 reinterpret_cast<uint32_t>(replacement_code->entry())); 204 reinterpret_cast<uint32_t>(replacement_code->entry()));
209 Memory::uint32_at(stack_check_address_pointer) = 205 Memory::uint32_at(stack_check_address_pointer) =
210 reinterpret_cast<uint32_t>(check_code->entry()); 206 reinterpret_cast<uint32_t>(check_code->entry());
211 207
212 check_code->GetHeap()->incremental_marking()-> 208 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
213 RecordCodeTargetPatch(pc_after - 2 * kInstrSize, check_code); 209 unoptimized_code, pc_after - 2 * kInstrSize, check_code);
214 } 210 }
215 211
216 212
217 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 213 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
218 ByteArray* translations = data->TranslationByteArray(); 214 ByteArray* translations = data->TranslationByteArray();
219 int length = data->DeoptCount(); 215 int length = data->DeoptCount();
220 for (int i = 0; i < length; i++) { 216 for (int i = 0; i < length; i++) {
221 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 217 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
222 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 218 TranslationIterator it(translations, data->TranslationIndex(i)->value());
223 int value = it.Next(); 219 int value = it.Next();
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 // r1 = one past the last FrameDescription**. 716 // r1 = one past the last FrameDescription**.
721 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset())); 717 __ ldr(r1, MemOperand(r0, Deoptimizer::output_count_offset()));
722 __ ldr(r0, MemOperand(r0, Deoptimizer::output_offset())); // r0 is output_. 718 __ ldr(r0, MemOperand(r0, Deoptimizer::output_offset())); // r0 is output_.
723 __ add(r1, r0, Operand(r1, LSL, 2)); 719 __ add(r1, r0, Operand(r1, LSL, 2));
724 __ bind(&outer_push_loop); 720 __ bind(&outer_push_loop);
725 // Inner loop state: r2 = current FrameDescription*, r3 = loop index. 721 // Inner loop state: r2 = current FrameDescription*, r3 = loop index.
726 __ ldr(r2, MemOperand(r0, 0)); // output_[ix] 722 __ ldr(r2, MemOperand(r0, 0)); // output_[ix]
727 __ ldr(r3, MemOperand(r2, FrameDescription::frame_size_offset())); 723 __ ldr(r3, MemOperand(r2, FrameDescription::frame_size_offset()));
728 __ bind(&inner_push_loop); 724 __ bind(&inner_push_loop);
729 __ sub(r3, r3, Operand(sizeof(uint32_t))); 725 __ sub(r3, r3, Operand(sizeof(uint32_t)));
730 // __ add(r6, r2, Operand(r3, LSL, 1));
731 __ add(r6, r2, Operand(r3)); 726 __ add(r6, r2, Operand(r3));
732 __ ldr(r7, MemOperand(r6, FrameDescription::frame_content_offset())); 727 __ ldr(r7, MemOperand(r6, FrameDescription::frame_content_offset()));
733 __ push(r7); 728 __ push(r7);
734 __ cmp(r3, Operand(0)); 729 __ cmp(r3, Operand(0));
735 __ b(ne, &inner_push_loop); // test for gt? 730 __ b(ne, &inner_push_loop); // test for gt?
736 __ add(r0, r0, Operand(kPointerSize)); 731 __ add(r0, r0, Operand(kPointerSize));
737 __ cmp(r0, r1); 732 __ cmp(r0, r1);
738 __ b(lt, &outer_push_loop); 733 __ b(lt, &outer_push_loop);
739 734
740 // Push state, pc, and continuation from the last output frame. 735 // Push state, pc, and continuation from the last output frame.
(...skipping 13 matching lines...) Expand all
754 __ ldr(r6, MemOperand(r2, offset)); 749 __ ldr(r6, MemOperand(r2, offset));
755 __ push(r6); 750 __ push(r6);
756 } 751 }
757 752
758 // Restore the registers from the stack. 753 // Restore the registers from the stack.
759 __ ldm(ia_w, sp, restored_regs); // all but pc registers. 754 __ ldm(ia_w, sp, restored_regs); // all but pc registers.
760 __ pop(ip); // remove sp 755 __ pop(ip); // remove sp
761 __ pop(ip); // remove lr 756 __ pop(ip); // remove lr
762 757
763 // Set up the roots register. 758 // Set up the roots register.
764 ExternalReference roots_address = ExternalReference::roots_address(isolate); 759 ExternalReference roots_array_start =
765 __ mov(r10, Operand(roots_address)); 760 ExternalReference::roots_array_start(isolate);
761 __ mov(r10, Operand(roots_array_start));
766 762
767 __ pop(ip); // remove pc 763 __ pop(ip); // remove pc
768 __ pop(r7); // get continuation, leave pc on stack 764 __ pop(r7); // get continuation, leave pc on stack
769 __ pop(lr); 765 __ pop(lr);
770 __ Jump(r7); 766 __ Jump(r7);
771 __ stop("Unreachable."); 767 __ stop("Unreachable.");
772 } 768 }
773 769
774 770
775 void Deoptimizer::TableEntryGenerator::GeneratePrologue() { 771 void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
(...skipping 13 matching lines...) Expand all
789 __ push(ip); 785 __ push(ip);
790 __ b(&done); 786 __ b(&done);
791 ASSERT(masm()->pc_offset() - start == table_entry_size_); 787 ASSERT(masm()->pc_offset() - start == table_entry_size_);
792 } 788 }
793 __ bind(&done); 789 __ bind(&done);
794 } 790 }
795 791
796 #undef __ 792 #undef __
797 793
798 } } // namespace v8::internal 794 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698