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

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

Issue 12567004: ARM: Optimsisation of ECMA ToInt32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 ObjectToDoubleFlags flags = NO_OBJECT_TO_DOUBLE_FLAGS); 926 ObjectToDoubleFlags flags = NO_OBJECT_TO_DOUBLE_FLAGS);
927 927
928 // Load the value of a smi object into a VFP double register. The register 928 // Load the value of a smi object into a VFP double register. The register
929 // scratch1 can be the same register as smi in which case smi will hold the 929 // scratch1 can be the same register as smi in which case smi will hold the
930 // untagged value afterwards. 930 // untagged value afterwards.
931 void SmiToDoubleVFPRegister(Register smi, 931 void SmiToDoubleVFPRegister(Register smi,
932 DwVfpRegister value, 932 DwVfpRegister value,
933 Register scratch1, 933 Register scratch1,
934 SwVfpRegister scratch2); 934 SwVfpRegister scratch2);
935 935
936 // Convert the HeapNumber pointed to by source to a 32bits signed integer
937 // dest. If the HeapNumber does not fit into a 32bits signed integer branch
938 // to not_int32 label. If VFP3 is available double_scratch is used but not
939 // scratch2.
940 void ConvertToInt32(Register source,
941 Register dest,
942 Register scratch,
943 Register scratch2,
944 DwVfpRegister double_scratch,
945 Label *not_int32);
946
947 // Check if a double can be exactly represented as a signed 32-bit integer. 936 // Check if a double can be exactly represented as a signed 32-bit integer.
948 // Z flag set to one if true. 937 // Z flag set to one if true.
949 void TestDoubleIsInt32(DwVfpRegister double_input, 938 void TestDoubleIsInt32(DwVfpRegister double_input,
950 DwVfpRegister double_scratch); 939 DwVfpRegister double_scratch);
951 940
952 // Try to convert a double to a signed 32-bit integer. 941 // Try to convert a double to a signed 32-bit integer.
953 // Z flag set to one and result assigned if the conversion is exact. 942 // Z flag set to one and result assigned if the conversion is exact.
954 void TryDoubleToInt32Exact(Register result, 943 void TryDoubleToInt32Exact(Register result,
955 DwVfpRegister double_input, 944 DwVfpRegister double_input,
956 DwVfpRegister double_scratch); 945 DwVfpRegister double_scratch);
957 946
958 // Floor a double and writes the value to the result register. 947 // Floor a double and writes the value to the result register.
959 // Go to exact if the conversion is exact (to be able to test -0), 948 // Go to exact if the conversion is exact (to be able to test -0),
960 // fall through calling code if an overflow occurred, else go to done. 949 // fall through calling code if an overflow occurred, else go to done.
961 void TryInt32Floor(Register result, 950 void TryInt32Floor(Register result,
962 DwVfpRegister double_input, 951 DwVfpRegister double_input,
963 Register input_high, 952 Register input_high,
964 DwVfpRegister double_scratch, 953 DwVfpRegister double_scratch,
965 Label* done, 954 Label* done,
966 Label* exact); 955 Label* exact);
967 956
968 // Helper for EmitECMATruncate. 957 // Performs a truncating conversion of a heap floating point number as used by
969 // This will truncate a floating-point value outside of the signed 32bit 958 // the JS bitwise operations. See ECMA-262 9.5: ToInt32.
970 // integer range to a 32bit signed integer. 959 // Exits with 'result' holding the answer.
971 // Expects the double value loaded in input_high and input_low. 960 void ECMAConvertNumberToInt32(Register source,
972 // Exits with the answer in 'result'. 961 Register result,
973 // Note that this code does not work for values in the 32bit range! 962 Register scratch,
974 void EmitOutOfInt32RangeTruncate(Register result, 963 Register input_high,
975 Register input_high, 964 Register input_low,
976 Register input_low, 965 DwVfpRegister double_scratch1,
977 Register scratch); 966 DwVfpRegister double_scratch2);
978 967
979 // Performs a truncating conversion of a floating point number as used by 968 // Performs a truncating conversion of a floating point number as used by
980 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. 969 // the JS bitwise operations. See ECMA-262 9.5: ToInt32.
981 // Exits with 'result' holding the answer and all other registers clobbered. 970 // Exits with 'result' holding the answer and all other registers clobbered.
982 void EmitECMATruncate(Register result, 971 void ECMAToInt32VFP(Register result,
983 DwVfpRegister double_input, 972 DwVfpRegister double_input,
984 DwVfpRegister double_scratch, 973 DwVfpRegister double_scratch,
974 Register scratch,
975 Register input_high,
976 Register input_low);
977
978 // Performs a truncating conversion of a floating point number as used by
979 // the JS bitwise operations. See ECMA-262 9.5: ToInt32.
980 // Exits with 'result' holding the answer.
981 void ECMAToInt32NoVFP(Register result,
985 Register scratch, 982 Register scratch,
986 Register scratch2, 983 Register input_high,
987 Register scratch3); 984 Register input_low);
988 985
989 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz 986 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz
990 // instruction. On pre-ARM5 hardware this routine gives the wrong answer 987 // instruction. On pre-ARM5 hardware this routine gives the wrong answer
991 // for 0 (31 instead of 32). Source and scratch can be the same in which case 988 // for 0 (31 instead of 32). Source and scratch can be the same in which case
992 // the source is clobbered. Source and zeros can also be the same in which 989 // the source is clobbered. Source and zeros can also be the same in which
993 // case scratch should be a different register. 990 // case scratch should be a different register.
994 void CountLeadingZeros(Register zeros, 991 void CountLeadingZeros(Register zeros,
995 Register source, 992 Register source,
996 Register scratch); 993 Register scratch);
997 994
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 // bitmap register points at the word with the mark bits and the mask 1355 // bitmap register points at the word with the mark bits and the mask
1359 // the position of the first bit. Leaves addr_reg unchanged. 1356 // the position of the first bit. Leaves addr_reg unchanged.
1360 inline void GetMarkBits(Register addr_reg, 1357 inline void GetMarkBits(Register addr_reg,
1361 Register bitmap_reg, 1358 Register bitmap_reg,
1362 Register mask_reg); 1359 Register mask_reg);
1363 1360
1364 // Helper for throwing exceptions. Compute a handler address and jump to 1361 // Helper for throwing exceptions. Compute a handler address and jump to
1365 // it. See the implementation for register usage. 1362 // it. See the implementation for register usage.
1366 void JumpToHandlerEntry(); 1363 void JumpToHandlerEntry();
1367 1364
1365 // Helper for ECMAToInt32VFP and ECMAToInt32NoVFP.
ulan 2013/03/11 15:11:03 Description of preconditions for inputs would be h
Rodolph Perfetta 2013/03/12 11:24:45 Done.
1366 void ECMAToInt32Tail(Register result,
1367 Register scratch,
1368 Register input_high,
1369 Register input_low,
1370 Label* out_of_range,
1371 Label* negate,
1372 Label* done);
1373
1368 // Compute memory operands for safepoint stack slots. 1374 // Compute memory operands for safepoint stack slots.
1369 static int SafepointRegisterStackIndex(int reg_code); 1375 static int SafepointRegisterStackIndex(int reg_code);
1370 MemOperand SafepointRegisterSlot(Register reg); 1376 MemOperand SafepointRegisterSlot(Register reg);
1371 MemOperand SafepointRegistersAndDoublesSlot(Register reg); 1377 MemOperand SafepointRegistersAndDoublesSlot(Register reg);
1372 1378
1373 bool generating_stub_; 1379 bool generating_stub_;
1374 bool allow_stub_calls_; 1380 bool allow_stub_calls_;
1375 bool has_frame_; 1381 bool has_frame_;
1376 // This handle will be patched with the code object on installation. 1382 // This handle will be patched with the code object on installation.
1377 Handle<Object> code_object_; 1383 Handle<Object> code_object_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1437 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1432 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 1438 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1433 #else 1439 #else
1434 #define ACCESS_MASM(masm) masm-> 1440 #define ACCESS_MASM(masm) masm->
1435 #endif 1441 #endif
1436 1442
1437 1443
1438 } } // namespace v8::internal 1444 } } // namespace v8::internal
1439 1445
1440 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ 1446 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698