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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 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/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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // --------------------------------------------------------------------------- 384 // ---------------------------------------------------------------------------
385 // Smi tagging, untagging and operations on tagged smis. 385 // Smi tagging, untagging and operations on tagged smis.
386 386
387 // Support for constant splitting. 387 // Support for constant splitting.
388 bool IsUnsafeInt(const int32_t x); 388 bool IsUnsafeInt(const int32_t x);
389 void SafeMove(Register dst, Smi* src); 389 void SafeMove(Register dst, Smi* src);
390 void SafePush(Smi* src); 390 void SafePush(Smi* src);
391 391
392 void InitializeSmiConstantRegister() { 392 void InitializeSmiConstantRegister() {
393 Move(kSmiConstantRegister, Smi::FromInt(kSmiConstantRegisterValue), 393 Move(kSmiConstantRegister, Smi::FromInt(kSmiConstantRegisterValue),
394 RelocInfo::NONE64); 394 Assembler::RelocInfoNone());
395 } 395 }
396 396
397 // Conversions between tagged smi values and non-tagged integer values. 397 // Conversions between tagged smi values and non-tagged integer values.
398 398
399 // Tag an integer value. The result must be known to be a valid smi value. 399 // Tag an integer value. The result must be known to be a valid smi value.
400 // Only uses the low 32 bits of the src register. Sets the N and Z flags 400 // Only uses the low 32 bits of the src register. Sets the N and Z flags
401 // based on the value of the resulting smi. 401 // based on the value of the resulting smi.
402 void Integer32ToSmi(Register dst, Register src); 402 void Integer32ToSmi(Register dst, Register src);
403 403
404 // Stores an integer32 value into a memory field that already holds a smi. 404 // Stores an integer32 value into a memory field that already holds a smi.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 // --------------------------------------------------------------------------- 796 // ---------------------------------------------------------------------------
797 // Macro instructions. 797 // Macro instructions.
798 798
799 // Load/store with specific representation. 799 // Load/store with specific representation.
800 void Load(Register dst, const Operand& src, Representation r); 800 void Load(Register dst, const Operand& src, Representation r);
801 void Store(const Operand& dst, Register src, Representation r); 801 void Store(const Operand& dst, Register src, Representation r);
802 802
803 // Load a register with a long value as efficiently as possible. 803 // Load a register with a long value as efficiently as possible.
804 void Set(Register dst, int64_t x); 804 void Set(Register dst, int64_t x);
805 void Set(const Operand& dst, int64_t x); 805 void Set(const Operand& dst, intptr_t x);
806 806
807 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which 807 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which
808 // hinders register renaming and makes dependence chains longer. So we use 808 // hinders register renaming and makes dependence chains longer. So we use
809 // xorps to clear the dst register before cvtsi2sd to solve this issue. 809 // xorps to clear the dst register before cvtsi2sd to solve this issue.
810 void Cvtlsi2sd(XMMRegister dst, Register src); 810 void Cvtlsi2sd(XMMRegister dst, Register src);
811 void Cvtlsi2sd(XMMRegister dst, const Operand& src); 811 void Cvtlsi2sd(XMMRegister dst, const Operand& src);
812 812
813 // Move if the registers are not identical. 813 // Move if the registers are not identical.
814 void Move(Register target, Register source); 814 void Move(Register target, Register source);
815 815
(...skipping 18 matching lines...) Expand all
834 834
835 // Emit code to discard a non-negative number of pointer-sized elements 835 // Emit code to discard a non-negative number of pointer-sized elements
836 // from the stack, clobbering only the rsp register. 836 // from the stack, clobbering only the rsp register.
837 void Drop(int stack_elements); 837 void Drop(int stack_elements);
838 838
839 void Call(Label* target) { call(target); } 839 void Call(Label* target) { call(target); }
840 void Push(Register src) { push(src); } 840 void Push(Register src) { push(src); }
841 void Pop(Register dst) { pop(dst); } 841 void Pop(Register dst) { pop(dst); }
842 void PushReturnAddressFrom(Register src) { push(src); } 842 void PushReturnAddressFrom(Register src) { push(src); }
843 void PopReturnAddressTo(Register dst) { pop(dst); } 843 void PopReturnAddressTo(Register dst) { pop(dst); }
844 void MoveDouble(Register dst, const Operand& src) { movq(dst, src); }
845 void MoveDouble(const Operand& dst, Register src) { movq(dst, src); }
846
847 void Move(Register dst, ExternalReference ext) { 844 void Move(Register dst, ExternalReference ext) {
848 movp(dst, reinterpret_cast<Address>(ext.address()), 845 movp(dst, reinterpret_cast<Address>(ext.address()),
849 RelocInfo::EXTERNAL_REFERENCE); 846 RelocInfo::EXTERNAL_REFERENCE);
850 } 847 }
851 848
852 // Loads a pointer into a register with a relocation mode. 849 // Loads a pointer into a register with a relocation mode.
853 void Move(Register dst, void* ptr, RelocInfo::Mode rmode) { 850 void Move(Register dst, void* ptr, RelocInfo::Mode rmode) {
854 // This method must not be used with heap object references. The stored 851 // This method must not be used with heap object references. The stored
855 // address is not GC safe. Use the handle version instead. 852 // address is not GC safe. Use the handle version instead.
856 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); 853 ASSERT(rmode > RelocInfo::LAST_GCED_ENUM);
857 movp(dst, ptr, rmode); 854 movp(dst, ptr, rmode);
858 } 855 }
859 856
860 void Move(Register dst, Handle<Object> value, RelocInfo::Mode rmode) { 857 void Move(Register dst, Handle<Object> value, RelocInfo::Mode rmode) {
861 AllowDeferredHandleDereference using_raw_address; 858 AllowDeferredHandleDereference using_raw_address;
862 ASSERT(!RelocInfo::IsNone(rmode)); 859 ASSERT(!RelocInfo::IsNone(rmode));
863 ASSERT(value->IsHeapObject()); 860 ASSERT(value->IsHeapObject());
864 ASSERT(!isolate()->heap()->InNewSpace(*value)); 861 ASSERT(!isolate()->heap()->InNewSpace(*value));
865 movp(dst, value.location(), rmode); 862 movp(dst, value.location(), rmode);
866 } 863 }
867 864
868 // Control Flow 865 // Control Flow
869 void Jump(Address destination, RelocInfo::Mode rmode); 866 void Jump(Address destination, RelocInfo::Mode rmode);
870 void Jump(ExternalReference ext); 867 void Jump(ExternalReference ext);
868 void Jump(const Operand& op);
871 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); 869 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode);
872 870
873 void Call(Address destination, RelocInfo::Mode rmode); 871 void Call(Address destination, RelocInfo::Mode rmode);
874 void Call(ExternalReference ext); 872 void Call(ExternalReference ext);
873 void Call(const Operand& op);
875 void Call(Handle<Code> code_object, 874 void Call(Handle<Code> code_object,
876 RelocInfo::Mode rmode, 875 RelocInfo::Mode rmode,
877 TypeFeedbackId ast_id = TypeFeedbackId::None()); 876 TypeFeedbackId ast_id = TypeFeedbackId::None());
878 877
879 // The size of the code generated for different call instructions. 878 // The size of the code generated for different call instructions.
880 int CallSize(Address destination, RelocInfo::Mode rmode) { 879 int CallSize(Address destination) {
881 return kCallSequenceLength; 880 return kCallSequenceLength;
882 } 881 }
883 int CallSize(ExternalReference ext); 882 int CallSize(ExternalReference ext);
884 int CallSize(Handle<Code> code_object) { 883 int CallSize(Handle<Code> code_object) {
885 // Code calls use 32-bit relative addressing. 884 // Code calls use 32-bit relative addressing.
886 return kShortCallInstructionLength; 885 return kShortCallInstructionLength;
887 } 886 }
888 int CallSize(Register target) { 887 int CallSize(Register target) {
889 // Opcode: REX_opt FF /2 m64 888 // Opcode: REX_opt FF /2 m64
890 return (target.high_bit() != 0) ? 3 : 2; 889 return (target.high_bit() != 0) ? 3 : 2;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 // transitioned_kind from the native context if the map in register 1227 // transitioned_kind from the native context if the map in register
1229 // map_in_out is the cached Array map in the native context of 1228 // map_in_out is the cached Array map in the native context of
1230 // expected_kind. 1229 // expected_kind.
1231 void LoadTransitionedArrayMapConditional( 1230 void LoadTransitionedArrayMapConditional(
1232 ElementsKind expected_kind, 1231 ElementsKind expected_kind,
1233 ElementsKind transitioned_kind, 1232 ElementsKind transitioned_kind,
1234 Register map_in_out, 1233 Register map_in_out,
1235 Register scratch, 1234 Register scratch,
1236 Label* no_map_match); 1235 Label* no_map_match);
1237 1236
1238 // Load the initial map for new Arrays from a JSFunction.
1239 void LoadInitialArrayMap(Register function_in,
1240 Register scratch,
1241 Register map_out,
1242 bool can_have_holes);
1243
1244 // Load the global function with the given index. 1237 // Load the global function with the given index.
1245 void LoadGlobalFunction(int index, Register function); 1238 void LoadGlobalFunction(int index, Register function);
1246 void LoadArrayFunction(Register function);
1247 1239
1248 // Load the initial map from the global function. The registers 1240 // Load the initial map from the global function. The registers
1249 // function and map can be the same. 1241 // function and map can be the same.
1250 void LoadGlobalFunctionInitialMap(Register function, Register map); 1242 void LoadGlobalFunctionInitialMap(Register function, Register map);
1251 1243
1252 // --------------------------------------------------------------------------- 1244 // ---------------------------------------------------------------------------
1253 // Runtime calls 1245 // Runtime calls
1254 1246
1255 // Call a code stub. 1247 // Call a code stub.
1256 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None()); 1248 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 // convention requires to put the pointer to the return value slot into 1294 // convention requires to put the pointer to the return value slot into
1303 // rcx (rcx must be preserverd until CallApiFunctionAndReturn). Saves 1295 // rcx (rcx must be preserverd until CallApiFunctionAndReturn). Saves
1304 // context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize 1296 // context (rsi). Clobbers rax. Allocates arg_stack_space * kPointerSize
1305 // inside the exit frame (not GCed) accessible via StackSpaceOperand. 1297 // inside the exit frame (not GCed) accessible via StackSpaceOperand.
1306 void PrepareCallApiFunction(int arg_stack_space); 1298 void PrepareCallApiFunction(int arg_stack_space);
1307 1299
1308 // Calls an API function. Allocates HandleScope, extracts returned value 1300 // Calls an API function. Allocates HandleScope, extracts returned value
1309 // from handle and propagates exceptions. Clobbers r14, r15, rbx and 1301 // from handle and propagates exceptions. Clobbers r14, r15, rbx and
1310 // caller-save registers. Restores context. On return removes 1302 // caller-save registers. Restores context. On return removes
1311 // stack_space * kPointerSize (GCed). 1303 // stack_space * kPointerSize (GCed).
1312 void CallApiFunctionAndReturn(Address function_address, 1304 void CallApiFunctionAndReturn(Register function_address,
1313 Address thunk_address, 1305 Address thunk_address,
1314 Register thunk_last_arg, 1306 Register thunk_last_arg,
1315 int stack_space, 1307 int stack_space,
1316 Operand return_value_operand, 1308 Operand return_value_operand,
1317 Operand* context_restore_operand); 1309 Operand* context_restore_operand);
1318 1310
1319 // Before calling a C-function from generated code, align arguments on stack. 1311 // Before calling a C-function from generated code, align arguments on stack.
1320 // After aligning the frame, arguments must be stored in rsp[0], rsp[8], 1312 // After aligning the frame, arguments must be stored in rsp[0], rsp[8],
1321 // etc., not pushed. The argument count assumes all arguments are word sized. 1313 // etc., not pushed. The argument count assumes all arguments are word sized.
1322 // The number of slots reserved for arguments depends on platform. On Windows 1314 // The number of slots reserved for arguments depends on platform. On Windows
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 masm->popfq(); \ 1607 masm->popfq(); \
1616 } \ 1608 } \
1617 masm-> 1609 masm->
1618 #else 1610 #else
1619 #define ACCESS_MASM(masm) masm-> 1611 #define ACCESS_MASM(masm) masm->
1620 #endif 1612 #endif
1621 1613
1622 } } // namespace v8::internal 1614 } } // namespace v8::internal
1623 1615
1624 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1616 #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