| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // --------------------------------------------------------------------------- | 277 // --------------------------------------------------------------------------- |
| 278 // Activation frames | 278 // Activation frames |
| 279 | 279 |
| 280 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } | 280 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } |
| 281 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } | 281 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } |
| 282 | 282 |
| 283 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } | 283 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
| 284 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } | 284 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
| 285 | 285 |
| 286 // Enter exit frame. | 286 // Enter exit frame. |
| 287 // Expects the number of arguments in register r0 and | 287 // stack_space - extra stack space, used for alignment before call to C. |
| 288 // the builtin function to call in register r1. Exits with argc in | 288 void EnterExitFrame(bool save_doubles, int stack_space = 0); |
| 289 // r4, argv in r6, and and the builtin function to call in r5. | |
| 290 void EnterExitFrame(bool save_doubles); | |
| 291 | 289 |
| 292 // Leave the current exit frame. Expects the return value in r0. | 290 // Leave the current exit frame. Expects the return value in r0. |
| 293 void LeaveExitFrame(bool save_doubles); | 291 // Expect the number of values, pushed prior to the exit frame, to |
| 292 // remove in a register (or no_reg, if there is nothing to remove). |
| 293 void LeaveExitFrame(bool save_doubles, Register argument_count); |
| 294 | 294 |
| 295 // Get the actual activation frame alignment for target environment. | 295 // Get the actual activation frame alignment for target environment. |
| 296 static int ActivationFrameAlignment(); | 296 static int ActivationFrameAlignment(); |
| 297 | 297 |
| 298 void LoadContext(Register dst, int context_chain_length); | 298 void LoadContext(Register dst, int context_chain_length); |
| 299 | 299 |
| 300 void LoadGlobalFunction(int index, Register function); | 300 void LoadGlobalFunction(int index, Register function); |
| 301 | 301 |
| 302 // Load the initial map from the global function. The registers | 302 // Load the initial map from the global function. The registers |
| 303 // function and map can be the same, function is then overwritten. | 303 // function and map can be the same, function is then overwritten. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 // Push a new try handler and link into try handler chain. | 358 // Push a new try handler and link into try handler chain. |
| 359 // The return address must be passed in register lr. | 359 // The return address must be passed in register lr. |
| 360 // On exit, r0 contains TOS (code slot). | 360 // On exit, r0 contains TOS (code slot). |
| 361 void PushTryHandler(CodeLocation try_location, HandlerType type); | 361 void PushTryHandler(CodeLocation try_location, HandlerType type); |
| 362 | 362 |
| 363 // Unlink the stack handler on top of the stack from the try handler chain. | 363 // Unlink the stack handler on top of the stack from the try handler chain. |
| 364 // Must preserve the result register. | 364 // Must preserve the result register. |
| 365 void PopTryHandler(); | 365 void PopTryHandler(); |
| 366 | 366 |
| 367 // Passes thrown value (in r0) to the handler of top of the try handler chain. |
| 368 void Throw(Register value); |
| 369 |
| 370 // Propagates an uncatchable exception to the top of the current JS stack's |
| 371 // handler chain. |
| 372 void ThrowUncatchable(UncatchableExceptionType type, Register value); |
| 373 |
| 367 // --------------------------------------------------------------------------- | 374 // --------------------------------------------------------------------------- |
| 368 // Inline caching support | 375 // Inline caching support |
| 369 | 376 |
| 370 // Generate code for checking access rights - used for security checks | 377 // Generate code for checking access rights - used for security checks |
| 371 // on access to global objects across environments. The holder register | 378 // on access to global objects across environments. The holder register |
| 372 // is left untouched, whereas both scratch registers are clobbered. | 379 // is left untouched, whereas both scratch registers are clobbered. |
| 373 void CheckAccessGlobalProxy(Register holder_reg, | 380 void CheckAccessGlobalProxy(Register holder_reg, |
| 374 Register scratch, | 381 Register scratch, |
| 375 Label* miss); | 382 Label* miss); |
| 376 | 383 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 611 |
| 605 // --------------------------------------------------------------------------- | 612 // --------------------------------------------------------------------------- |
| 606 // Runtime calls | 613 // Runtime calls |
| 607 | 614 |
| 608 // Call a code stub. | 615 // Call a code stub. |
| 609 void CallStub(CodeStub* stub, Condition cond = al); | 616 void CallStub(CodeStub* stub, Condition cond = al); |
| 610 | 617 |
| 611 // Call a code stub. | 618 // Call a code stub. |
| 612 void TailCallStub(CodeStub* stub, Condition cond = al); | 619 void TailCallStub(CodeStub* stub, Condition cond = al); |
| 613 | 620 |
| 621 // Tail call a code stub (jump) and return the code object called. Try to |
| 622 // generate the code if necessary. Do not perform a GC but instead return |
| 623 // a retry after GC failure. |
| 624 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub, |
| 625 Condition cond = al); |
| 626 |
| 614 // Call a runtime routine. | 627 // Call a runtime routine. |
| 615 void CallRuntime(Runtime::Function* f, int num_arguments); | 628 void CallRuntime(Runtime::Function* f, int num_arguments); |
| 616 void CallRuntimeSaveDoubles(Runtime::FunctionId id); | 629 void CallRuntimeSaveDoubles(Runtime::FunctionId id); |
| 617 | 630 |
| 618 // Convenience function: Same as above, but takes the fid instead. | 631 // Convenience function: Same as above, but takes the fid instead. |
| 619 void CallRuntime(Runtime::FunctionId fid, int num_arguments); | 632 void CallRuntime(Runtime::FunctionId fid, int num_arguments); |
| 620 | 633 |
| 621 // Convenience function: call an external reference. | 634 // Convenience function: call an external reference. |
| 622 void CallExternalReference(const ExternalReference& ext, | 635 void CallExternalReference(const ExternalReference& ext, |
| 623 int num_arguments); | 636 int num_arguments); |
| 624 | 637 |
| 625 // Tail call of a runtime routine (jump). | 638 // Tail call of a runtime routine (jump). |
| 626 // Like JumpToExternalReference, but also takes care of passing the number | 639 // Like JumpToExternalReference, but also takes care of passing the number |
| 627 // of parameters. | 640 // of parameters. |
| 628 void TailCallExternalReference(const ExternalReference& ext, | 641 void TailCallExternalReference(const ExternalReference& ext, |
| 629 int num_arguments, | 642 int num_arguments, |
| 630 int result_size); | 643 int result_size); |
| 631 | 644 |
| 645 // Tail call of a runtime routine (jump). Try to generate the code if |
| 646 // necessary. Do not perform a GC but instead return a retry after GC |
| 647 // failure. |
| 648 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference( |
| 649 const ExternalReference& ext, int num_arguments, int result_size); |
| 650 |
| 632 // Convenience function: tail call a runtime routine (jump). | 651 // Convenience function: tail call a runtime routine (jump). |
| 633 void TailCallRuntime(Runtime::FunctionId fid, | 652 void TailCallRuntime(Runtime::FunctionId fid, |
| 634 int num_arguments, | 653 int num_arguments, |
| 635 int result_size); | 654 int result_size); |
| 636 | 655 |
| 637 // Before calling a C-function from generated code, align arguments on stack. | 656 // Before calling a C-function from generated code, align arguments on stack. |
| 638 // After aligning the frame, non-register arguments must be stored in | 657 // After aligning the frame, non-register arguments must be stored in |
| 639 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments | 658 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments |
| 640 // are word sized. | 659 // are word sized. |
| 641 // Some compilers/platforms require the stack to be aligned when calling | 660 // Some compilers/platforms require the stack to be aligned when calling |
| 642 // C++ code. | 661 // C++ code. |
| 643 // Needs a scratch register to do some arithmetic. This register will be | 662 // Needs a scratch register to do some arithmetic. This register will be |
| 644 // trashed. | 663 // trashed. |
| 645 void PrepareCallCFunction(int num_arguments, Register scratch); | 664 void PrepareCallCFunction(int num_arguments, Register scratch); |
| 646 | 665 |
| 647 // Calls a C function and cleans up the space for arguments allocated | 666 // Calls a C function and cleans up the space for arguments allocated |
| 648 // by PrepareCallCFunction. The called function is not allowed to trigger a | 667 // by PrepareCallCFunction. The called function is not allowed to trigger a |
| 649 // garbage collection, since that might move the code and invalidate the | 668 // garbage collection, since that might move the code and invalidate the |
| 650 // return address (unless this is somehow accounted for by the called | 669 // return address (unless this is somehow accounted for by the called |
| 651 // function). | 670 // function). |
| 652 void CallCFunction(ExternalReference function, int num_arguments); | 671 void CallCFunction(ExternalReference function, int num_arguments); |
| 653 void CallCFunction(Register function, int num_arguments); | 672 void CallCFunction(Register function, int num_arguments); |
| 654 | 673 |
| 674 // Calls an API function. Allocates HandleScope, extracts returned value |
| 675 // from handle and propagates exceptions. Restores context. |
| 676 // stack_space - space to be unwound on exit (includes the call js |
| 677 // arguments space and the additional space allocated for the fast call). |
| 678 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function, |
| 679 int stack_space); |
| 680 |
| 655 // Jump to a runtime routine. | 681 // Jump to a runtime routine. |
| 656 void JumpToExternalReference(const ExternalReference& builtin); | 682 void JumpToExternalReference(const ExternalReference& builtin); |
| 657 | 683 |
| 684 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext); |
| 685 |
| 658 // Invoke specified builtin JavaScript function. Adds an entry to | 686 // Invoke specified builtin JavaScript function. Adds an entry to |
| 659 // the unresolved list if the name does not resolve. | 687 // the unresolved list if the name does not resolve. |
| 660 void InvokeBuiltin(Builtins::JavaScript id, | 688 void InvokeBuiltin(Builtins::JavaScript id, |
| 661 InvokeJSFlags flags, | 689 InvokeJSFlags flags, |
| 662 PostCallGenerator* post_call_generator = NULL); | 690 PostCallGenerator* post_call_generator = NULL); |
| 663 | 691 |
| 664 // Store the code object for the given builtin in the target register and | 692 // Store the code object for the given builtin in the target register and |
| 665 // setup the function in r1. | 693 // setup the function in r1. |
| 666 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 694 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
| 667 | 695 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 918 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 891 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 919 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 892 #else | 920 #else |
| 893 #define ACCESS_MASM(masm) masm-> | 921 #define ACCESS_MASM(masm) masm-> |
| 894 #endif | 922 #endif |
| 895 | 923 |
| 896 | 924 |
| 897 } } // namespace v8::internal | 925 } } // namespace v8::internal |
| 898 | 926 |
| 899 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 927 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |