OLD | NEW |
---|---|
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 const Condition cond = al); | 488 const Condition cond = al); |
489 void VFPCompareAndLoadFlags(const DwVfpRegister src1, | 489 void VFPCompareAndLoadFlags(const DwVfpRegister src1, |
490 const double src2, | 490 const double src2, |
491 const Register fpscr_flags, | 491 const Register fpscr_flags, |
492 const Condition cond = al); | 492 const Condition cond = al); |
493 | 493 |
494 void Vmov(const DwVfpRegister dst, | 494 void Vmov(const DwVfpRegister dst, |
495 const double imm, | 495 const double imm, |
496 const Register scratch = no_reg); | 496 const Register scratch = no_reg); |
497 | 497 |
498 // Convert the smi or heap number in object to an int32 using the rules | |
ulan
2013/04/22 11:24:49
"Converts"
Rodolph Perfetta
2013/04/22 21:30:33
Done.
| |
499 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated | |
500 // and brought into the range -2^31 .. +2^31 - 1. | |
501 void ConvertNumberToInt32(Register object, | |
502 Register dst, | |
503 Register heap_number_map, | |
504 Register scratch1, | |
505 Register scratch2, | |
506 Register scratch3, | |
507 DwVfpRegister double_scratch1, | |
508 DwVfpRegister double_scratch2, | |
509 Label* not_int32); | |
510 | |
511 // Loads the objects from |object| into floating point registers. | |
512 // The value ends up either in |dst|. | |
ulan
2013/04/22 11:24:49
"Loads the number from object into dst register."
Rodolph Perfetta
2013/04/22 21:30:33
Done.
| |
513 // If |object| is neither smi nor heap number, |not_number| is jumped to | |
514 // with |object| still intact. | |
515 void LoadNumber(Register object, | |
516 DwVfpRegister dst, | |
517 Register heap_number_map, | |
518 Register scratch, | |
519 Label* not_number); | |
520 | |
521 // Load the number from object into double_dst in the double format. | |
ulan
2013/04/22 11:24:49
"Loads"
Rodolph Perfetta
2013/04/22 21:30:33
Done.
| |
522 // Control will jump to not_int32 if the value cannot be exactly represented | |
523 // by a 32-bit integer. | |
524 // Floating point value in the 32-bit integer range that are not exact integer | |
525 // won't be loaded. | |
526 void LoadNumberAsInt32Double(Register object, | |
527 DwVfpRegister double_dst, | |
528 Register heap_number_map, | |
529 Register scratch, | |
530 DwVfpRegister double_scratch, | |
531 Label* not_int32); | |
532 | |
533 // Loads the number from object into dst as a 32-bit integer. | |
534 // Control will jump to not_int32 if the object cannot be exactly represented | |
535 // by a 32-bit integer. | |
536 // Floating point value in the 32-bit integer range that are not exact integer | |
537 // won't be converted. | |
538 void LoadNumberAsInt32(Register object, | |
539 Register dst, | |
540 Register heap_number_map, | |
541 Register scratch, | |
542 DwVfpRegister double_scratch0, | |
543 DwVfpRegister double_scratch1, | |
544 Label* not_int32); | |
545 | |
546 | |
498 // Enter exit frame. | 547 // Enter exit frame. |
499 // stack_space - extra stack space, used for alignment before call to C. | 548 // stack_space - extra stack space, used for alignment before call to C. |
500 void EnterExitFrame(bool save_doubles, int stack_space = 0); | 549 void EnterExitFrame(bool save_doubles, int stack_space = 0); |
501 | 550 |
502 // Leave the current exit frame. Expects the return value in r0. | 551 // Leave the current exit frame. Expects the return value in r0. |
503 // Expect the number of values, pushed prior to the exit frame, to | 552 // Expect the number of values, pushed prior to the exit frame, to |
504 // remove in a register (or no_reg, if there is nothing to remove). | 553 // remove in a register (or no_reg, if there is nothing to remove). |
505 void LeaveExitFrame(bool save_doubles, Register argument_count); | 554 void LeaveExitFrame(bool save_doubles, Register argument_count); |
506 | 555 |
507 // Get the actual activation frame alignment for target environment. | 556 // Get the actual activation frame alignment for target environment. |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 Label* fail); | 873 Label* fail); |
825 | 874 |
826 // Check if a map for a JSObject indicates that the object has fast smi only | 875 // Check if a map for a JSObject indicates that the object has fast smi only |
827 // elements. Jump to the specified label if it does not. | 876 // elements. Jump to the specified label if it does not. |
828 void CheckFastSmiElements(Register map, | 877 void CheckFastSmiElements(Register map, |
829 Register scratch, | 878 Register scratch, |
830 Label* fail); | 879 Label* fail); |
831 | 880 |
832 // Check to see if maybe_number can be stored as a double in | 881 // Check to see if maybe_number can be stored as a double in |
833 // FastDoubleElements. If it can, store it at the index specified by key in | 882 // FastDoubleElements. If it can, store it at the index specified by key in |
834 // the FastDoubleElements array elements. Otherwise jump to fail, in which | 883 // the FastDoubleElements array elements. Otherwise jump to fail. |
835 // case scratch2, scratch3 and scratch4 are unmodified. | |
836 void StoreNumberToDoubleElements(Register value_reg, | 884 void StoreNumberToDoubleElements(Register value_reg, |
837 Register key_reg, | 885 Register key_reg, |
838 // All regs below here overwritten. | |
839 Register elements_reg, | 886 Register elements_reg, |
840 Register scratch1, | 887 Register scratch1, |
841 Register scratch2, | |
842 Register scratch3, | |
843 Register scratch4, | |
844 Label* fail, | 888 Label* fail, |
845 int elements_offset = 0); | 889 int elements_offset = 0); |
846 | 890 |
847 // Compare an object's map with the specified map and its transitioned | 891 // Compare an object's map with the specified map and its transitioned |
848 // elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Condition flags are | 892 // elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Condition flags are |
849 // set with result of map compare. If multiple map compares are required, the | 893 // set with result of map compare. If multiple map compares are required, the |
850 // compare sequences branches to early_success. | 894 // compare sequences branches to early_success. |
851 void CompareMap(Register obj, | 895 void CompareMap(Register obj, |
852 Register scratch, | 896 Register scratch, |
853 Handle<Map> map, | 897 Handle<Map> map, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
965 // Floor a double and writes the value to the result register. | 1009 // Floor a double and writes the value to the result register. |
966 // Go to exact if the conversion is exact (to be able to test -0), | 1010 // Go to exact if the conversion is exact (to be able to test -0), |
967 // fall through calling code if an overflow occurred, else go to done. | 1011 // fall through calling code if an overflow occurred, else go to done. |
968 void TryInt32Floor(Register result, | 1012 void TryInt32Floor(Register result, |
969 DwVfpRegister double_input, | 1013 DwVfpRegister double_input, |
970 Register input_high, | 1014 Register input_high, |
971 DwVfpRegister double_scratch, | 1015 DwVfpRegister double_scratch, |
972 Label* done, | 1016 Label* done, |
973 Label* exact); | 1017 Label* exact); |
974 | 1018 |
975 // Performs a truncating conversion of a heap floating point number as used by | |
976 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. | |
977 // Exits with 'result' holding the answer. | |
978 void ECMAConvertNumberToInt32(Register source, | |
979 Register result, | |
980 Register input_low, | |
981 Register input_high, | |
982 Register scratch, | |
983 DwVfpRegister double_scratch1, | |
984 DwVfpRegister double_scratch2); | |
985 | |
986 // Performs a truncating conversion of a floating point number as used by | 1019 // Performs a truncating conversion of a floating point number as used by |
987 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. | 1020 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. |
1021 // Double_scratch must be between d0 and d15. | |
988 // Exits with 'result' holding the answer and all other registers clobbered. | 1022 // Exits with 'result' holding the answer and all other registers clobbered. |
989 void ECMAToInt32(Register result, | 1023 void ECMAToInt32(Register result, |
990 DwVfpRegister double_input, | 1024 DwVfpRegister double_input, |
991 DwVfpRegister double_scratch, | |
992 Register scratch, | 1025 Register scratch, |
993 Register input_high, | 1026 Register scratch_high, |
994 Register input_low); | 1027 Register scratch_low, |
1028 DwVfpRegister double_scratch); | |
995 | 1029 |
996 // Check whether d16-d31 are available on the CPU. The result is given by the | 1030 // Check whether d16-d31 are available on the CPU. The result is given by the |
997 // Z condition flag: Z==0 if d16-d31 available, Z==1 otherwise. | 1031 // Z condition flag: Z==0 if d16-d31 available, Z==1 otherwise. |
998 void CheckFor32DRegs(Register scratch); | 1032 void CheckFor32DRegs(Register scratch); |
999 | 1033 |
1000 | 1034 |
1001 // --------------------------------------------------------------------------- | 1035 // --------------------------------------------------------------------------- |
1002 // Runtime calls | 1036 // Runtime calls |
1003 | 1037 |
1004 // Call a code stub. | 1038 // Call a code stub. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1113 void DecrementCounter(StatsCounter* counter, int value, | 1147 void DecrementCounter(StatsCounter* counter, int value, |
1114 Register scratch1, Register scratch2); | 1148 Register scratch1, Register scratch2); |
1115 | 1149 |
1116 | 1150 |
1117 // --------------------------------------------------------------------------- | 1151 // --------------------------------------------------------------------------- |
1118 // Debugging | 1152 // Debugging |
1119 | 1153 |
1120 // Calls Abort(msg) if the condition cond is not satisfied. | 1154 // Calls Abort(msg) if the condition cond is not satisfied. |
1121 // Use --debug_code to enable. | 1155 // Use --debug_code to enable. |
1122 void Assert(Condition cond, const char* msg); | 1156 void Assert(Condition cond, const char* msg); |
1123 void AssertRegisterIsRoot(Register reg, Heap::RootListIndex index); | |
1124 void AssertFastElements(Register elements); | 1157 void AssertFastElements(Register elements); |
1125 | 1158 |
1126 // Like Assert(), but always enabled. | 1159 // Like Assert(), but always enabled. |
1127 void Check(Condition cond, const char* msg); | 1160 void Check(Condition cond, const char* msg); |
1128 | 1161 |
1129 // Print a message to stdout and abort execution. | 1162 // Print a message to stdout and abort execution. |
1130 void Abort(const char* msg); | 1163 void Abort(const char* msg); |
1131 | 1164 |
1132 // Verify restrictions about code generated in stubs. | 1165 // Verify restrictions about code generated in stubs. |
1133 void set_generating_stub(bool value) { generating_stub_ = value; } | 1166 void set_generating_stub(bool value) { generating_stub_ = value; } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1223 // Abort execution if argument is a smi, enabled via --debug-code. | 1256 // Abort execution if argument is a smi, enabled via --debug-code. |
1224 void AssertNotSmi(Register object); | 1257 void AssertNotSmi(Register object); |
1225 void AssertSmi(Register object); | 1258 void AssertSmi(Register object); |
1226 | 1259 |
1227 // Abort execution if argument is not a string, enabled via --debug-code. | 1260 // Abort execution if argument is not a string, enabled via --debug-code. |
1228 void AssertString(Register object); | 1261 void AssertString(Register object); |
1229 | 1262 |
1230 // Abort execution if argument is not a name, enabled via --debug-code. | 1263 // Abort execution if argument is not a name, enabled via --debug-code. |
1231 void AssertName(Register object); | 1264 void AssertName(Register object); |
1232 | 1265 |
1233 // Abort execution if argument is not the root value with the given index, | 1266 // Abort execution if reg is not the root value with the given index, |
1234 // enabled via --debug-code. | 1267 // enabled via --debug-code. |
1235 void AssertRootValue(Register src, | 1268 void AssertIsRoot(Register reg, Heap::RootListIndex index); |
1236 Heap::RootListIndex root_value_index, | |
1237 const char* message); | |
1238 | 1269 |
1239 // --------------------------------------------------------------------------- | 1270 // --------------------------------------------------------------------------- |
1240 // HeapNumber utilities | 1271 // HeapNumber utilities |
1241 | 1272 |
1242 void JumpIfNotHeapNumber(Register object, | 1273 void JumpIfNotHeapNumber(Register object, |
1243 Register heap_number_map, | 1274 Register heap_number_map, |
1244 Register scratch, | 1275 Register scratch, |
1245 Label* on_not_heap_number); | 1276 Label* on_not_heap_number); |
1246 | 1277 |
1247 // --------------------------------------------------------------------------- | 1278 // --------------------------------------------------------------------------- |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1358 // bitmap register points at the word with the mark bits and the mask | 1389 // bitmap register points at the word with the mark bits and the mask |
1359 // the position of the first bit. Leaves addr_reg unchanged. | 1390 // the position of the first bit. Leaves addr_reg unchanged. |
1360 inline void GetMarkBits(Register addr_reg, | 1391 inline void GetMarkBits(Register addr_reg, |
1361 Register bitmap_reg, | 1392 Register bitmap_reg, |
1362 Register mask_reg); | 1393 Register mask_reg); |
1363 | 1394 |
1364 // Helper for throwing exceptions. Compute a handler address and jump to | 1395 // Helper for throwing exceptions. Compute a handler address and jump to |
1365 // it. See the implementation for register usage. | 1396 // it. See the implementation for register usage. |
1366 void JumpToHandlerEntry(); | 1397 void JumpToHandlerEntry(); |
1367 | 1398 |
1368 // Helper for ECMAToInt32VFP and ECMAToInt32NoVFP. | |
1369 // It is expected that 31 <= exponent <= 83, and scratch is exponent - 1. | |
1370 void ECMAToInt32Tail(Register result, | |
1371 Register scratch, | |
1372 Register input_high, | |
1373 Register input_low, | |
1374 Label* out_of_range, | |
1375 Label* negate, | |
1376 Label* done); | |
1377 | |
1378 // Compute memory operands for safepoint stack slots. | 1399 // Compute memory operands for safepoint stack slots. |
1379 static int SafepointRegisterStackIndex(int reg_code); | 1400 static int SafepointRegisterStackIndex(int reg_code); |
1380 MemOperand SafepointRegisterSlot(Register reg); | 1401 MemOperand SafepointRegisterSlot(Register reg); |
1381 MemOperand SafepointRegistersAndDoublesSlot(Register reg); | 1402 MemOperand SafepointRegistersAndDoublesSlot(Register reg); |
1382 | 1403 |
1383 bool generating_stub_; | 1404 bool generating_stub_; |
1384 bool allow_stub_calls_; | 1405 bool allow_stub_calls_; |
1385 bool has_frame_; | 1406 bool has_frame_; |
1386 // This handle will be patched with the code object on installation. | 1407 // This handle will be patched with the code object on installation. |
1387 Handle<Object> code_object_; | 1408 Handle<Object> code_object_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1441 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1462 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1442 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1463 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1443 #else | 1464 #else |
1444 #define ACCESS_MASM(masm) masm-> | 1465 #define ACCESS_MASM(masm) masm-> |
1445 #endif | 1466 #endif |
1446 | 1467 |
1447 | 1468 |
1448 } } // namespace v8::internal | 1469 } } // namespace v8::internal |
1449 | 1470 |
1450 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1471 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |