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

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

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 10 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/x64/ic-x64.cc ('k') | src/x64/macro-assembler-x64.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 18 matching lines...) Expand all
29 #define V8_X64_MACRO_ASSEMBLER_X64_H_ 29 #define V8_X64_MACRO_ASSEMBLER_X64_H_
30 30
31 #include "assembler.h" 31 #include "assembler.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // Default scratch register used by MacroAssembler (and other code that needs 36 // Default scratch register used by MacroAssembler (and other code that needs
37 // a spare register). The register isn't callee save, and not used by the 37 // a spare register). The register isn't callee save, and not used by the
38 // function calling convention. 38 // function calling convention.
39 static const Register kScratchRegister = r10; 39 static const Register kScratchRegister = { 10 }; // r10.
40 40
41 // Convenience for platform-independent signatures. 41 // Convenience for platform-independent signatures.
42 typedef Operand MemOperand; 42 typedef Operand MemOperand;
43 43
44 // Forward declaration. 44 // Forward declaration.
45 class JumpTarget; 45 class JumpTarget;
46 46
47 struct SmiIndex { 47 struct SmiIndex {
48 SmiIndex(Register index_register, ScaleFactor scale) 48 SmiIndex(Register index_register, ScaleFactor scale)
49 : reg(index_register), 49 : reg(index_register),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // --------------------------------------------------------------------------- 91 // ---------------------------------------------------------------------------
92 // Debugger Support 92 // Debugger Support
93 93
94 void SaveRegistersToMemory(RegList regs); 94 void SaveRegistersToMemory(RegList regs);
95 void RestoreRegistersFromMemory(RegList regs); 95 void RestoreRegistersFromMemory(RegList regs);
96 void PushRegistersFromMemory(RegList regs); 96 void PushRegistersFromMemory(RegList regs);
97 void PopRegistersToMemory(RegList regs); 97 void PopRegistersToMemory(RegList regs);
98 void CopyRegistersFromStackToMemory(Register base, 98 void CopyRegistersFromStackToMemory(Register base,
99 Register scratch, 99 Register scratch,
100 RegList regs); 100 RegList regs);
101 void DebugBreak();
101 #endif 102 #endif
102 103
103 // --------------------------------------------------------------------------- 104 // ---------------------------------------------------------------------------
104 // Stack limit support 105 // Stack limit support
105 106
106 // Do simple test for stack overflow. This doesn't handle an overflow. 107 // Do simple test for stack overflow. This doesn't handle an overflow.
107 void StackLimitCheck(Label* on_stack_limit_hit); 108 void StackLimitCheck(Label* on_stack_limit_hit);
108 109
109 // --------------------------------------------------------------------------- 110 // ---------------------------------------------------------------------------
110 // Activation frames 111 // Activation frames
(...skipping 30 matching lines...) Expand all
141 const ParameterCount& actual, 142 const ParameterCount& actual,
142 RelocInfo::Mode rmode, 143 RelocInfo::Mode rmode,
143 InvokeFlag flag); 144 InvokeFlag flag);
144 145
145 // Invoke the JavaScript function in the given register. Changes the 146 // Invoke the JavaScript function in the given register. Changes the
146 // current context to the context in the function before invoking. 147 // current context to the context in the function before invoking.
147 void InvokeFunction(Register function, 148 void InvokeFunction(Register function,
148 const ParameterCount& actual, 149 const ParameterCount& actual,
149 InvokeFlag flag); 150 InvokeFlag flag);
150 151
152 void InvokeFunction(JSFunction* function,
153 const ParameterCount& actual,
154 InvokeFlag flag);
155
151 // Invoke specified builtin JavaScript function. Adds an entry to 156 // Invoke specified builtin JavaScript function. Adds an entry to
152 // the unresolved list if the name does not resolve. 157 // the unresolved list if the name does not resolve.
153 void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag); 158 void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag);
154 159
155 // Store the code object for the given builtin in the target register. 160 // Store the code object for the given builtin in the target register.
156 void GetBuiltinEntry(Register target, Builtins::JavaScript id); 161 void GetBuiltinEntry(Register target, Builtins::JavaScript id);
157 162
158 163
159 // --------------------------------------------------------------------------- 164 // ---------------------------------------------------------------------------
160 // Smi tagging, untagging and operations on tagged smis. 165 // Smi tagging, untagging and operations on tagged smis.
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 // same in which case it contains the instance type afterwards. Either of the 479 // same in which case it contains the instance type afterwards. Either of the
475 // registers map and instance_type can be the same as heap_object. 480 // registers map and instance_type can be the same as heap_object.
476 Condition IsObjectStringType(Register heap_object, 481 Condition IsObjectStringType(Register heap_object,
477 Register map, 482 Register map,
478 Register instance_type); 483 Register instance_type);
479 484
480 // FCmp is similar to integer cmp, but requires unsigned 485 // FCmp is similar to integer cmp, but requires unsigned
481 // jcc instructions (je, ja, jae, jb, jbe, je, and jz). 486 // jcc instructions (je, ja, jae, jb, jbe, je, and jz).
482 void FCmp(); 487 void FCmp();
483 488
489 // Abort execution if argument is not a number. Used in debug code.
490 void AbortIfNotNumber(Register object, const char* msg);
491
484 // --------------------------------------------------------------------------- 492 // ---------------------------------------------------------------------------
485 // Exception handling 493 // Exception handling
486 494
487 // Push a new try handler and link into try handler chain. The return 495 // Push a new try handler and link into try handler chain. The return
488 // address must be pushed before calling this helper. 496 // address must be pushed before calling this helper.
489 void PushTryHandler(CodeLocation try_location, HandlerType type); 497 void PushTryHandler(CodeLocation try_location, HandlerType type);
490 498
491 // Unlink the stack handler on top of the stack from the try handler chain. 499 // Unlink the stack handler on top of the stack from the try handler chain.
492 void PopTryHandler(); 500 void PopTryHandler();
493 501
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 // Return from a code stub after popping its arguments. 644 // Return from a code stub after popping its arguments.
637 void StubReturn(int argc); 645 void StubReturn(int argc);
638 646
639 // Call a runtime routine. 647 // Call a runtime routine.
640 // Eventually this should be used for all C calls. 648 // Eventually this should be used for all C calls.
641 void CallRuntime(Runtime::Function* f, int num_arguments); 649 void CallRuntime(Runtime::Function* f, int num_arguments);
642 650
643 // Convenience function: Same as above, but takes the fid instead. 651 // Convenience function: Same as above, but takes the fid instead.
644 void CallRuntime(Runtime::FunctionId id, int num_arguments); 652 void CallRuntime(Runtime::FunctionId id, int num_arguments);
645 653
654 // Convenience function: call an external reference.
655 void CallExternalReference(const ExternalReference& ext,
656 int num_arguments);
657
646 // Tail call of a runtime routine (jump). 658 // Tail call of a runtime routine (jump).
647 // Like JumpToRuntime, but also takes care of passing the number 659 // Like JumpToRuntime, but also takes care of passing the number
648 // of arguments. 660 // of arguments.
649 void TailCallRuntime(const ExternalReference& ext, 661 void TailCallRuntime(const ExternalReference& ext,
650 int num_arguments, 662 int num_arguments,
651 int result_size); 663 int result_size);
652 664
653 // Jump to a runtime routine. 665 // Jump to a runtime routine.
654 void JumpToRuntime(const ExternalReference& ext, int result_size); 666 void JumpToRuntime(const ExternalReference& ext, int result_size);
655 667
(...skipping 16 matching lines...) Expand all
672 684
673 // Calculate the number of stack slots to reserve for arguments when calling a 685 // Calculate the number of stack slots to reserve for arguments when calling a
674 // C function. 686 // C function.
675 int ArgumentStackSlotsForCFunctionCall(int num_arguments); 687 int ArgumentStackSlotsForCFunctionCall(int num_arguments);
676 688
677 // --------------------------------------------------------------------------- 689 // ---------------------------------------------------------------------------
678 // Utilities 690 // Utilities
679 691
680 void Ret(); 692 void Ret();
681 693
682 struct Unresolved {
683 int pc;
684 uint32_t flags; // see Bootstrapper::FixupFlags decoders/encoders.
685 const char* name;
686 };
687 List<Unresolved>* unresolved() { return &unresolved_; }
688
689 Handle<Object> CodeObject() { return code_object_; } 694 Handle<Object> CodeObject() { return code_object_; }
690 695
691 696
692 // --------------------------------------------------------------------------- 697 // ---------------------------------------------------------------------------
693 // StatsCounter support 698 // StatsCounter support
694 699
695 void SetCounter(StatsCounter* counter, int value); 700 void SetCounter(StatsCounter* counter, int value);
696 void IncrementCounter(StatsCounter* counter, int value); 701 void IncrementCounter(StatsCounter* counter, int value);
697 void DecrementCounter(StatsCounter* counter, int value); 702 void DecrementCounter(StatsCounter* counter, int value);
698 703
(...skipping 11 matching lines...) Expand all
710 // Print a message to stdout and abort execution. 715 // Print a message to stdout and abort execution.
711 void Abort(const char* msg); 716 void Abort(const char* msg);
712 717
713 // Verify restrictions about code generated in stubs. 718 // Verify restrictions about code generated in stubs.
714 void set_generating_stub(bool value) { generating_stub_ = value; } 719 void set_generating_stub(bool value) { generating_stub_ = value; }
715 bool generating_stub() { return generating_stub_; } 720 bool generating_stub() { return generating_stub_; }
716 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } 721 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
717 bool allow_stub_calls() { return allow_stub_calls_; } 722 bool allow_stub_calls() { return allow_stub_calls_; }
718 723
719 private: 724 private:
720 List<Unresolved> unresolved_;
721 bool generating_stub_; 725 bool generating_stub_;
722 bool allow_stub_calls_; 726 bool allow_stub_calls_;
723 // This handle will be patched with the code object on installation. 727 // This handle will be patched with the code object on installation.
724 Handle<Object> code_object_; 728 Handle<Object> code_object_;
725 729
726 // Helper functions for generating invokes. 730 // Helper functions for generating invokes.
727 void InvokePrologue(const ParameterCount& expected, 731 void InvokePrologue(const ParameterCount& expected,
728 const ParameterCount& actual, 732 const ParameterCount& actual,
729 Handle<Code> code_constant, 733 Handle<Code> code_constant,
730 Register code_register, 734 Register code_register,
731 Label* done, 735 Label* done,
732 InvokeFlag flag); 736 InvokeFlag flag);
733 737
734 // Prepares for a call or jump to a builtin by doing two things:
735 // 1. Emits code that fetches the builtin's function object from the context
736 // at runtime, and puts it in the register rdi.
737 // 2. Fetches the builtin's code object, and returns it in a handle, at
738 // compile time, so that later code can emit instructions to jump or call
739 // the builtin directly. If the code object has not yet been created, it
740 // returns the builtin code object for IllegalFunction, and sets the
741 // output parameter "resolved" to false. Code that uses the return value
742 // should then add the address and the builtin name to the list of fixups
743 // called unresolved_, which is fixed up by the bootstrapper.
744 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved);
745
746 // Activation support. 738 // Activation support.
747 void EnterFrame(StackFrame::Type type); 739 void EnterFrame(StackFrame::Type type);
748 void LeaveFrame(StackFrame::Type type); 740 void LeaveFrame(StackFrame::Type type);
749 741
750 // Allocation support helpers. 742 // Allocation support helpers.
751 void LoadAllocationTopHelper(Register result, 743 void LoadAllocationTopHelper(Register result,
752 Register result_end, 744 Register result_end,
753 Register scratch, 745 Register scratch,
754 AllocationFlags flags); 746 AllocationFlags flags);
755 void UpdateAllocationTopHelper(Register result_end, Register scratch); 747 void UpdateAllocationTopHelper(Register result_end, Register scratch);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } \ 804 } \
813 masm-> 805 masm->
814 #else 806 #else
815 #define ACCESS_MASM(masm) masm-> 807 #define ACCESS_MASM(masm) masm->
816 #endif 808 #endif
817 809
818 810
819 } } // namespace v8::internal 811 } } // namespace v8::internal
820 812
821 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 813 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698