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

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

Issue 11437016: Use count-based profiling exclusively. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Renamings. Created 8 years 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 | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/deoptimizer-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ReplaceCodeForRelatedFunctions(function, code); 107 ReplaceCodeForRelatedFunctions(function, code);
108 108
109 if (FLAG_trace_deopt) { 109 if (FLAG_trace_deopt) {
110 PrintF("[forced deoptimization: "); 110 PrintF("[forced deoptimization: ");
111 function->PrintName(); 111 function->PrintName();
112 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 112 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
113 } 113 }
114 } 114 }
115 115
116 116
117 static const int32_t kBranchBeforeStackCheck = 0x2a000001; 117 static const int32_t kBranchBeforeStackCheck = 0x2a000001;
Jakob Kummerow 2012/12/06 16:25:41 not needed anymore, please remove.
Sven Panne 2012/12/07 08:54:56 Interesting... I thought that g++ would emit a war
118 static const int32_t kBranchBeforeInterrupt = 0x5a000004; 118 static const int32_t kBranchBeforeInterrupt = 0x5a000004;
119 119
120 120
121 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, 121 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
122 Address pc_after, 122 Address pc_after,
123 Code* check_code, 123 Code* check_code,
124 Code* replacement_code) { 124 Code* replacement_code) {
125 const int kInstrSize = Assembler::kInstrSize; 125 const int kInstrSize = Assembler::kInstrSize;
126 // The call of the stack guard check has the following form: 126 // The call of the stack guard check has the following form:
127 // e1 5d 00 0c cmp sp, <limit> 127 // e1 5d 00 0c cmp sp, <limit>
Jakob Kummerow 2012/12/06 16:25:41 please update this comment
Sven Panne 2012/12/07 08:54:56 Done.
128 // 2a 00 00 01 bcs ok 128 // 2a 00 00 01 bcs ok
129 // e5 9f c? ?? ldr ip, [pc, <stack guard address>] 129 // e5 9f c? ?? ldr ip, [pc, <stack guard address>]
130 // e1 2f ff 3c blx ip 130 // e1 2f ff 3c blx ip
131 ASSERT(Memory::int32_at(pc_after - kInstrSize) == kBlxIp); 131 ASSERT(Memory::int32_at(pc_after - kInstrSize) == kBlxIp);
132 ASSERT(Assembler::IsLdrPcImmediateOffset( 132 ASSERT(Assembler::IsLdrPcImmediateOffset(
133 Assembler::instr_at(pc_after - 2 * kInstrSize))); 133 Assembler::instr_at(pc_after - 2 * kInstrSize)));
134 if (FLAG_count_based_interrupts) { 134 ASSERT_EQ(kBranchBeforeInterrupt,
135 ASSERT_EQ(kBranchBeforeInterrupt, 135 Memory::int32_at(pc_after - 3 * kInstrSize));
136 Memory::int32_at(pc_after - 3 * kInstrSize));
137 } else {
138 ASSERT_EQ(kBranchBeforeStackCheck,
139 Memory::int32_at(pc_after - 3 * kInstrSize));
140 }
141 136
142 // We patch the code to the following form: 137 // We patch the code to the following form:
143 // e1 5d 00 0c cmp sp, <limit> 138 // e1 5d 00 0c cmp sp, <limit>
144 // e1 a0 00 00 mov r0, r0 (NOP) 139 // e1 a0 00 00 mov r0, r0 (NOP)
145 // e5 9f c? ?? ldr ip, [pc, <on-stack replacement address>] 140 // e5 9f c? ?? ldr ip, [pc, <on-stack replacement address>]
146 // e1 2f ff 3c blx ip 141 // e1 2f ff 3c blx ip
147 // and overwrite the constant containing the 142 // and overwrite the constant containing the
148 // address of the stack check stub. 143 // address of the stack check stub.
149 144
150 // Replace conditional jump with NOP. 145 // Replace conditional jump with NOP.
(...skipping 19 matching lines...) Expand all
170 Address pc_after, 165 Address pc_after,
171 Code* check_code, 166 Code* check_code,
172 Code* replacement_code) { 167 Code* replacement_code) {
173 const int kInstrSize = Assembler::kInstrSize; 168 const int kInstrSize = Assembler::kInstrSize;
174 ASSERT(Memory::int32_at(pc_after - kInstrSize) == kBlxIp); 169 ASSERT(Memory::int32_at(pc_after - kInstrSize) == kBlxIp);
175 ASSERT(Assembler::IsLdrPcImmediateOffset( 170 ASSERT(Assembler::IsLdrPcImmediateOffset(
176 Assembler::instr_at(pc_after - 2 * kInstrSize))); 171 Assembler::instr_at(pc_after - 2 * kInstrSize)));
177 172
178 // Replace NOP with conditional jump. 173 // Replace NOP with conditional jump.
179 CodePatcher patcher(pc_after - 3 * kInstrSize, 1); 174 CodePatcher patcher(pc_after - 3 * kInstrSize, 1);
180 if (FLAG_count_based_interrupts) { 175 patcher.masm()->b(+16, pl);
181 patcher.masm()->b(+16, pl); 176 ASSERT_EQ(kBranchBeforeInterrupt,
182 ASSERT_EQ(kBranchBeforeInterrupt, 177 Memory::int32_at(pc_after - 3 * kInstrSize));
183 Memory::int32_at(pc_after - 3 * kInstrSize));
184 } else {
185 patcher.masm()->b(+4, cs);
186 ASSERT_EQ(kBranchBeforeStackCheck,
187 Memory::int32_at(pc_after - 3 * kInstrSize));
188 }
189 178
190 // Replace the stack check address in the constant pool 179 // Replace the stack check address in the constant pool
191 // with the entry address of the replacement code. 180 // with the entry address of the replacement code.
192 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - 181 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
193 2 * kInstrSize) & 0xfff; 182 2 * kInstrSize) & 0xfff;
194 Address stack_check_address_pointer = pc_after + stack_check_address_offset; 183 Address stack_check_address_pointer = pc_after + stack_check_address_offset;
195 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 184 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
196 reinterpret_cast<uint32_t>(replacement_code->entry())); 185 reinterpret_cast<uint32_t>(replacement_code->entry()));
197 Memory::uint32_at(stack_check_address_pointer) = 186 Memory::uint32_at(stack_check_address_pointer) =
198 reinterpret_cast<uint32_t>(check_code->entry()); 187 reinterpret_cast<uint32_t>(check_code->entry());
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 __ push(ip); 1179 __ push(ip);
1191 __ b(&done); 1180 __ b(&done);
1192 ASSERT(masm()->pc_offset() - start == table_entry_size_); 1181 ASSERT(masm()->pc_offset() - start == table_entry_size_);
1193 } 1182 }
1194 __ bind(&done); 1183 __ bind(&done);
1195 } 1184 }
1196 1185
1197 #undef __ 1186 #undef __
1198 1187
1199 } } // namespace v8::internal 1188 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/deoptimizer-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698