OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ | 5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
7 | 7 |
8 #include "src/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
10 #include "src/frames.h" | 10 #include "src/frames.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 RecordWriteField(context, | 278 RecordWriteField(context, |
279 offset + kHeapObjectTag, | 279 offset + kHeapObjectTag, |
280 value, | 280 value, |
281 scratch, | 281 scratch, |
282 save_fp, | 282 save_fp, |
283 remembered_set_action, | 283 remembered_set_action, |
284 smi_check, | 284 smi_check, |
285 pointers_to_here_check_for_value); | 285 pointers_to_here_check_for_value); |
286 } | 286 } |
287 | 287 |
288 // Notify the garbage collector that we wrote a pointer into a fixed array. | |
289 // |array| is the array being stored into, |value| is the | |
290 // object being stored. |index| is the array index represented as a non-smi. | |
291 // All registers are clobbered by the operation RecordWriteArray | |
292 // filters out smis so it does not update the write barrier if the | |
293 // value is a smi. | |
294 void RecordWriteArray( | |
295 Register array, | |
296 Register value, | |
297 Register index, | |
298 SaveFPRegsMode save_fp, | |
299 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, | |
300 SmiCheck smi_check = INLINE_SMI_CHECK, | |
301 PointersToHereCheck pointers_to_here_check_for_value = | |
302 kPointersToHereMaybeInteresting); | |
303 | |
304 // Notify the garbage collector that we wrote a code entry into a | 288 // Notify the garbage collector that we wrote a code entry into a |
305 // JSFunction. Only scratch is clobbered by the operation. | 289 // JSFunction. Only scratch is clobbered by the operation. |
306 void RecordWriteCodeEntryField(Register js_function, Register code_entry, | 290 void RecordWriteCodeEntryField(Register js_function, Register code_entry, |
307 Register scratch); | 291 Register scratch); |
308 | 292 |
309 void RecordWriteForMap( | 293 void RecordWriteForMap( |
310 Register object, | 294 Register object, |
311 Register map, | 295 Register map, |
312 Register dst, | 296 Register dst, |
313 SaveFPRegsMode save_fp); | 297 SaveFPRegsMode save_fp); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 SmiToInteger32(kScratchRegister, src); | 438 SmiToInteger32(kScratchRegister, src); |
455 Cvtlsi2sd(dst, kScratchRegister); | 439 Cvtlsi2sd(dst, kScratchRegister); |
456 } | 440 } |
457 | 441 |
458 // Multiply a positive smi's integer value by a power of two. | 442 // Multiply a positive smi's integer value by a power of two. |
459 // Provides result as 64-bit integer value. | 443 // Provides result as 64-bit integer value. |
460 void PositiveSmiTimesPowerOfTwoToInteger64(Register dst, | 444 void PositiveSmiTimesPowerOfTwoToInteger64(Register dst, |
461 Register src, | 445 Register src, |
462 int power); | 446 int power); |
463 | 447 |
464 // Divide a positive smi's integer value by a power of two. | |
465 // Provides result as 32-bit integer value. | |
466 void PositiveSmiDivPowerOfTwoToInteger32(Register dst, | |
467 Register src, | |
468 int power); | |
469 | |
470 // Perform the logical or of two smi values and return a smi value. | |
471 // If either argument is not a smi, jump to on_not_smis and retain | |
472 // the original values of source registers. The destination register | |
473 // may be changed if it's not one of the source registers. | |
474 void SmiOrIfSmis(Register dst, | |
475 Register src1, | |
476 Register src2, | |
477 Label* on_not_smis, | |
478 Label::Distance near_jump = Label::kFar); | |
479 | |
480 | |
481 // Simple comparison of smis. Both sides must be known smis to use these, | 448 // Simple comparison of smis. Both sides must be known smis to use these, |
482 // otherwise use Cmp. | 449 // otherwise use Cmp. |
483 void SmiCompare(Register smi1, Register smi2); | 450 void SmiCompare(Register smi1, Register smi2); |
484 void SmiCompare(Register dst, Smi* src); | 451 void SmiCompare(Register dst, Smi* src); |
485 void SmiCompare(Register dst, const Operand& src); | 452 void SmiCompare(Register dst, const Operand& src); |
486 void SmiCompare(const Operand& dst, Register src); | 453 void SmiCompare(const Operand& dst, Register src); |
487 void SmiCompare(const Operand& dst, Smi* src); | 454 void SmiCompare(const Operand& dst, Smi* src); |
488 // Compare the int32 in src register to the value of the smi stored at dst. | 455 // Compare the int32 in src register to the value of the smi stored at dst. |
489 void SmiCompareInteger32(const Operand& dst, Register src); | |
490 // Sets sign and zero flags depending on value of smi in register. | |
491 void SmiTest(Register src); | 456 void SmiTest(Register src); |
492 | 457 |
493 // Functions performing a check on a known or potential smi. Returns | 458 // Functions performing a check on a known or potential smi. Returns |
494 // a condition that is satisfied if the check is successful. | 459 // a condition that is satisfied if the check is successful. |
495 | 460 |
496 // Is the value a tagged smi. | 461 // Is the value a tagged smi. |
497 Condition CheckSmi(Register src); | 462 Condition CheckSmi(Register src); |
498 Condition CheckSmi(const Operand& src); | 463 Condition CheckSmi(const Operand& src); |
499 | 464 |
500 // Is the value a non-negative tagged smi. | 465 // Is the value a non-negative tagged smi. |
(...skipping 11 matching lines...) Expand all Loading... |
512 Register scratch = kScratchRegister); | 477 Register scratch = kScratchRegister); |
513 | 478 |
514 // Checks whether an 32-bit integer value is a valid for conversion | 479 // Checks whether an 32-bit integer value is a valid for conversion |
515 // to a smi. | 480 // to a smi. |
516 Condition CheckInteger32ValidSmiValue(Register src); | 481 Condition CheckInteger32ValidSmiValue(Register src); |
517 | 482 |
518 // Checks whether an 32-bit unsigned integer value is a valid for | 483 // Checks whether an 32-bit unsigned integer value is a valid for |
519 // conversion to a smi. | 484 // conversion to a smi. |
520 Condition CheckUInteger32ValidSmiValue(Register src); | 485 Condition CheckUInteger32ValidSmiValue(Register src); |
521 | 486 |
522 // Check whether src is a Smi, and set dst to zero if it is a smi, | |
523 // and to one if it isn't. | |
524 void CheckSmiToIndicator(Register dst, Register src); | |
525 void CheckSmiToIndicator(Register dst, const Operand& src); | |
526 | |
527 // Test-and-jump functions. Typically combines a check function | 487 // Test-and-jump functions. Typically combines a check function |
528 // above with a conditional jump. | 488 // above with a conditional jump. |
529 | 489 |
530 // Jump if the value can be represented by a smi. | 490 // Jump if the value can be represented by a smi. |
531 void JumpIfValidSmiValue(Register src, Label* on_valid, | 491 void JumpIfValidSmiValue(Register src, Label* on_valid, |
532 Label::Distance near_jump = Label::kFar); | 492 Label::Distance near_jump = Label::kFar); |
533 | 493 |
534 // Jump if the value cannot be represented by a smi. | 494 // Jump if the value cannot be represented by a smi. |
535 void JumpIfNotValidSmiValue(Register src, Label* on_invalid, | 495 void JumpIfNotValidSmiValue(Register src, Label* on_invalid, |
536 Label::Distance near_jump = Label::kFar); | 496 Label::Distance near_jump = Label::kFar); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 Register object_map, | 747 Register object_map, |
788 Label* not_string, | 748 Label* not_string, |
789 Label::Distance near_jump = Label::kFar); | 749 Label::Distance near_jump = Label::kFar); |
790 | 750 |
791 | 751 |
792 void JumpIfNotBothSequentialOneByteStrings( | 752 void JumpIfNotBothSequentialOneByteStrings( |
793 Register first_object, Register second_object, Register scratch1, | 753 Register first_object, Register second_object, Register scratch1, |
794 Register scratch2, Label* on_not_both_flat_one_byte, | 754 Register scratch2, Label* on_not_both_flat_one_byte, |
795 Label::Distance near_jump = Label::kFar); | 755 Label::Distance near_jump = Label::kFar); |
796 | 756 |
797 // Check whether the instance type represents a flat one-byte string. Jump | |
798 // to the label if not. If the instance type can be scratched specify same | |
799 // register for both instance type and scratch. | |
800 void JumpIfInstanceTypeIsNotSequentialOneByte( | |
801 Register instance_type, Register scratch, | |
802 Label* on_not_flat_one_byte_string, | |
803 Label::Distance near_jump = Label::kFar); | |
804 | |
805 void JumpIfBothInstanceTypesAreNotSequentialOneByte( | 757 void JumpIfBothInstanceTypesAreNotSequentialOneByte( |
806 Register first_object_instance_type, Register second_object_instance_type, | 758 Register first_object_instance_type, Register second_object_instance_type, |
807 Register scratch1, Register scratch2, Label* on_fail, | 759 Register scratch1, Register scratch2, Label* on_fail, |
808 Label::Distance near_jump = Label::kFar); | 760 Label::Distance near_jump = Label::kFar); |
809 | 761 |
810 void EmitSeqStringSetCharCheck(Register string, | 762 void EmitSeqStringSetCharCheck(Register string, |
811 Register index, | 763 Register index, |
812 Register value, | 764 Register value, |
813 uint32_t encoding_mask); | 765 uint32_t encoding_mask); |
814 | 766 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 void Cvttsd2si(Register dst, XMMRegister src); | 810 void Cvttsd2si(Register dst, XMMRegister src); |
859 void Cvttsd2si(Register dst, const Operand& src); | 811 void Cvttsd2si(Register dst, const Operand& src); |
860 void Cvttss2siq(Register dst, XMMRegister src); | 812 void Cvttss2siq(Register dst, XMMRegister src); |
861 void Cvttss2siq(Register dst, const Operand& src); | 813 void Cvttss2siq(Register dst, const Operand& src); |
862 void Cvttsd2siq(Register dst, XMMRegister src); | 814 void Cvttsd2siq(Register dst, XMMRegister src); |
863 void Cvttsd2siq(Register dst, const Operand& src); | 815 void Cvttsd2siq(Register dst, const Operand& src); |
864 | 816 |
865 // Move if the registers are not identical. | 817 // Move if the registers are not identical. |
866 void Move(Register target, Register source); | 818 void Move(Register target, Register source); |
867 | 819 |
868 // TestBit and Load SharedFunctionInfo special field. | |
869 void TestBitSharedFunctionInfoSpecialField(Register base, | |
870 int offset, | |
871 int bit_index); | |
872 void LoadSharedFunctionInfoSpecialField(Register dst, | 820 void LoadSharedFunctionInfoSpecialField(Register dst, |
873 Register base, | 821 Register base, |
874 int offset); | 822 int offset); |
875 | 823 |
876 // Handle support | 824 // Handle support |
877 void Move(Register dst, Handle<Object> source); | 825 void Move(Register dst, Handle<Object> source); |
878 void Move(const Operand& dst, Handle<Object> source); | 826 void Move(const Operand& dst, Handle<Object> source); |
879 void Cmp(Register dst, Handle<Object> source); | 827 void Cmp(Register dst, Handle<Object> source); |
880 void Cmp(const Operand& dst, Handle<Object> source); | 828 void Cmp(const Operand& dst, Handle<Object> source); |
881 void Cmp(Register dst, Smi* src); | 829 void Cmp(Register dst, Smi* src); |
882 void Cmp(const Operand& dst, Smi* src); | 830 void Cmp(const Operand& dst, Smi* src); |
883 void Push(Handle<Object> source); | 831 void Push(Handle<Object> source); |
884 | 832 |
885 // Load a heap object and handle the case of new-space objects by | 833 // Load a heap object and handle the case of new-space objects by |
886 // indirecting via a global cell. | 834 // indirecting via a global cell. |
887 void MoveHeapObject(Register result, Handle<Object> object); | 835 void MoveHeapObject(Register result, Handle<Object> object); |
888 | 836 |
889 // Load a global cell into a register. | |
890 void LoadGlobalCell(Register dst, Handle<Cell> cell); | |
891 | |
892 // Compare the given value and the value of weak cell. | |
893 void CmpWeakValue(Register value, Handle<WeakCell> cell, Register scratch); | |
894 | |
895 void GetWeakValue(Register value, Handle<WeakCell> cell); | 837 void GetWeakValue(Register value, Handle<WeakCell> cell); |
896 | 838 |
897 // Load the value of the weak cell in the value register. Branch to the given | 839 // Load the value of the weak cell in the value register. Branch to the given |
898 // miss label if the weak cell was cleared. | 840 // miss label if the weak cell was cleared. |
899 void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss); | 841 void LoadWeakValue(Register value, Handle<WeakCell> cell, Label* miss); |
900 | 842 |
901 // Emit code that loads |parameter_index|'th parameter from the stack to | 843 // Emit code that loads |parameter_index|'th parameter from the stack to |
902 // the register according to the CallInterfaceDescriptor definition. | 844 // the register according to the CallInterfaceDescriptor definition. |
903 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed | 845 // |sp_to_caller_sp_offset_in_words| specifies the number of words pushed |
904 // below the caller's sp (on x64 it's at least return address). | 846 // below the caller's sp (on x64 it's at least return address). |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1040 |
1099 void Popcntq(Register dst, Register src); | 1041 void Popcntq(Register dst, Register src); |
1100 void Popcntq(Register dst, const Operand& src); | 1042 void Popcntq(Register dst, const Operand& src); |
1101 | 1043 |
1102 // Non-x64 instructions. | 1044 // Non-x64 instructions. |
1103 // Push/pop all general purpose registers. | 1045 // Push/pop all general purpose registers. |
1104 // Does not push rsp/rbp nor any of the assembler's special purpose registers | 1046 // Does not push rsp/rbp nor any of the assembler's special purpose registers |
1105 // (kScratchRegister, kRootRegister). | 1047 // (kScratchRegister, kRootRegister). |
1106 void Pushad(); | 1048 void Pushad(); |
1107 void Popad(); | 1049 void Popad(); |
1108 // Sets the stack as after performing Popad, without actually loading the | |
1109 // registers. | |
1110 void Dropad(); | |
1111 | 1050 |
1112 // Compare object type for heap object. | 1051 // Compare object type for heap object. |
1113 // Always use unsigned comparisons: above and below, not less and greater. | 1052 // Always use unsigned comparisons: above and below, not less and greater. |
1114 // Incoming register is heap_object and outgoing register is map. | 1053 // Incoming register is heap_object and outgoing register is map. |
1115 // They may be the same register, and may be kScratchRegister. | 1054 // They may be the same register, and may be kScratchRegister. |
1116 void CmpObjectType(Register heap_object, InstanceType type, Register map); | 1055 void CmpObjectType(Register heap_object, InstanceType type, Register map); |
1117 | 1056 |
1118 // Compare instance type for map. | 1057 // Compare instance type for map. |
1119 // Always use unsigned comparisons: above and below, not less and greater. | 1058 // Always use unsigned comparisons: above and below, not less and greater. |
1120 void CmpInstanceType(Register map, InstanceType type); | 1059 void CmpInstanceType(Register map, InstanceType type); |
1121 | 1060 |
1122 // Compare an object's map with the specified map. | 1061 // Compare an object's map with the specified map. |
1123 void CompareMap(Register obj, Handle<Map> map); | 1062 void CompareMap(Register obj, Handle<Map> map); |
1124 | 1063 |
1125 // Check if the map of an object is equal to a specified map and branch to | 1064 // Check if the map of an object is equal to a specified map and branch to |
1126 // label if not. Skip the smi check if not required (object is known to be a | 1065 // label if not. Skip the smi check if not required (object is known to be a |
1127 // heap object). If mode is ALLOW_ELEMENT_TRANSITION_MAPS, then also match | 1066 // heap object). If mode is ALLOW_ELEMENT_TRANSITION_MAPS, then also match |
1128 // against maps that are ElementsKind transition maps of the specified map. | 1067 // against maps that are ElementsKind transition maps of the specified map. |
1129 void CheckMap(Register obj, | 1068 void CheckMap(Register obj, |
1130 Handle<Map> map, | 1069 Handle<Map> map, |
1131 Label* fail, | 1070 Label* fail, |
1132 SmiCheckType smi_check_type); | 1071 SmiCheckType smi_check_type); |
1133 | 1072 |
1134 // Check if the map of an object is equal to a specified weak map and branch | |
1135 // to a specified target if equal. Skip the smi check if not required | |
1136 // (object is known to be a heap object) | |
1137 void DispatchWeakMap(Register obj, Register scratch1, Register scratch2, | |
1138 Handle<WeakCell> cell, Handle<Code> success, | |
1139 SmiCheckType smi_check_type); | |
1140 | |
1141 // Check if the object in register heap_object is a string. Afterwards the | 1073 // Check if the object in register heap_object is a string. Afterwards the |
1142 // register map contains the object map and the register instance_type | 1074 // register map contains the object map and the register instance_type |
1143 // contains the instance_type. The registers map and instance_type can be the | 1075 // contains the instance_type. The registers map and instance_type can be the |
1144 // same in which case it contains the instance type afterwards. Either of the | 1076 // same in which case it contains the instance type afterwards. Either of the |
1145 // registers map and instance_type can be the same as heap_object. | 1077 // registers map and instance_type can be the same as heap_object. |
1146 Condition IsObjectStringType(Register heap_object, | 1078 Condition IsObjectStringType(Register heap_object, |
1147 Register map, | 1079 Register map, |
1148 Register instance_type); | 1080 Register instance_type); |
1149 | 1081 |
1150 // Check if the object in register heap_object is a name. Afterwards the | |
1151 // register map contains the object map and the register instance_type | |
1152 // contains the instance_type. The registers map and instance_type can be the | |
1153 // same in which case it contains the instance type afterwards. Either of the | |
1154 // registers map and instance_type can be the same as heap_object. | |
1155 Condition IsObjectNameType(Register heap_object, | |
1156 Register map, | |
1157 Register instance_type); | |
1158 | |
1159 // FCmp compares and pops the two values on top of the FPU stack. | 1082 // FCmp compares and pops the two values on top of the FPU stack. |
1160 // The flag results are similar to integer cmp, but requires unsigned | 1083 // The flag results are similar to integer cmp, but requires unsigned |
1161 // jcc instructions (je, ja, jae, jb, jbe, je, and jz). | 1084 // jcc instructions (je, ja, jae, jb, jbe, je, and jz). |
1162 void FCmp(); | 1085 void FCmp(); |
1163 | 1086 |
1164 void ClampUint8(Register reg); | 1087 void ClampUint8(Register reg); |
1165 | 1088 |
1166 void ClampDoubleToUint8(XMMRegister input_reg, | 1089 void ClampDoubleToUint8(XMMRegister input_reg, |
1167 XMMRegister temp_xmm_reg, | 1090 XMMRegister temp_xmm_reg, |
1168 Register result_reg); | 1091 Register result_reg); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 DCHECK((mask & 0x80000000u) == 0); | 1132 DCHECK((mask & 0x80000000u) == 0); |
1210 if (shift < kSmiShift) { | 1133 if (shift < kSmiShift) { |
1211 shlp(reg, Immediate(kSmiShift - shift)); | 1134 shlp(reg, Immediate(kSmiShift - shift)); |
1212 } else if (shift > kSmiShift) { | 1135 } else if (shift > kSmiShift) { |
1213 sarp(reg, Immediate(shift - kSmiShift)); | 1136 sarp(reg, Immediate(shift - kSmiShift)); |
1214 } | 1137 } |
1215 andp(reg, Immediate(mask)); | 1138 andp(reg, Immediate(mask)); |
1216 } | 1139 } |
1217 } | 1140 } |
1218 | 1141 |
1219 // Abort execution if argument is not a number, enabled via --debug-code. | |
1220 void AssertNumber(Register object); | |
1221 void AssertNotNumber(Register object); | |
1222 | |
1223 // Abort execution if argument is a smi, enabled via --debug-code. | 1142 // Abort execution if argument is a smi, enabled via --debug-code. |
1224 void AssertNotSmi(Register object); | 1143 void AssertNotSmi(Register object); |
1225 | 1144 |
1226 // Abort execution if argument is not a smi, enabled via --debug-code. | 1145 // Abort execution if argument is not a smi, enabled via --debug-code. |
1227 void AssertSmi(Register object); | 1146 void AssertSmi(Register object); |
1228 void AssertSmi(const Operand& object); | 1147 void AssertSmi(const Operand& object); |
1229 | 1148 |
1230 // Abort execution if a 64 bit register containing a 32 bit payload does not | 1149 // Abort execution if a 64 bit register containing a 32 bit payload does not |
1231 // have zeros in the top 32 bits, enabled via --debug-code. | 1150 // have zeros in the top 32 bits, enabled via --debug-code. |
1232 void AssertZeroExtended(Register reg); | 1151 void AssertZeroExtended(Register reg); |
1233 | 1152 |
1234 // Abort execution if argument is not a string, enabled via --debug-code. | |
1235 void AssertString(Register object); | |
1236 | |
1237 // Abort execution if argument is not a name, enabled via --debug-code. | |
1238 void AssertName(Register object); | |
1239 | |
1240 // Abort execution if argument is not a JSFunction, enabled via --debug-code. | 1153 // Abort execution if argument is not a JSFunction, enabled via --debug-code. |
1241 void AssertFunction(Register object); | 1154 void AssertFunction(Register object); |
1242 | 1155 |
1243 // Abort execution if argument is not a JSBoundFunction, | 1156 // Abort execution if argument is not a JSBoundFunction, |
1244 // enabled via --debug-code. | 1157 // enabled via --debug-code. |
1245 void AssertBoundFunction(Register object); | 1158 void AssertBoundFunction(Register object); |
1246 | 1159 |
1247 // Abort execution if argument is not a JSGeneratorObject, | 1160 // Abort execution if argument is not a JSGeneratorObject, |
1248 // enabled via --debug-code. | 1161 // enabled via --debug-code. |
1249 void AssertGeneratorObject(Register object); | 1162 void AssertGeneratorObject(Register object); |
1250 | 1163 |
1251 // Abort execution if argument is not a JSReceiver, enabled via --debug-code. | |
1252 void AssertReceiver(Register object); | |
1253 | |
1254 // Abort execution if argument is not undefined or an AllocationSite, enabled | 1164 // Abort execution if argument is not undefined or an AllocationSite, enabled |
1255 // via --debug-code. | 1165 // via --debug-code. |
1256 void AssertUndefinedOrAllocationSite(Register object); | 1166 void AssertUndefinedOrAllocationSite(Register object); |
1257 | 1167 |
1258 // Abort execution if argument is not the root value with the given index, | |
1259 // enabled via --debug-code. | |
1260 void AssertRootValue(Register src, | |
1261 Heap::RootListIndex root_value_index, | |
1262 BailoutReason reason); | |
1263 | |
1264 // --------------------------------------------------------------------------- | 1168 // --------------------------------------------------------------------------- |
1265 // Exception handling | 1169 // Exception handling |
1266 | 1170 |
1267 // Push a new stack handler and link it into stack handler chain. | 1171 // Push a new stack handler and link it into stack handler chain. |
1268 void PushStackHandler(); | 1172 void PushStackHandler(); |
1269 | 1173 |
1270 // Unlink the stack handler on top of the stack from the stack handler chain. | 1174 // Unlink the stack handler on top of the stack from the stack handler chain. |
1271 void PopStackHandler(); | 1175 void PopStackHandler(); |
1272 | 1176 |
1273 // --------------------------------------------------------------------------- | 1177 // --------------------------------------------------------------------------- |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 MutableMode mode = IMMUTABLE); | 1233 MutableMode mode = IMMUTABLE); |
1330 | 1234 |
1331 // Allocate and initialize a JSValue wrapper with the specified {constructor} | 1235 // Allocate and initialize a JSValue wrapper with the specified {constructor} |
1332 // and {value}. | 1236 // and {value}. |
1333 void AllocateJSValue(Register result, Register constructor, Register value, | 1237 void AllocateJSValue(Register result, Register constructor, Register value, |
1334 Register scratch, Label* gc_required); | 1238 Register scratch, Label* gc_required); |
1335 | 1239 |
1336 // --------------------------------------------------------------------------- | 1240 // --------------------------------------------------------------------------- |
1337 // Support functions. | 1241 // Support functions. |
1338 | 1242 |
1339 // Check if result is zero and op is negative. | |
1340 void NegativeZeroTest(Register result, Register op, Label* then_label); | |
1341 | |
1342 // Check if result is zero and op is negative in code using jump targets. | |
1343 void NegativeZeroTest(CodeGenerator* cgen, | |
1344 Register result, | |
1345 Register op, | |
1346 JumpTarget* then_target); | |
1347 | |
1348 // Check if result is zero and any of op1 and op2 are negative. | |
1349 // Register scratch is destroyed, and it must be different from op2. | |
1350 void NegativeZeroTest(Register result, Register op1, Register op2, | |
1351 Register scratch, Label* then_label); | |
1352 | |
1353 // Find the function context up the context chain. | 1243 // Find the function context up the context chain. |
1354 void LoadContext(Register dst, int context_chain_length); | 1244 void LoadContext(Register dst, int context_chain_length); |
1355 | 1245 |
1356 // Load the global object from the current context. | 1246 // Load the global object from the current context. |
1357 void LoadGlobalObject(Register dst) { | 1247 void LoadGlobalObject(Register dst) { |
1358 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); | 1248 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); |
1359 } | 1249 } |
1360 | 1250 |
1361 // Load the global proxy from the current context. | 1251 // Load the global proxy from the current context. |
1362 void LoadGlobalProxy(Register dst) { | 1252 void LoadGlobalProxy(Register dst) { |
1363 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); | 1253 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); |
1364 } | 1254 } |
1365 | 1255 |
1366 // Load the native context slot with the current index. | 1256 // Load the native context slot with the current index. |
1367 void LoadNativeContextSlot(int index, Register dst); | 1257 void LoadNativeContextSlot(int index, Register dst); |
1368 | 1258 |
1369 // Load the initial map from the global function. The registers | 1259 // Load the initial map from the global function. The registers |
1370 // function and map can be the same. | 1260 // function and map can be the same. |
1371 void LoadGlobalFunctionInitialMap(Register function, Register map); | 1261 void LoadGlobalFunctionInitialMap(Register function, Register map); |
1372 | 1262 |
1373 // --------------------------------------------------------------------------- | 1263 // --------------------------------------------------------------------------- |
1374 // Runtime calls | 1264 // Runtime calls |
1375 | 1265 |
1376 // Call a code stub. | 1266 // Call a code stub. |
1377 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1267 void CallStub(CodeStub* stub, TypeFeedbackId ast_id = TypeFeedbackId::None()); |
1378 | 1268 |
1379 // Tail call a code stub (jump). | 1269 // Tail call a code stub (jump). |
1380 void TailCallStub(CodeStub* stub); | 1270 void TailCallStub(CodeStub* stub); |
1381 | 1271 |
1382 // Return from a code stub after popping its arguments. | |
1383 void StubReturn(int argc); | |
1384 | |
1385 // Call a runtime routine. | 1272 // Call a runtime routine. |
1386 void CallRuntime(const Runtime::Function* f, | 1273 void CallRuntime(const Runtime::Function* f, |
1387 int num_arguments, | 1274 int num_arguments, |
1388 SaveFPRegsMode save_doubles = kDontSaveFPRegs); | 1275 SaveFPRegsMode save_doubles = kDontSaveFPRegs); |
1389 | 1276 |
1390 // Call a runtime function and save the value of XMM registers. | 1277 // Call a runtime function and save the value of XMM registers. |
1391 void CallRuntimeSaveDoubles(Runtime::FunctionId fid) { | 1278 void CallRuntimeSaveDoubles(Runtime::FunctionId fid) { |
1392 const Runtime::Function* function = Runtime::FunctionForId(fid); | 1279 const Runtime::Function* function = Runtime::FunctionForId(fid); |
1393 CallRuntime(function, function->nargs, kSaveFPRegs); | 1280 CallRuntime(function, function->nargs, kSaveFPRegs); |
1394 } | 1281 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 void DecrementCounter(StatsCounter* counter, int value); | 1358 void DecrementCounter(StatsCounter* counter, int value); |
1472 | 1359 |
1473 | 1360 |
1474 // --------------------------------------------------------------------------- | 1361 // --------------------------------------------------------------------------- |
1475 // Debugging | 1362 // Debugging |
1476 | 1363 |
1477 // Calls Abort(msg) if the condition cc is not satisfied. | 1364 // Calls Abort(msg) if the condition cc is not satisfied. |
1478 // Use --debug_code to enable. | 1365 // Use --debug_code to enable. |
1479 void Assert(Condition cc, BailoutReason reason); | 1366 void Assert(Condition cc, BailoutReason reason); |
1480 | 1367 |
1481 void AssertFastElements(Register elements); | |
1482 | |
1483 // Like Assert(), but always enabled. | 1368 // Like Assert(), but always enabled. |
1484 void Check(Condition cc, BailoutReason reason); | 1369 void Check(Condition cc, BailoutReason reason); |
1485 | 1370 |
1486 // Print a message to stdout and abort execution. | 1371 // Print a message to stdout and abort execution. |
1487 void Abort(BailoutReason msg); | 1372 void Abort(BailoutReason msg); |
1488 | 1373 |
1489 // Check that the stack is aligned. | 1374 // Check that the stack is aligned. |
1490 void CheckStackAlignment(); | 1375 void CheckStackAlignment(); |
1491 | 1376 |
1492 // Verify restrictions about code generated in stubs. | 1377 // Verify restrictions about code generated in stubs. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 inline Operand StackOperandForReturnAddress(int32_t disp) { | 1565 inline Operand StackOperandForReturnAddress(int32_t disp) { |
1681 return Operand(rsp, disp); | 1566 return Operand(rsp, disp); |
1682 } | 1567 } |
1683 | 1568 |
1684 #define ACCESS_MASM(masm) masm-> | 1569 #define ACCESS_MASM(masm) masm-> |
1685 | 1570 |
1686 } // namespace internal | 1571 } // namespace internal |
1687 } // namespace v8 | 1572 } // namespace v8 |
1688 | 1573 |
1689 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1574 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |