| 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. Saves |
| 501 // context (esi). |
| 489 void PrepareCallApiFunction(int stack_space, int argc); | 502 void PrepareCallApiFunction(int stack_space, int argc); |
| 490 | 503 |
| 491 // Calls an API function. Allocates HandleScope, extracts | 504 // Calls an API function. Allocates HandleScope, extracts |
| 492 // returned value from handle and propagates exceptions. | 505 // returned value from handle and propagates exceptions. |
| 493 // Clobbers ebx, esi, edi and caller-save registers. | 506 // Clobbers ebx, edi and caller-save registers. Restores context. |
| 494 void CallApiFunctionAndReturn(ApiFunction* function, int argc); | 507 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function, int argc); |
| 495 | 508 |
| 496 // Jump to a runtime routine. | 509 // Jump to a runtime routine. |
| 497 void JumpToExternalReference(const ExternalReference& ext); | 510 void JumpToExternalReference(const ExternalReference& ext); |
| 498 | 511 |
| 512 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 513 |
| 499 | 514 |
| 500 // --------------------------------------------------------------------------- | 515 // --------------------------------------------------------------------------- |
| 501 // Utilities | 516 // Utilities |
| 502 | 517 |
| 503 void Ret(); | 518 void Ret(); |
| 504 | 519 |
| 505 // Emit code to discard a non-negative number of pointer-sized elements | 520 // Emit code to discard a non-negative number of pointer-sized elements |
| 506 // from the stack, clobbering only the esp register. | 521 // from the stack, clobbering only the esp register. |
| 507 void Drop(int element_count); | 522 void Drop(int element_count); |
| 508 | 523 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } \ | 690 } \ |
| 676 masm-> | 691 masm-> |
| 677 #else | 692 #else |
| 678 #define ACCESS_MASM(masm) masm-> | 693 #define ACCESS_MASM(masm) masm-> |
| 679 #endif | 694 #endif |
| 680 | 695 |
| 681 | 696 |
| 682 } } // namespace v8::internal | 697 } } // namespace v8::internal |
| 683 | 698 |
| 684 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 699 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |