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

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

Issue 6366010: X64 Crankshaft: Added a bunch of operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
Patch Set: Address review comments. Created 9 years, 11 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/lithium-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 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } 145 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
146 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } 146 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
147 147
148 // Enter specific kind of exit frame; either in normal or 148 // Enter specific kind of exit frame; either in normal or
149 // debug mode. Expects the number of arguments in register rax and 149 // debug mode. Expects the number of arguments in register rax and
150 // sets up the number of arguments in register rdi and the pointer 150 // sets up the number of arguments in register rdi and the pointer
151 // to the first argument in register rsi. 151 // to the first argument in register rsi.
152 // 152 //
153 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack 153 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
154 // accessible via StackSpaceOperand. 154 // accessible via StackSpaceOperand.
155 void EnterExitFrame(int arg_stack_space = 0); 155 void EnterExitFrame(int arg_stack_space = 0, bool save_doubles = false);
156 156
157 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize 157 // Enter specific kind of exit frame. Allocates arg_stack_space * kPointerSize
158 // memory (not GCed) on the stack accessible via StackSpaceOperand. 158 // memory (not GCed) on the stack accessible via StackSpaceOperand.
159 void EnterApiExitFrame(int arg_stack_space); 159 void EnterApiExitFrame(int arg_stack_space);
160 160
161 // Leave the current exit frame. Expects/provides the return value in 161 // Leave the current exit frame. Expects/provides the return value in
162 // register rax:rdx (untouched) and the pointer to the first 162 // register rax:rdx (untouched) and the pointer to the first
163 // argument in register rsi. 163 // argument in register rsi.
164 void LeaveExitFrame(); 164 void LeaveExitFrame(bool save_doubles = false);
165 165
166 // Leave the current exit frame. Expects/provides the return value in 166 // Leave the current exit frame. Expects/provides the return value in
167 // register rax (untouched). 167 // register rax (untouched).
168 void LeaveApiExitFrame(); 168 void LeaveApiExitFrame();
169 169
170 // Push and pop the registers that can hold pointers. 170 // Push and pop the registers that can hold pointers.
171 void PushSafepointRegisters() { UNIMPLEMENTED(); } 171 void PushSafepointRegisters() { Pushad(); }
172 void PopSafepointRegisters() { UNIMPLEMENTED(); } 172 void PopSafepointRegisters() { Popad(); }
173 static int SafepointRegisterStackIndex(int reg_code) { 173 static int SafepointRegisterStackIndex(int reg_code) {
174 UNIMPLEMENTED(); 174 return kSafepointPushRegisterIndices[reg_code];
175 return 0;
176 } 175 }
177 176
177
178 // --------------------------------------------------------------------------- 178 // ---------------------------------------------------------------------------
179 // JavaScript invokes 179 // JavaScript invokes
180 180
181 // Invoke the JavaScript function code by either calling or jumping. 181 // Invoke the JavaScript function code by either calling or jumping.
182 void InvokeCode(Register code, 182 void InvokeCode(Register code,
183 const ParameterCount& expected, 183 const ParameterCount& expected,
184 const ParameterCount& actual, 184 const ParameterCount& actual,
185 InvokeFlag flag); 185 InvokeFlag flag);
186 186
187 void InvokeCode(Handle<Code> code, 187 void InvokeCode(Handle<Code> code,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 Condition CheckIsMinSmi(Register src); 294 Condition CheckIsMinSmi(Register src);
295 295
296 // Checks whether an 32-bit integer value is a valid for conversion 296 // Checks whether an 32-bit integer value is a valid for conversion
297 // to a smi. 297 // to a smi.
298 Condition CheckInteger32ValidSmiValue(Register src); 298 Condition CheckInteger32ValidSmiValue(Register src);
299 299
300 // Checks whether an 32-bit unsigned integer value is a valid for 300 // Checks whether an 32-bit unsigned integer value is a valid for
301 // conversion to a smi. 301 // conversion to a smi.
302 Condition CheckUInteger32ValidSmiValue(Register src); 302 Condition CheckUInteger32ValidSmiValue(Register src);
303 303
304 // Check whether src is a Smi, and set dst to zero if it is a smi,
305 // and to one if it isn't.
306 void CheckSmiToIndicator(Register dst, Register src);
307 void CheckSmiToIndicator(Register dst, const Operand& src);
308
304 // Test-and-jump functions. Typically combines a check function 309 // Test-and-jump functions. Typically combines a check function
305 // above with a conditional jump. 310 // above with a conditional jump.
306 311
307 // Jump if the value cannot be represented by a smi. 312 // Jump if the value cannot be represented by a smi.
308 template <typename LabelType> 313 template <typename LabelType>
309 void JumpIfNotValidSmiValue(Register src, LabelType* on_invalid); 314 void JumpIfNotValidSmiValue(Register src, LabelType* on_invalid);
310 315
311 // Jump if the unsigned integer value cannot be represented by a smi. 316 // Jump if the unsigned integer value cannot be represented by a smi.
312 template <typename LabelType> 317 template <typename LabelType>
313 void JumpIfUIntNotValidSmiValue(Register src, LabelType* on_invalid); 318 void JumpIfUIntNotValidSmiValue(Register src, LabelType* on_invalid);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 void Call(Address destination, RelocInfo::Mode rmode); 595 void Call(Address destination, RelocInfo::Mode rmode);
591 void Call(ExternalReference ext); 596 void Call(ExternalReference ext);
592 void Call(Handle<Code> code_object, RelocInfo::Mode rmode); 597 void Call(Handle<Code> code_object, RelocInfo::Mode rmode);
593 598
594 // Non-x64 instructions. 599 // Non-x64 instructions.
595 // Push/pop all general purpose registers. 600 // Push/pop all general purpose registers.
596 // Does not push rsp/rbp nor any of the assembler's special purpose registers 601 // Does not push rsp/rbp nor any of the assembler's special purpose registers
597 // (kScratchRegister, kSmiConstantRegister, kRootRegister). 602 // (kScratchRegister, kSmiConstantRegister, kRootRegister).
598 void Pushad(); 603 void Pushad();
599 void Popad(); 604 void Popad();
605 // Sets the stack as after performing Popad, without actually loading the
606 // registers.
607 void Dropad();
600 608
601 // Compare object type for heap object. 609 // Compare object type for heap object.
602 // Always use unsigned comparisons: above and below, not less and greater. 610 // Always use unsigned comparisons: above and below, not less and greater.
603 // Incoming register is heap_object and outgoing register is map. 611 // Incoming register is heap_object and outgoing register is map.
604 // They may be the same register, and may be kScratchRegister. 612 // They may be the same register, and may be kScratchRegister.
605 void CmpObjectType(Register heap_object, InstanceType type, Register map); 613 void CmpObjectType(Register heap_object, InstanceType type, Register map);
606 614
607 // Compare instance type for map. 615 // Compare instance type for map.
608 // Always use unsigned comparisons: above and below, not less and greater. 616 // Always use unsigned comparisons: above and below, not less and greater.
609 void CmpInstanceType(Register map, InstanceType type); 617 void CmpInstanceType(Register map, InstanceType type);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 // generate the code if necessary. Do not perform a GC but instead return 813 // generate the code if necessary. Do not perform a GC but instead return
806 // a retry after GC failure. 814 // a retry after GC failure.
807 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub); 815 MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub);
808 816
809 // Return from a code stub after popping its arguments. 817 // Return from a code stub after popping its arguments.
810 void StubReturn(int argc); 818 void StubReturn(int argc);
811 819
812 // Call a runtime routine. 820 // Call a runtime routine.
813 void CallRuntime(Runtime::Function* f, int num_arguments); 821 void CallRuntime(Runtime::Function* f, int num_arguments);
814 822
823 // Call a runtime function and save the value of XMM registers.
824 void CallRuntimeSaveDoubles(Runtime::FunctionId id);
825
815 // Call a runtime function, returning the CodeStub object called. 826 // Call a runtime function, returning the CodeStub object called.
816 // Try to generate the stub code if necessary. Do not perform a GC 827 // Try to generate the stub code if necessary. Do not perform a GC
817 // but instead return a retry after GC failure. 828 // but instead return a retry after GC failure.
818 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::Function* f, 829 MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::Function* f,
819 int num_arguments); 830 int num_arguments);
820 831
821 // Convenience function: Same as above, but takes the fid instead. 832 // Convenience function: Same as above, but takes the fid instead.
822 void CallRuntime(Runtime::FunctionId id, int num_arguments); 833 void CallRuntime(Runtime::FunctionId id, int num_arguments);
823 834
824 // Convenience function: Same as above, but takes the fid instead. 835 // Convenience function: Same as above, but takes the fid instead.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 // Check that the stack is aligned. 935 // Check that the stack is aligned.
925 void CheckStackAlignment(); 936 void CheckStackAlignment();
926 937
927 // Verify restrictions about code generated in stubs. 938 // Verify restrictions about code generated in stubs.
928 void set_generating_stub(bool value) { generating_stub_ = value; } 939 void set_generating_stub(bool value) { generating_stub_ = value; }
929 bool generating_stub() { return generating_stub_; } 940 bool generating_stub() { return generating_stub_; }
930 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } 941 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
931 bool allow_stub_calls() { return allow_stub_calls_; } 942 bool allow_stub_calls() { return allow_stub_calls_; }
932 943
933 private: 944 private:
945 // Order general registers are pushed by Pushad.
946 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14.
947 static int kSafepointPushRegisterIndices[Register::kNumRegisters];
934 bool generating_stub_; 948 bool generating_stub_;
935 bool allow_stub_calls_; 949 bool allow_stub_calls_;
936 950
937 // Returns a register holding the smi value. The register MUST NOT be 951 // Returns a register holding the smi value. The register MUST NOT be
938 // modified. It may be the "smi 1 constant" register. 952 // modified. It may be the "smi 1 constant" register.
939 Register GetSmiConstant(Smi* value); 953 Register GetSmiConstant(Smi* value);
940 954
941 // Moves the smi value to the destination register. 955 // Moves the smi value to the destination register.
942 void LoadSmiConstant(Register dst, Smi* value); 956 void LoadSmiConstant(Register dst, Smi* value);
943 957
(...skipping 10 matching lines...) Expand all
954 InvokeFlag flag); 968 InvokeFlag flag);
955 969
956 // Activation support. 970 // Activation support.
957 void EnterFrame(StackFrame::Type type); 971 void EnterFrame(StackFrame::Type type);
958 void LeaveFrame(StackFrame::Type type); 972 void LeaveFrame(StackFrame::Type type);
959 973
960 void EnterExitFramePrologue(bool save_rax); 974 void EnterExitFramePrologue(bool save_rax);
961 975
962 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack 976 // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
963 // accessible via StackSpaceOperand. 977 // accessible via StackSpaceOperand.
964 void EnterExitFrameEpilogue(int arg_stack_space); 978 void EnterExitFrameEpilogue(int arg_stack_space, bool save_doubles);
965 979
966 void LeaveExitFrameEpilogue(); 980 void LeaveExitFrameEpilogue();
967 981
968 // Allocation support helpers. 982 // Allocation support helpers.
969 // Loads the top of new-space into the result register. 983 // Loads the top of new-space into the result register.
970 // Otherwise the address of the new-space top is loaded into scratch (if 984 // Otherwise the address of the new-space top is loaded into scratch (if
971 // scratch is valid), and the new-space top is loaded into result. 985 // scratch is valid), and the new-space top is loaded into result.
972 void LoadAllocationTopHelper(Register result, 986 void LoadAllocationTopHelper(Register result,
973 Register scratch, 987 Register scratch,
974 AllocationFlags flags); 988 AllocationFlags flags);
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 Jump(adaptor, RelocInfo::CODE_TARGET); 1768 Jump(adaptor, RelocInfo::CODE_TARGET);
1755 } 1769 }
1756 bind(&invoke); 1770 bind(&invoke);
1757 } 1771 }
1758 } 1772 }
1759 1773
1760 1774
1761 } } // namespace v8::internal 1775 } } // namespace v8::internal
1762 1776
1763 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1777 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698