Reviewers: jochen, ulan,

Description:
ARM64: Rename TryConvertDoubleToInt64 function

There are two TryConvertDoubleToInt64 functions: one rounds, the other checks if a double can be exactly represented as an int. This patch renames the second
instance to reflect its purpose more clearly.

BUG=

Please review this at https://codereview.chromium.org/258933008/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+38, -38 lines):
  M src/arm64/code-stubs-arm64.cc
  M src/arm64/lithium-codegen-arm64.cc
  M src/arm64/macro-assembler-arm64.h
  M src/arm64/macro-assembler-arm64.cc


Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index 853c2c76eaad16d943eec2953ff060dd016fd898..35c7eaa3cc5d26a638a3f270d567ce202e01cbc8 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -1196,8 +1196,8 @@ void MathPowStub::Generate(MacroAssembler* masm) {
   if (exponent_type_ != INTEGER) {
     // Detect integer exponents stored as doubles and handle those in the
     // integer fast-path.
-    __ TryConvertDoubleToInt64(exponent_integer, exponent_double,
-                               scratch0_double, &exponent_is_integer);
+    __ TryRepresentDoubleAsInt64(exponent_integer, exponent_double,
+                                 scratch0_double, &exponent_is_integer);

     if (exponent_type_ == ON_STACK) {
       FPRegister  half_double = d3;
Index: src/arm64/lithium-codegen-arm64.cc
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 0a44c7d820f8d8a6bb18f5d67242f77d4cc58b1f..78ec9f98be3b3f215a6b4ca372efa2bde1be9b3f 100644
--- a/src/arm64/lithium-codegen-arm64.cc
+++ b/src/arm64/lithium-codegen-arm64.cc
@@ -2757,7 +2757,7 @@ void LCodeGen::DoDoubleToIntOrSmi(LDoubleToIntOrSmi* instr) {
     DeoptimizeIfMinusZero(input, instr->environment());
   }

-  __ TryConvertDoubleToInt32(result, input, double_scratch());
+  __ TryRepresentDoubleAsInt32(result, input, double_scratch());
   DeoptimizeIf(ne, instr->environment());

   if (instr->tag_result()) {
@@ -5508,7 +5508,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
     // A heap number: load value and convert to int32 using non-truncating
     // function. If the result is out of range, branch to deoptimize.
     __ Ldr(dbl_scratch1, FieldMemOperand(input, HeapNumber::kValueOffset));
-    __ TryConvertDoubleToInt32(output, dbl_scratch1, dbl_scratch2);
+    __ TryRepresentDoubleAsInt32(output, dbl_scratch1, dbl_scratch2);
     DeoptimizeIf(ne, instr->environment());

     if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
Index: src/arm64/macro-assembler-arm64.cc
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc index b731a97301296141a8d606154a60fc3b4d1899e0..3803ab6afffcf7c64de46aa55668b5514a8d108e 100644
--- a/src/arm64/macro-assembler-arm64.cc
+++ b/src/arm64/macro-assembler-arm64.cc
@@ -2284,11 +2284,11 @@ void MacroAssembler::LookupNumberStringCache(Register object,
 }


-void MacroAssembler::TryConvertDoubleToInt(Register as_int,
-                                           FPRegister value,
-                                           FPRegister scratch_d,
-                                           Label* on_successful_conversion,
-                                           Label* on_failed_conversion) {
+void MacroAssembler::TryRepresentDoubleAsInt(Register as_int,
+                                             FPRegister value,
+                                             FPRegister scratch_d,
+ Label* on_successful_conversion,
+                                             Label* on_failed_conversion) {
// Convert to an int and back again, then compare with the original value.
   Fcvtzs(as_int, value);
   Scvtf(scratch_d, as_int);
Index: src/arm64/macro-assembler-arm64.h
diff --git a/src/arm64/macro-assembler-arm64.h b/src/arm64/macro-assembler-arm64.h index aaf8d57970f450a1c13e8c0007869d223ac2b2fc..412eb0fd00a2e19bbc75dcef949d2ae0bcb811e9 100644
--- a/src/arm64/macro-assembler-arm64.h
+++ b/src/arm64/macro-assembler-arm64.h
@@ -945,34 +945,34 @@ class MacroAssembler : public Assembler {
                           DoubleRegister input,
                           DoubleRegister dbl_scratch);

-  // Try to convert a double to a signed 32-bit int.
+  // Try to represent a double as a signed 32-bit int.
// This succeeds if the result compares equal to the input, so inputs of -0.0
-  // are converted to 0 and handled as a success.
-  //
-  // On output the Z flag is set if the conversion was successful.
-  void TryConvertDoubleToInt32(Register as_int,
-                               FPRegister value,
-                               FPRegister scratch_d,
-                               Label* on_successful_conversion = NULL,
-                               Label* on_failed_conversion = NULL) {
+  // are represented as 0 and handled as a success.
+  //
+  // On output the Z flag is set if the operation was successful.
+  void TryRepresentDoubleAsInt32(Register as_int,
+                                 FPRegister value,
+                                 FPRegister scratch_d,
+                                 Label* on_successful_conversion = NULL,
+                                 Label* on_failed_conversion = NULL) {
     ASSERT(as_int.Is32Bits());
- TryConvertDoubleToInt(as_int, value, scratch_d, on_successful_conversion,
-                          on_failed_conversion);
+ TryRepresentDoubleAsInt(as_int, value, scratch_d, on_successful_conversion,
+                            on_failed_conversion);
   }

-  // Try to convert a double to a signed 64-bit int.
+  // Try to represent a double as a signed 64-bit int.
// This succeeds if the result compares equal to the input, so inputs of -0.0
-  // are converted to 0 and handled as a success.
-  //
-  // On output the Z flag is set if the conversion was successful.
-  void TryConvertDoubleToInt64(Register as_int,
-                               FPRegister value,
-                               FPRegister scratch_d,
-                               Label* on_successful_conversion = NULL,
-                               Label* on_failed_conversion = NULL) {
+  // are represented as 0 and handled as a success.
+  //
+  // On output the Z flag is set if the operation was successful.
+  void TryRepresentDoubleAsInt64(Register as_int,
+                                 FPRegister value,
+                                 FPRegister scratch_d,
+                                 Label* on_successful_conversion = NULL,
+                                 Label* on_failed_conversion = NULL) {
     ASSERT(as_int.Is64Bits());
- TryConvertDoubleToInt(as_int, value, scratch_d, on_successful_conversion,
-                          on_failed_conversion);
+ TryRepresentDoubleAsInt(as_int, value, scratch_d, on_successful_conversion,
+                            on_failed_conversion);
   }

   // ---- Object Utilities ----
@@ -2073,7 +2073,7 @@ class MacroAssembler : public Assembler {
                   Condition cond,  // eq for new space, ne otherwise.
                   Label* branch);

-  // Try to convert a double to an int so that integer fast-paths may be
+  // Try to represent a double as an int so that integer fast-paths may be
   // used. Not every valid integer value is guaranteed to be caught.
   // It supports both 32-bit and 64-bit integers depending whether 'as_int'
   // is a W or X register.
@@ -2081,12 +2081,12 @@ class MacroAssembler : public Assembler {
   // This does not distinguish between +0 and -0, so if this distinction is
   // important it must be checked separately.
   //
-  // On output the Z flag is set if the conversion was successful.
-  void TryConvertDoubleToInt(Register as_int,
-                             FPRegister value,
-                             FPRegister scratch_d,
-                             Label* on_successful_conversion = NULL,
-                             Label* on_failed_conversion = NULL);
+  // On output the Z flag is set if the operation was successful.
+  void TryRepresentDoubleAsInt(Register as_int,
+                               FPRegister value,
+                               FPRegister scratch_d,
+                               Label* on_successful_conversion = NULL,
+                               Label* on_failed_conversion = NULL);

   bool generating_stub_;
 #if DEBUG


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to