OLD | NEW |
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 Forget(arg_count + 1); | 261 Forget(arg_count + 1); |
262 ASSERT(cgen()->HasValidEntryRegisters()); | 262 ASSERT(cgen()->HasValidEntryRegisters()); |
263 ParameterCount count(arg_count); | 263 ParameterCount count(arg_count); |
264 __ InvokeFunction(r1, count, CALL_FUNCTION); | 264 __ InvokeFunction(r1, count, CALL_FUNCTION); |
265 // Restore the context. | 265 // Restore the context. |
266 __ ldr(cp, Context()); | 266 __ ldr(cp, Context()); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { | 270 void VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { |
| 271 ASSERT(SpilledScope::is_spilled()); |
271 Forget(arg_count); | 272 Forget(arg_count); |
272 ASSERT(cgen()->HasValidEntryRegisters()); | 273 ASSERT(cgen()->HasValidEntryRegisters()); |
273 __ CallRuntime(f, arg_count); | 274 __ CallRuntime(f, arg_count); |
274 } | 275 } |
275 | 276 |
276 | 277 |
277 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { | 278 void VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { |
278 Forget(arg_count); | 279 Forget(arg_count); |
279 ASSERT(cgen()->HasValidEntryRegisters()); | 280 ASSERT(cgen()->HasValidEntryRegisters()); |
280 __ CallRuntime(id, arg_count); | 281 __ CallRuntime(id, arg_count); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (top_of_stack_state_ == NO_TOS_REGISTERS) { | 390 if (top_of_stack_state_ == NO_TOS_REGISTERS) { |
390 __ pop(reg); | 391 __ pop(reg); |
391 } else { | 392 } else { |
392 __ mov(reg, kTopRegister[top_of_stack_state_]); | 393 __ mov(reg, kTopRegister[top_of_stack_state_]); |
393 top_of_stack_state_ = kStateAfterPop[top_of_stack_state_]; | 394 top_of_stack_state_ = kStateAfterPop[top_of_stack_state_]; |
394 } | 395 } |
395 element_count_--; | 396 element_count_--; |
396 } | 397 } |
397 | 398 |
398 | 399 |
| 400 void VirtualFrame::SpillAllButCopyTOSToR0() { |
| 401 switch (top_of_stack_state_) { |
| 402 case NO_TOS_REGISTERS: |
| 403 __ ldr(r0, MemOperand(sp, 0)); |
| 404 break; |
| 405 case R0_TOS: |
| 406 __ push(r0); |
| 407 break; |
| 408 case R1_TOS: |
| 409 __ push(r1); |
| 410 __ mov(r0, r1); |
| 411 break; |
| 412 case R0_R1_TOS: |
| 413 __ Push(r1, r0); |
| 414 break; |
| 415 case R1_R0_TOS: |
| 416 __ Push(r0, r1); |
| 417 __ mov(r0, r1); |
| 418 break; |
| 419 default: |
| 420 UNREACHABLE(); |
| 421 } |
| 422 top_of_stack_state_ = NO_TOS_REGISTERS; |
| 423 } |
| 424 |
| 425 |
399 Register VirtualFrame::Peek() { | 426 Register VirtualFrame::Peek() { |
400 AssertIsNotSpilled(); | 427 AssertIsNotSpilled(); |
401 if (top_of_stack_state_ == NO_TOS_REGISTERS) { | 428 if (top_of_stack_state_ == NO_TOS_REGISTERS) { |
402 top_of_stack_state_ = kStateAfterPush[top_of_stack_state_]; | 429 top_of_stack_state_ = kStateAfterPush[top_of_stack_state_]; |
403 Register answer = kTopRegister[top_of_stack_state_]; | 430 Register answer = kTopRegister[top_of_stack_state_]; |
404 __ pop(answer); | 431 __ pop(answer); |
405 return answer; | 432 return answer; |
406 } else { | 433 } else { |
407 return kTopRegister[top_of_stack_state_]; | 434 return kTopRegister[top_of_stack_state_]; |
408 } | 435 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 default: | 541 default: |
515 UNREACHABLE(); | 542 UNREACHABLE(); |
516 break; | 543 break; |
517 } | 544 } |
518 ASSERT(register_allocation_map_ == 0); // Not yet implemented. | 545 ASSERT(register_allocation_map_ == 0); // Not yet implemented. |
519 } | 546 } |
520 | 547 |
521 #undef __ | 548 #undef __ |
522 | 549 |
523 } } // namespace v8::internal | 550 } } // namespace v8::internal |
OLD | NEW |