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

Unified Diff: src/a64/lithium-codegen-a64.cc

Issue 148263012: A64: Rejig truncating and non double to i/smi (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index e4a74bac3b10a4359540bc76685bbfe0b1a3bb5e..ad02f5debe7627e3bef36be3516323796a329de4 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -2437,61 +2437,23 @@ void LCodeGen::DoDivI(LDivI* instr) {
}
-void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
+void LCodeGen::DoDoubleToIntOrSmi(LDoubleToIntOrSmi* instr) {
DoubleRegister input = ToDoubleRegister(instr->value());
+ Register result = ToRegister32(instr->result());
+ Label done, deopt;
- if (instr->truncating()) {
- Register result = ToRegister(instr->result());
- Register scratch1 = ToRegister(instr->temp1());
- Register scratch2 = ToRegister(instr->temp2());
- __ ECMA262ToInt32(result, input, scratch1, scratch2);
- } else {
- Register result = ToRegister32(instr->result());
- ASSERT((instr->temp1() == NULL) && (instr->temp2() == NULL));
- Label done, deopt;
-
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
- // Check for an input of -0.0, using the result register as a scratch.
- __ Fmov(result, input);
- __ Cmp(result, 1);
- __ B(&deopt, vs);
- }
-
- __ TryConvertDoubleToInt32(result, input, double_scratch(), &done);
- __ Bind(&deopt);
- Deoptimize(instr->environment());
- __ Bind(&done);
+ if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
+ __ JumpIfMinusZero(input, &deopt);
}
-}
-
-
-// TODO(jbramley): This is almost the same as DoDoubleToI. Can we merge them?
-void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
- DoubleRegister input = ToDoubleRegister(instr->value());
-
- if (instr->truncating()) {
- Register result = ToRegister(instr->result());
- Register scratch1 = ToRegister(instr->temp1());
- Register scratch2 = ToRegister(instr->temp2());
- __ ECMA262ToInt32(result, input, scratch1, scratch2);
- } else {
- Register result = ToRegister32(instr->result());
- ASSERT((instr->temp1() == NULL) && (instr->temp2() == NULL));
- Label done, deopt;
- if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
- // Check for an input of -0.0, using the result register as a scratch.
- __ Fmov(result, input);
- __ Cmp(result, 1);
- __ B(&deopt, vs);
- }
+ __ TryConvertDoubleToInt32(result, input, double_scratch(), &done);
+ __ Bind(&deopt);
+ Deoptimize(instr->environment());
+ __ Bind(&done);
- __ TryConvertDoubleToInt32(result, input, double_scratch(), &done);
- __ Bind(&deopt);
- Deoptimize(instr->environment());
- __ Bind(&done);
+ if (instr->tag_result()) {
+ __ SmiTag(result.X());
}
- __ SmiTag(ToRegister(instr->result()));
}
@@ -3699,10 +3661,7 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) {
Label done;
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
- // Check for an input of -0.0, using the result register as a scratch.
- __ Fmov(result, input);
- __ Cmp(result, 1);
- __ B(&deopt, vs);
+ __ JumpIfMinusZero(input, &deopt);
}
__ Fcvtms(result, input);
@@ -4313,7 +4272,7 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
// Load heap number.
__ Ldr(result, FieldMemOperand(input, HeapNumber::kValueOffset));
if (instr->hydrogen()->deoptimize_on_minus_zero()) {
- ASM_UNIMPLEMENTED_BREAK("NumberUntagD - deopt on minus zero");
+ __ JumpIfMinusZero(result, &deopt);
}
__ B(&done);
@@ -5285,6 +5244,18 @@ void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) {
}
+void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) {
+ DoubleRegister input = ToDoubleRegister(instr->value());
+ Register result = ToRegister(instr->result());
+ __ ECMA262ToInt32(result, input,
+ ToRegister(instr->temp1()),
+ ToRegister(instr->temp2()),
+ instr->tag_result()
+ ? MacroAssembler::SMI
+ : MacroAssembler::INT32_IN_W);
+}
+
+
void LCodeGen::DoTypeof(LTypeof* instr) {
Register input = ToRegister(instr->value());
__ Push(input);
« no previous file with comments | « src/a64/lithium-a64.cc ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698