OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // --------------------------------------------------------------------------- | 246 // --------------------------------------------------------------------------- |
247 // Activation frames | 247 // Activation frames |
248 | 248 |
249 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } | 249 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } |
250 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } | 250 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } |
251 | 251 |
252 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | 252 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
253 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | 253 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
254 | 254 |
255 // Enter exit frame. | 255 // Enter exit frame. |
256 // Expects the number of arguments in register r0 and | 256 // ip register has the sp to be restored after exit. |
257 // the builtin function to call in register r1. Exits with argc in | 257 // stack_space - pending pushes, used for alignment before call to C. |
258 // r4, argv in r6, and and the builtin function to call in r5. | 258 void EnterExitFrame(bool save_doubles, int stack_space); |
259 void EnterExitFrame(bool save_doubles); | |
260 | 259 |
261 // Leave the current exit frame. Expects the return value in r0. | 260 // Leave the current exit frame. Expects the return value in r0. |
262 void LeaveExitFrame(bool save_doubles); | 261 void LeaveExitFrame(bool save_doubles); |
263 | 262 |
264 // Get the actual activation frame alignment for target environment. | 263 // Get the actual activation frame alignment for target environment. |
265 static int ActivationFrameAlignment(); | 264 static int ActivationFrameAlignment(); |
266 | 265 |
267 void LoadContext(Register dst, int context_chain_length); | 266 void LoadContext(Register dst, int context_chain_length); |
268 | 267 |
269 void LoadGlobalFunction(int index, Register function); | 268 void LoadGlobalFunction(int index, Register function); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 580 |
582 // --------------------------------------------------------------------------- | 581 // --------------------------------------------------------------------------- |
583 // Runtime calls | 582 // Runtime calls |
584 | 583 |
585 // Call a code stub. | 584 // Call a code stub. |
586 void CallStub(CodeStub* stub, Condition cond = al); | 585 void CallStub(CodeStub* stub, Condition cond = al); |
587 | 586 |
588 // Call a code stub. | 587 // Call a code stub. |
589 void TailCallStub(CodeStub* stub, Condition cond = al); | 588 void TailCallStub(CodeStub* stub, Condition cond = al); |
590 | 589 |
| 590 // Tail call a code stub (jump) and return the code object called. Try to |
| 591 // generate the code if necessary. Do not perform a GC but instead return |
| 592 // a retry after GC failure. |
| 593 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub, |
| 594 Condition cond = al); |
| 595 |
591 // Call a runtime routine. | 596 // Call a runtime routine. |
592 void CallRuntime(Runtime::Function* f, int num_arguments); | 597 void CallRuntime(Runtime::Function* f, int num_arguments); |
593 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 598 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
594 | 599 |
595 // Convenience function: Same as above, but takes the fid instead. | 600 // Convenience function: Same as above, but takes the fid instead. |
596 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 601 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
597 | 602 |
598 // Convenience function: call an external reference. | 603 // Convenience function: call an external reference. |
599 void CallExternalReference(const ExternalReference& ext, | 604 void CallExternalReference(const ExternalReference& ext, |
600 int num_arguments); | 605 int num_arguments); |
601 | 606 |
602 // Tail call of a runtime routine (jump). | 607 // Tail call of a runtime routine (jump). |
603 // Like JumpToExternalReference, but also takes care of passing the number | 608 // Like JumpToExternalReference, but also takes care of passing the number |
604 // of parameters. | 609 // of parameters. |
605 void TailCallExternalReference(const ExternalReference& ext, | 610 void TailCallExternalReference(const ExternalReference& ext, |
606 int num_arguments, | 611 int num_arguments, |
607 int result_size); | 612 int result_size); |
608 | 613 |
| 614 // Tail call of a runtime routine (jump). Try to generate the code if |
| 615 // necessary. Do not perform a GC but instead return a retry after GC |
| 616 // failure. |
| 617 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
| 618 const ExternalReference& ext, int num_arguments, int result_size); |
| 619 |
609 // Convenience function: tail call a runtime routine (jump). | 620 // Convenience function: tail call a runtime routine (jump). |
610 void TailCallRuntime(Runtime::FunctionId fid, | 621 void TailCallRuntime(Runtime::FunctionId fid, |
611 int num_arguments, | 622 int num_arguments, |
612 int result_size); | 623 int result_size); |
613 | 624 |
614 // Before calling a C-function from generated code, align arguments on stack. | 625 // Before calling a C-function from generated code, align arguments on stack. |
615 // After aligning the frame, non-register arguments must be stored in | 626 // After aligning the frame, non-register arguments must be stored in |
616 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 627 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
617 // are word sized. | 628 // are word sized. |
618 // Some compilers/platforms require the stack to be aligned when calling | 629 // Some compilers/platforms require the stack to be aligned when calling |
619 // C++ code. | 630 // C++ code. |
620 // Needs a scratch register to do some arithmetic. This register will be | 631 // Needs a scratch register to do some arithmetic. This register will be |
621 // trashed. | 632 // trashed. |
622 void PrepareCallCFunction(int num_arguments, Register scratch); | 633 void PrepareCallCFunction(int num_arguments, Register scratch); |
623 | 634 |
624 // Calls a C function and cleans up the space for arguments allocated | 635 // Calls a C function and cleans up the space for arguments allocated |
625 // by PrepareCallCFunction. The called function is not allowed to trigger a | 636 // by PrepareCallCFunction. The called function is not allowed to trigger a |
626 // garbage collection, since that might move the code and invalidate the | 637 // garbage collection, since that might move the code and invalidate the |
627 // return address (unless this is somehow accounted for by the called | 638 // return address (unless this is somehow accounted for by the called |
628 // function). | 639 // function). |
629 void CallCFunction(ExternalReference function, int num_arguments); | 640 void CallCFunction(ExternalReference function, int num_arguments); |
630 void CallCFunction(Register function, int num_arguments); | 641 void CallCFunction(Register function, int num_arguments); |
631 | 642 |
| 643 // Creates the exit frame, pushes the arguments and aligns the stack |
| 644 // for the C call. saves the fp and context in top. |
| 645 // arg_stack_space - space allocated for the structure (e.g. |
| 646 // v8::arguments in a direct call) on top of the exit frame. |
| 647 // unwind_space - space to be unwound on exit (includes the call js |
| 648 // arguments space and the additonal space allocated for the fast call). |
| 649 void PrepareCallApiFunction(int arg_stack_space, |
| 650 int unwind_space); |
| 651 |
| 652 // Calls an API function. Allocates HandleScope, extracts |
| 653 // returned value from handle and propagates exceptions. |
| 654 // Restores context. |
| 655 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function); |
| 656 |
632 // Jump to a runtime routine. | 657 // Jump to a runtime routine. |
633 void JumpToExternalReference(const ExternalReference& builtin); | 658 void JumpToExternalReference(const ExternalReference& builtin); |
634 | 659 |
| 660 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 661 |
635 // Invoke specified builtin JavaScript function. Adds an entry to | 662 // Invoke specified builtin JavaScript function. Adds an entry to |
636 // the unresolved list if the name does not resolve. | 663 // the unresolved list if the name does not resolve. |
637 void InvokeBuiltin(Builtins::JavaScript id, InvokeJSFlags flags); | 664 void InvokeBuiltin(Builtins::JavaScript id, InvokeJSFlags flags); |
638 | 665 |
639 // Store the code object for the given builtin in the target register and | 666 // Store the code object for the given builtin in the target register and |
640 // setup the function in r1. | 667 // setup the function in r1. |
641 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 668 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
642 | 669 |
643 // Store the function for the given builtin in the target register. | 670 // Store the function for the given builtin in the target register. |
644 void GetBuiltinFunction(Register target, Builtins::JavaScript id); | 671 void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 847 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
821 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 848 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
822 #else | 849 #else |
823 #define ACCESS_MASM(masm) masm-> | 850 #define ACCESS_MASM(masm) masm-> |
824 #endif | 851 #endif |
825 | 852 |
826 | 853 |
827 } } // namespace v8::internal | 854 } } // namespace v8::internal |
828 | 855 |
829 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 856 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |