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

Side by Side Diff: src/arm/virtual-frame-arm.cc

Issue 164316: Remove much of the register allocation overhead from ARM. When... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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
« no previous file with comments | « src/arm/virtual-frame-arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 180
181 void VirtualFrame::PushTryHandler(HandlerType type) { 181 void VirtualFrame::PushTryHandler(HandlerType type) {
182 // Grow the expression stack by handler size less one (the return 182 // Grow the expression stack by handler size less one (the return
183 // address in lr is already counted by a call instruction). 183 // address in lr is already counted by a call instruction).
184 Adjust(kHandlerSize - 1); 184 Adjust(kHandlerSize - 1);
185 __ PushTryHandler(IN_JAVASCRIPT, type); 185 __ PushTryHandler(IN_JAVASCRIPT, type);
186 } 186 }
187 187
188 188
189 Result VirtualFrame::RawCallStub(CodeStub* stub) { 189 void VirtualFrame::RawCallStub(CodeStub* stub) {
190 ASSERT(cgen()->HasValidEntryRegisters()); 190 ASSERT(cgen()->HasValidEntryRegisters());
191 __ CallStub(stub); 191 __ CallStub(stub);
192 Result result = cgen()->allocator()->Allocate(r0);
193 ASSERT(result.is_valid());
194 return result;
195 } 192 }
196 193
197 194
198 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg) { 195 void VirtualFrame::CallStub(CodeStub* stub, Result* arg) {
199 PrepareForCall(0, 0); 196 PrepareForCall(0, 0);
200 arg->Unuse(); 197 arg->Unuse();
201 return RawCallStub(stub); 198 RawCallStub(stub);
202 } 199 }
203 200
204 201
205 Result VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) { 202 void VirtualFrame::CallStub(CodeStub* stub, Result* arg0, Result* arg1) {
206 PrepareForCall(0, 0); 203 PrepareForCall(0, 0);
207 arg0->Unuse(); 204 arg0->Unuse();
208 arg1->Unuse(); 205 arg1->Unuse();
209 return RawCallStub(stub); 206 RawCallStub(stub);
210 } 207 }
211 208
212 209
213 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { 210 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) {
214 PrepareForCall(arg_count, arg_count); 211 PrepareForCall(arg_count, arg_count);
215 ASSERT(cgen()->HasValidEntryRegisters()); 212 ASSERT(cgen()->HasValidEntryRegisters());
216 __ CallRuntime(f, arg_count); 213 __ CallRuntime(f, arg_count);
217 Result result = cgen()->allocator()->Allocate(r0);
218 ASSERT(result.is_valid());
219 return result;
220 } 214 }
221 215
222 216
223 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { 217 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) {
224 PrepareForCall(arg_count, arg_count); 218 PrepareForCall(arg_count, arg_count);
225 ASSERT(cgen()->HasValidEntryRegisters()); 219 ASSERT(cgen()->HasValidEntryRegisters());
226 __ CallRuntime(id, arg_count); 220 __ CallRuntime(id, arg_count);
227 Result result = cgen()->allocator()->Allocate(r0);
228 ASSERT(result.is_valid());
229 return result;
230 } 221 }
231 222
232 223
233 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, 224 void VirtualFrame::InvokeBuiltin(Builtins::JavaScript id,
234 InvokeJSFlags flags, 225 InvokeJSFlags flags,
235 Result* arg_count_register, 226 Result* arg_count_register,
236 int arg_count) { 227 int arg_count) {
237 ASSERT(arg_count_register->reg().is(r0)); 228 ASSERT(arg_count_register->reg().is(r0));
238 PrepareForCall(arg_count, arg_count); 229 PrepareForCall(arg_count, arg_count);
239 arg_count_register->Unuse(); 230 arg_count_register->Unuse();
240 __ InvokeBuiltin(id, flags); 231 __ InvokeBuiltin(id, flags);
241 Result result = cgen()->allocator()->Allocate(r0);
242 return result;
243 } 232 }
244 233
245 234
246 Result VirtualFrame::RawCallCodeObject(Handle<Code> code, 235 void VirtualFrame::RawCallCodeObject(Handle<Code> code,
247 RelocInfo::Mode rmode) { 236 RelocInfo::Mode rmode) {
248 ASSERT(cgen()->HasValidEntryRegisters()); 237 ASSERT(cgen()->HasValidEntryRegisters());
249 __ Call(code, rmode); 238 __ Call(code, rmode);
250 Result result = cgen()->allocator()->Allocate(r0);
251 ASSERT(result.is_valid());
252 return result;
253 } 239 }
254 240
255 241
256 Result VirtualFrame::CallCodeObject(Handle<Code> code, 242 void VirtualFrame::CallCodeObject(Handle<Code> code,
257 RelocInfo::Mode rmode, 243 RelocInfo::Mode rmode,
258 int dropped_args) { 244 int dropped_args) {
259 int spilled_args = 0; 245 int spilled_args = 0;
260 switch (code->kind()) { 246 switch (code->kind()) {
261 case Code::CALL_IC: 247 case Code::CALL_IC:
262 spilled_args = dropped_args + 1; 248 spilled_args = dropped_args + 1;
263 break; 249 break;
264 case Code::FUNCTION: 250 case Code::FUNCTION:
265 spilled_args = dropped_args + 1; 251 spilled_args = dropped_args + 1;
266 break; 252 break;
267 case Code::KEYED_LOAD_IC: 253 case Code::KEYED_LOAD_IC:
268 ASSERT(dropped_args == 0); 254 ASSERT(dropped_args == 0);
269 spilled_args = 2; 255 spilled_args = 2;
270 break; 256 break;
271 default: 257 default:
272 // The other types of code objects are called with values 258 // The other types of code objects are called with values
273 // in specific registers, and are handled in functions with 259 // in specific registers, and are handled in functions with
274 // a different signature. 260 // a different signature.
275 UNREACHABLE(); 261 UNREACHABLE();
276 break; 262 break;
277 } 263 }
278 PrepareForCall(spilled_args, dropped_args); 264 PrepareForCall(spilled_args, dropped_args);
279 return RawCallCodeObject(code, rmode); 265 RawCallCodeObject(code, rmode);
280 } 266 }
281 267
282 268
283 Result VirtualFrame::CallCodeObject(Handle<Code> code, 269 void VirtualFrame::CallCodeObject(Handle<Code> code,
284 RelocInfo::Mode rmode, 270 RelocInfo::Mode rmode,
285 Result* arg, 271 Result* arg,
286 int dropped_args) { 272 int dropped_args) {
287 int spilled_args = 0; 273 int spilled_args = 0;
288 switch (code->kind()) { 274 switch (code->kind()) {
289 case Code::LOAD_IC: 275 case Code::LOAD_IC:
290 ASSERT(arg->reg().is(r2)); 276 ASSERT(arg->reg().is(r2));
291 ASSERT(dropped_args == 0); 277 ASSERT(dropped_args == 0);
292 spilled_args = 1; 278 spilled_args = 1;
293 break; 279 break;
294 case Code::KEYED_STORE_IC: 280 case Code::KEYED_STORE_IC:
295 ASSERT(arg->reg().is(r0)); 281 ASSERT(arg->reg().is(r0));
296 ASSERT(dropped_args == 0); 282 ASSERT(dropped_args == 0);
297 spilled_args = 2; 283 spilled_args = 2;
298 break; 284 break;
299 default: 285 default:
300 // No other types of code objects are called with values 286 // No other types of code objects are called with values
301 // in exactly one register. 287 // in exactly one register.
302 UNREACHABLE(); 288 UNREACHABLE();
303 break; 289 break;
304 } 290 }
305 PrepareForCall(spilled_args, dropped_args); 291 PrepareForCall(spilled_args, dropped_args);
306 arg->Unuse(); 292 arg->Unuse();
307 return RawCallCodeObject(code, rmode); 293 RawCallCodeObject(code, rmode);
308 } 294 }
309 295
310 296
311 Result VirtualFrame::CallCodeObject(Handle<Code> code, 297 void VirtualFrame::CallCodeObject(Handle<Code> code,
312 RelocInfo::Mode rmode, 298 RelocInfo::Mode rmode,
313 Result* arg0, 299 Result* arg0,
314 Result* arg1, 300 Result* arg1,
315 int dropped_args) { 301 int dropped_args) {
316 int spilled_args = 1; 302 int spilled_args = 1;
317 switch (code->kind()) { 303 switch (code->kind()) {
318 case Code::STORE_IC: 304 case Code::STORE_IC:
319 ASSERT(arg0->reg().is(r0)); 305 ASSERT(arg0->reg().is(r0));
320 ASSERT(arg1->reg().is(r2)); 306 ASSERT(arg1->reg().is(r2));
321 ASSERT(dropped_args == 0); 307 ASSERT(dropped_args == 0);
322 spilled_args = 1; 308 spilled_args = 1;
323 break; 309 break;
324 case Code::BUILTIN: 310 case Code::BUILTIN:
325 ASSERT(*code == Builtins::builtin(Builtins::JSConstructCall)); 311 ASSERT(*code == Builtins::builtin(Builtins::JSConstructCall));
326 ASSERT(arg0->reg().is(r0)); 312 ASSERT(arg0->reg().is(r0));
327 ASSERT(arg1->reg().is(r1)); 313 ASSERT(arg1->reg().is(r1));
328 spilled_args = dropped_args + 1; 314 spilled_args = dropped_args + 1;
329 break; 315 break;
330 default: 316 default:
331 // No other types of code objects are called with values 317 // No other types of code objects are called with values
332 // in exactly two registers. 318 // in exactly two registers.
333 UNREACHABLE(); 319 UNREACHABLE();
334 break; 320 break;
335 } 321 }
336 PrepareForCall(spilled_args, dropped_args); 322 PrepareForCall(spilled_args, dropped_args);
337 arg0->Unuse(); 323 arg0->Unuse();
338 arg1->Unuse(); 324 arg1->Unuse();
339 return RawCallCodeObject(code, rmode); 325 RawCallCodeObject(code, rmode);
340 } 326 }
341 327
342 328
343 void VirtualFrame::Drop(int count) { 329 void VirtualFrame::Drop(int count) {
344 ASSERT(count >= 0); 330 ASSERT(count >= 0);
345 ASSERT(height() >= count); 331 ASSERT(height() >= count);
346 int num_virtual_elements = (element_count() - 1) - stack_pointer_; 332 int num_virtual_elements = (element_count() - 1) - stack_pointer_;
347 333
348 // Emit code to lower the stack pointer if necessary. 334 // Emit code to lower the stack pointer if necessary.
349 if (num_virtual_elements < count) { 335 if (num_virtual_elements < count) {
(...skipping 30 matching lines...) Expand all
380 ASSERT(stack_pointer_ == element_count() - 1); 366 ASSERT(stack_pointer_ == element_count() - 1);
381 elements_.Add(FrameElement::MemoryElement()); 367 elements_.Add(FrameElement::MemoryElement());
382 stack_pointer_++; 368 stack_pointer_++;
383 __ push(reg); 369 __ push(reg);
384 } 370 }
385 371
386 372
387 #undef __ 373 #undef __
388 374
389 } } // namespace v8::internal 375 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/virtual-frame-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698