Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Side by Side Diff: src/arm/macro-assembler-arm.h

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 } 229 }
230 230
231 // Push and pop the registers that can hold pointers, as defined by the 231 // Push and pop the registers that can hold pointers, as defined by the
232 // RegList constant kSafepointSavedRegisters. 232 // RegList constant kSafepointSavedRegisters.
233 void PushSafepointRegisters(); 233 void PushSafepointRegisters();
234 void PopSafepointRegisters(); 234 void PopSafepointRegisters();
235 void PushSafepointRegistersAndDoubles(); 235 void PushSafepointRegistersAndDoubles();
236 void PopSafepointRegistersAndDoubles(); 236 void PopSafepointRegistersAndDoubles();
237 void StoreToSafepointRegisterSlot(Register reg); 237 void StoreToSafepointRegisterSlot(Register reg);
238 void StoreToSafepointRegistersAndDoublesSlot(Register reg);
239 void LoadFromSafepointRegisterSlot(Register reg);
238 static int SafepointRegisterStackIndex(int reg_code); 240 static int SafepointRegisterStackIndex(int reg_code);
239 static MemOperand SafepointRegisterSlot(Register reg); 241 static MemOperand SafepointRegisterSlot(Register reg);
242 static MemOperand SafepointRegistersAndDoublesSlot(Register reg);
240 243
241 // Load two consecutive registers with two consecutive memory locations. 244 // Load two consecutive registers with two consecutive memory locations.
242 void Ldrd(Register dst1, 245 void Ldrd(Register dst1,
243 Register dst2, 246 Register dst2,
244 const MemOperand& src, 247 const MemOperand& src,
245 Condition cond = al); 248 Condition cond = al);
246 249
247 // Store two consecutive registers to two consecutive memory locations. 250 // Store two consecutive registers to two consecutive memory locations.
248 void Strd(Register src1, 251 void Strd(Register src1,
249 Register src2, 252 Register src2,
(...skipping 27 matching lines...) Expand all
277 // --------------------------------------------------------------------------- 280 // ---------------------------------------------------------------------------
278 // Activation frames 281 // Activation frames
279 282
280 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } 283 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); }
281 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } 284 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); }
282 285
283 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } 286 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
284 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } 287 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
285 288
286 // Enter exit frame. 289 // Enter exit frame.
287 // Expects the number of arguments in register r0 and 290 // 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 291 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 292
292 // Leave the current exit frame. Expects the return value in r0. 293 // Leave the current exit frame. Expects the return value in r0.
293 void LeaveExitFrame(bool save_doubles); 294 void LeaveExitFrame(bool save_doubles);
294 295
295 // Get the actual activation frame alignment for target environment. 296 // Get the actual activation frame alignment for target environment.
296 static int ActivationFrameAlignment(); 297 static int ActivationFrameAlignment();
297 298
298 void LoadContext(Register dst, int context_chain_length); 299 void LoadContext(Register dst, int context_chain_length);
299 300
300 void LoadGlobalFunction(int index, Register function); 301 void LoadGlobalFunction(int index, Register function);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 // Load the value of a smi object into a VFP double register. The register 580 // Load the value of a smi object into a VFP double register. The register
580 // scratch1 can be the same register as smi in which case smi will hold the 581 // scratch1 can be the same register as smi in which case smi will hold the
581 // untagged value afterwards. 582 // untagged value afterwards.
582 void SmiToDoubleVFPRegister(Register smi, 583 void SmiToDoubleVFPRegister(Register smi,
583 DwVfpRegister value, 584 DwVfpRegister value,
584 Register scratch1, 585 Register scratch1,
585 SwVfpRegister scratch2); 586 SwVfpRegister scratch2);
586 587
587 // Convert the HeapNumber pointed to by source to a 32bits signed integer 588 // Convert the HeapNumber pointed to by source to a 32bits signed integer
588 // dest. If the HeapNumber does not fit into a 32bits signed integer branch 589 // dest. If the HeapNumber does not fit into a 32bits signed integer branch
589 // to not_int32 label. 590 // to not_int32 label. If VFP3 is available double_scratch is used but not
591 // scratch2.
590 void ConvertToInt32(Register source, 592 void ConvertToInt32(Register source,
591 Register dest, 593 Register dest,
592 Register scratch, 594 Register scratch,
593 Register scratch2, 595 Register scratch2,
596 DwVfpRegister double_scratch,
594 Label *not_int32); 597 Label *not_int32);
595 598
596 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz 599 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz
597 // instruction. On pre-ARM5 hardware this routine gives the wrong answer 600 // instruction. On pre-ARM5 hardware this routine gives the wrong answer
598 // for 0 (31 instead of 32). Source and scratch can be the same in which case 601 // for 0 (31 instead of 32). Source and scratch can be the same in which case
599 // the source is clobbered. Source and zeros can also be the same in which 602 // the source is clobbered. Source and zeros can also be the same in which
600 // case scratch should be a different register. 603 // case scratch should be a different register.
601 void CountLeadingZeros(Register zeros, 604 void CountLeadingZeros(Register zeros,
602 Register source, 605 Register source,
603 Register scratch); 606 Register scratch);
604 607
605 // --------------------------------------------------------------------------- 608 // ---------------------------------------------------------------------------
606 // Runtime calls 609 // Runtime calls
607 610
608 // Call a code stub. 611 // Call a code stub.
609 void CallStub(CodeStub* stub, Condition cond = al); 612 void CallStub(CodeStub* stub, Condition cond = al);
610 613
611 // Call a code stub. 614 // Call a code stub.
612 void TailCallStub(CodeStub* stub, Condition cond = al); 615 void TailCallStub(CodeStub* stub, Condition cond = al);
613 616
617 // Tail call a code stub (jump) and return the code object called. Try to
618 // generate the code if necessary. Do not perform a GC but instead return
619 // a retry after GC failure.
620 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub,
621 Condition cond = al);
622
614 // Call a runtime routine. 623 // Call a runtime routine.
615 void CallRuntime(const Runtime::Function* f, int num_arguments); 624 void CallRuntime(const Runtime::Function* f, int num_arguments);
616 void CallRuntimeSaveDoubles(Runtime::FunctionId id); 625 void CallRuntimeSaveDoubles(Runtime::FunctionId id);
617 626
618 // Convenience function: Same as above, but takes the fid instead. 627 // Convenience function: Same as above, but takes the fid instead.
619 void CallRuntime(Runtime::FunctionId fid, int num_arguments); 628 void CallRuntime(Runtime::FunctionId fid, int num_arguments);
620 629
621 // Convenience function: call an external reference. 630 // Convenience function: call an external reference.
622 void CallExternalReference(const ExternalReference& ext, 631 void CallExternalReference(const ExternalReference& ext,
623 int num_arguments); 632 int num_arguments);
624 633
625 // Tail call of a runtime routine (jump). 634 // Tail call of a runtime routine (jump).
626 // Like JumpToExternalReference, but also takes care of passing the number 635 // Like JumpToExternalReference, but also takes care of passing the number
627 // of parameters. 636 // of parameters.
628 void TailCallExternalReference(const ExternalReference& ext, 637 void TailCallExternalReference(const ExternalReference& ext,
629 int num_arguments, 638 int num_arguments,
630 int result_size); 639 int result_size);
631 640
641 // Tail call of a runtime routine (jump). Try to generate the code if
642 // necessary. Do not perform a GC but instead return a retry after GC
643 // failure.
644 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference(
645 const ExternalReference& ext, int num_arguments, int result_size);
646
632 // Convenience function: tail call a runtime routine (jump). 647 // Convenience function: tail call a runtime routine (jump).
633 void TailCallRuntime(Runtime::FunctionId fid, 648 void TailCallRuntime(Runtime::FunctionId fid,
634 int num_arguments, 649 int num_arguments,
635 int result_size); 650 int result_size);
636 651
637 // Before calling a C-function from generated code, align arguments on stack. 652 // Before calling a C-function from generated code, align arguments on stack.
638 // After aligning the frame, non-register arguments must be stored in 653 // 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 654 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments
640 // are word sized. 655 // are word sized.
641 // Some compilers/platforms require the stack to be aligned when calling 656 // Some compilers/platforms require the stack to be aligned when calling
642 // C++ code. 657 // C++ code.
643 // Needs a scratch register to do some arithmetic. This register will be 658 // Needs a scratch register to do some arithmetic. This register will be
644 // trashed. 659 // trashed.
645 void PrepareCallCFunction(int num_arguments, Register scratch); 660 void PrepareCallCFunction(int num_arguments, Register scratch);
646 661
647 // Calls a C function and cleans up the space for arguments allocated 662 // Calls a C function and cleans up the space for arguments allocated
648 // by PrepareCallCFunction. The called function is not allowed to trigger a 663 // by PrepareCallCFunction. The called function is not allowed to trigger a
649 // garbage collection, since that might move the code and invalidate the 664 // garbage collection, since that might move the code and invalidate the
650 // return address (unless this is somehow accounted for by the called 665 // return address (unless this is somehow accounted for by the called
651 // function). 666 // function).
652 void CallCFunction(ExternalReference function, int num_arguments); 667 void CallCFunction(ExternalReference function, int num_arguments);
653 void CallCFunction(Register function, Register scratch, int num_arguments); 668 void CallCFunction(Register function, Register scratch, int num_arguments);
654 669
670 // Calls an API function. Allocates HandleScope, extracts returned value
671 // from handle and propagates exceptions. Restores context.
672 // stack_space - space to be unwound on exit (includes the call js
673 // arguments space and the additional space allocated for the fast call).
674 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function,
675 int stack_space);
676
655 // Jump to a runtime routine. 677 // Jump to a runtime routine.
656 void JumpToExternalReference(const ExternalReference& builtin); 678 void JumpToExternalReference(const ExternalReference& builtin);
657 679
680 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext);
681
658 // Invoke specified builtin JavaScript function. Adds an entry to 682 // Invoke specified builtin JavaScript function. Adds an entry to
659 // the unresolved list if the name does not resolve. 683 // the unresolved list if the name does not resolve.
660 void InvokeBuiltin(Builtins::JavaScript id, 684 void InvokeBuiltin(Builtins::JavaScript id,
661 InvokeJSFlags flags, 685 InvokeJSFlags flags,
662 PostCallGenerator* post_call_generator = NULL); 686 PostCallGenerator* post_call_generator = NULL);
663 687
664 // Store the code object for the given builtin in the target register and 688 // Store the code object for the given builtin in the target register and
665 // setup the function in r1. 689 // setup the function in r1.
666 void GetBuiltinEntry(Register target, Builtins::JavaScript id); 690 void GetBuiltinEntry(Register target, Builtins::JavaScript id);
667 691
(...skipping 29 matching lines...) Expand all
697 // Print a message to stdout and abort execution. 721 // Print a message to stdout and abort execution.
698 void Abort(const char* msg); 722 void Abort(const char* msg);
699 723
700 // Verify restrictions about code generated in stubs. 724 // Verify restrictions about code generated in stubs.
701 void set_generating_stub(bool value) { generating_stub_ = value; } 725 void set_generating_stub(bool value) { generating_stub_ = value; }
702 bool generating_stub() { return generating_stub_; } 726 bool generating_stub() { return generating_stub_; }
703 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } 727 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
704 bool allow_stub_calls() { return allow_stub_calls_; } 728 bool allow_stub_calls() { return allow_stub_calls_; }
705 729
706 // --------------------------------------------------------------------------- 730 // ---------------------------------------------------------------------------
731 // Number utilities
732
733 // Check whether the value of reg is a power of two and not zero. If not
734 // control continues at the label not_power_of_two. If reg is a power of two
735 // the register scratch contains the value of (reg - 1) when control falls
736 // through.
737 void JumpIfNotPowerOfTwoOrZero(Register reg,
738 Register scratch,
739 Label* not_power_of_two_or_zero);
740
741 // ---------------------------------------------------------------------------
707 // Smi utilities 742 // Smi utilities
708 743
709 void SmiTag(Register reg, SBit s = LeaveCC) { 744 void SmiTag(Register reg, SBit s = LeaveCC) {
710 add(reg, reg, Operand(reg), s); 745 add(reg, reg, Operand(reg), s);
711 } 746 }
712 void SmiTag(Register dst, Register src, SBit s = LeaveCC) { 747 void SmiTag(Register dst, Register src, SBit s = LeaveCC) {
713 add(dst, src, Operand(src), s); 748 add(dst, src, Operand(src), s);
714 } 749 }
715 750
716 // Try to convert int32 to smi. If the value is to large, preserve 751 // Try to convert int32 to smi. If the value is to large, preserve
(...skipping 25 matching lines...) Expand all
742 } 777 }
743 // Jump if either of the registers contain a non-smi. 778 // Jump if either of the registers contain a non-smi.
744 void JumpIfNotBothSmi(Register reg1, Register reg2, Label* on_not_both_smi); 779 void JumpIfNotBothSmi(Register reg1, Register reg2, Label* on_not_both_smi);
745 // Jump if either of the registers contain a smi. 780 // Jump if either of the registers contain a smi.
746 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi); 781 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi);
747 782
748 // Abort execution if argument is a smi. Used in debug code. 783 // Abort execution if argument is a smi. Used in debug code.
749 void AbortIfSmi(Register object); 784 void AbortIfSmi(Register object);
750 void AbortIfNotSmi(Register object); 785 void AbortIfNotSmi(Register object);
751 786
787 // Abort execution if argument is not the root value with the given index.
788 void AbortIfNotRootValue(Register src,
789 Heap::RootListIndex root_value_index,
790 const char* message);
791
752 // --------------------------------------------------------------------------- 792 // ---------------------------------------------------------------------------
753 // HeapNumber utilities 793 // HeapNumber utilities
754 794
755 void JumpIfNotHeapNumber(Register object, 795 void JumpIfNotHeapNumber(Register object,
756 Register heap_number_map, 796 Register heap_number_map,
757 Register scratch, 797 Register scratch,
758 Label* on_not_heap_number); 798 Label* on_not_heap_number);
759 799
760 // --------------------------------------------------------------------------- 800 // ---------------------------------------------------------------------------
761 // String utilities 801 // String utilities
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 935 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
896 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 936 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
897 #else 937 #else
898 #define ACCESS_MASM(masm) masm-> 938 #define ACCESS_MASM(masm) masm->
899 #endif 939 #endif
900 940
901 941
902 } } // namespace v8::internal 942 } } // namespace v8::internal
903 943
904 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ 944 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698