OLD | NEW |
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // Convenience function: call an external reference. | 453 // Convenience function: call an external reference. |
454 void CallExternalReference(ExternalReference ref, int num_arguments); | 454 void CallExternalReference(ExternalReference ref, int num_arguments); |
455 | 455 |
456 // Tail call of a runtime routine (jump). | 456 // Tail call of a runtime routine (jump). |
457 // Like JumpToExternalReference, but also takes care of passing the number | 457 // Like JumpToExternalReference, but also takes care of passing the number |
458 // of parameters. | 458 // of parameters. |
459 void TailCallExternalReference(const ExternalReference& ext, | 459 void TailCallExternalReference(const ExternalReference& ext, |
460 int num_arguments, | 460 int num_arguments, |
461 int result_size); | 461 int result_size); |
462 | 462 |
| 463 // Tail call of a runtime routine (jump). Try to generate the code if |
| 464 // necessary. Do not perform a GC but instead return a retry after GC failure. |
| 465 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
| 466 const ExternalReference& ext, int num_arguments, int result_size); |
| 467 |
463 // Convenience function: tail call a runtime routine (jump). | 468 // Convenience function: tail call a runtime routine (jump). |
464 void TailCallRuntime(Runtime::FunctionId fid, | 469 void TailCallRuntime(Runtime::FunctionId fid, |
465 int num_arguments, | 470 int num_arguments, |
466 int result_size); | 471 int result_size); |
467 | 472 |
| 473 // Convenience function: tail call a runtime routine (jump). Try to generate |
| 474 // the code if necessary. Do not perform a GC but instead return a retry after |
| 475 // GC failure. |
| 476 MUST_USE_RESULT MaybeObject* TryTailCallRuntime(Runtime::FunctionId fid, |
| 477 int num_arguments, |
| 478 int result_size); |
| 479 |
468 // Before calling a C-function from generated code, align arguments on stack. | 480 // Before calling a C-function from generated code, align arguments on stack. |
469 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 481 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
470 // etc., not pushed. The argument count assumes all arguments are word sized. | 482 // etc., not pushed. The argument count assumes all arguments are word sized. |
471 // Some compilers/platforms require the stack to be aligned when calling | 483 // Some compilers/platforms require the stack to be aligned when calling |
472 // C++ code. | 484 // C++ code. |
473 // Needs a scratch register to do some arithmetic. This register will be | 485 // Needs a scratch register to do some arithmetic. This register will be |
474 // trashed. | 486 // trashed. |
475 void PrepareCallCFunction(int num_arguments, Register scratch); | 487 void PrepareCallCFunction(int num_arguments, Register scratch); |
476 | 488 |
477 // Calls a C function and cleans up the space for arguments allocated | 489 // Calls a C function and cleans up the space for arguments allocated |
478 // by PrepareCallCFunction. The called function is not allowed to trigger a | 490 // by PrepareCallCFunction. The called function is not allowed to trigger a |
479 // garbage collection, since that might move the code and invalidate the | 491 // garbage collection, since that might move the code and invalidate the |
480 // return address (unless this is somehow accounted for by the called | 492 // return address (unless this is somehow accounted for by the called |
481 // function). | 493 // function). |
482 void CallCFunction(ExternalReference function, int num_arguments); | 494 void CallCFunction(ExternalReference function, int num_arguments); |
483 void CallCFunction(Register function, int num_arguments); | 495 void CallCFunction(Register function, int num_arguments); |
484 | 496 |
485 // Prepares stack to put arguments (aligns and so on). Reserves | 497 // Prepares stack to put arguments (aligns and so on). Reserves |
486 // space for return value if needed (assumes the return value is a handle). | 498 // space for return value if needed (assumes the return value is a handle). |
487 // Uses callee-saved esi to restore stack state after call. Arguments must be | 499 // Uses callee-saved esi to restore stack state after call. Arguments must be |
488 // stored in ApiParameterOperand(0), ApiParameterOperand(1) etc. | 500 // stored in ApiParameterOperand(0), ApiParameterOperand(1) etc. |
489 void PrepareCallApiFunction(int stack_space, int argc); | 501 void PrepareCallApiFunction(int stack_space, int argc); |
490 | 502 |
491 // Calls an API function. Allocates HandleScope, extracts | 503 // Calls an API function. Allocates HandleScope, extracts |
492 // returned value from handle and propagates exceptions. | 504 // returned value from handle and propagates exceptions. |
493 // Clobbers ebx, esi, edi and caller-save registers. | 505 // Clobbers ebx, esi, edi and caller-save registers. |
494 void CallApiFunctionAndReturn(ApiFunction* function, int argc); | 506 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function, int argc); |
495 | 507 |
496 // Jump to a runtime routine. | 508 // Jump to a runtime routine. |
497 void JumpToExternalReference(const ExternalReference& ext); | 509 void JumpToExternalReference(const ExternalReference& ext); |
498 | 510 |
| 511 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 512 |
499 | 513 |
500 // --------------------------------------------------------------------------- | 514 // --------------------------------------------------------------------------- |
501 // Utilities | 515 // Utilities |
502 | 516 |
503 void Ret(); | 517 void Ret(); |
504 | 518 |
505 // Emit code to discard a non-negative number of pointer-sized elements | 519 // Emit code to discard a non-negative number of pointer-sized elements |
506 // from the stack, clobbering only the esp register. | 520 // from the stack, clobbering only the esp register. |
507 void Drop(int element_count); | 521 void Drop(int element_count); |
508 | 522 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 } \ | 678 } \ |
665 masm-> | 679 masm-> |
666 #else | 680 #else |
667 #define ACCESS_MASM(masm) masm-> | 681 #define ACCESS_MASM(masm) masm-> |
668 #endif | 682 #endif |
669 | 683 |
670 | 684 |
671 } } // namespace v8::internal | 685 } } // namespace v8::internal |
672 | 686 |
673 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 687 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |