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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "lithium-allocator-inl.h" | 9 #include "lithium-allocator-inl.h" |
10 #include "ia32/lithium-ia32.h" | 10 #include "x87/lithium-x87.h" |
11 #include "ia32/lithium-codegen-ia32.h" | 11 #include "x87/lithium-codegen-x87.h" |
12 #include "hydrogen-osr.h" | 12 #include "hydrogen-osr.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 #define DEFINE_COMPILE(type) \ | 17 #define DEFINE_COMPILE(type) \ |
18 void L##type::CompileToNative(LCodeGen* generator) { \ | 18 void L##type::CompileToNative(LCodeGen* generator) { \ |
19 generator->Do##type(this); \ | 19 generator->Do##type(this); \ |
20 } | 20 } |
21 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 21 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 for (int i = 0; i < InputCount(); i++) { | 53 for (int i = 0; i < InputCount(); i++) { |
54 LOperand* op = InputAt(i); | 54 LOperand* op = InputAt(i); |
55 if (op != NULL && op->IsDoubleRegister()) { | 55 if (op != NULL && op->IsDoubleRegister()) { |
56 return true; | 56 return true; |
57 } | 57 } |
58 } | 58 } |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 | 62 |
| 63 bool LInstruction::IsDoubleInput(X87Register reg, LCodeGen* cgen) { |
| 64 for (int i = 0; i < InputCount(); i++) { |
| 65 LOperand* op = InputAt(i); |
| 66 if (op != NULL && op->IsDoubleRegister()) { |
| 67 if (cgen->ToX87Register(op).is(reg)) return true; |
| 68 } |
| 69 } |
| 70 return false; |
| 71 } |
| 72 |
| 73 |
63 void LInstruction::PrintTo(StringStream* stream) { | 74 void LInstruction::PrintTo(StringStream* stream) { |
64 stream->Add("%s ", this->Mnemonic()); | 75 stream->Add("%s ", this->Mnemonic()); |
65 | 76 |
66 PrintOutputOperandTo(stream); | 77 PrintOutputOperandTo(stream); |
67 | 78 |
68 PrintDataTo(stream); | 79 PrintDataTo(stream); |
69 | 80 |
70 if (HasEnvironment()) { | 81 if (HasEnvironment()) { |
71 stream->Add(" "); | 82 stream->Add(" "); |
72 environment()->PrintTo(stream); | 83 environment()->PrintTo(stream); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 status_ = ABORTED; | 477 status_ = ABORTED; |
467 } | 478 } |
468 | 479 |
469 | 480 |
470 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { | 481 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { |
471 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, | 482 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, |
472 Register::ToAllocationIndex(reg)); | 483 Register::ToAllocationIndex(reg)); |
473 } | 484 } |
474 | 485 |
475 | 486 |
476 LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) { | |
477 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, | |
478 XMMRegister::ToAllocationIndex(reg)); | |
479 } | |
480 | |
481 | |
482 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { | 487 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { |
483 return Use(value, ToUnallocated(fixed_register)); | 488 return Use(value, ToUnallocated(fixed_register)); |
484 } | 489 } |
485 | 490 |
486 | 491 |
487 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) { | |
488 return Use(value, ToUnallocated(reg)); | |
489 } | |
490 | |
491 | |
492 LOperand* LChunkBuilder::UseRegister(HValue* value) { | 492 LOperand* LChunkBuilder::UseRegister(HValue* value) { |
493 return Use(value, new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 493 return Use(value, new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
494 } | 494 } |
495 | 495 |
496 | 496 |
497 LOperand* LChunkBuilder::UseRegisterAtStart(HValue* value) { | 497 LOperand* LChunkBuilder::UseRegisterAtStart(HValue* value) { |
498 return Use(value, | 498 return Use(value, |
499 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, | 499 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER, |
500 LUnallocated::USED_AT_START)); | 500 LUnallocated::USED_AT_START)); |
501 } | 501 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); | 609 new(zone()) LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT)); |
610 } | 610 } |
611 | 611 |
612 | 612 |
613 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr, | 613 LInstruction* LChunkBuilder::DefineFixed(LTemplateResultInstruction<1>* instr, |
614 Register reg) { | 614 Register reg) { |
615 return Define(instr, ToUnallocated(reg)); | 615 return Define(instr, ToUnallocated(reg)); |
616 } | 616 } |
617 | 617 |
618 | 618 |
619 LInstruction* LChunkBuilder::DefineFixedDouble( | |
620 LTemplateResultInstruction<1>* instr, | |
621 XMMRegister reg) { | |
622 return Define(instr, ToUnallocated(reg)); | |
623 } | |
624 | |
625 | |
626 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 619 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
627 HEnvironment* hydrogen_env = current_block_->last_environment(); | 620 HEnvironment* hydrogen_env = current_block_->last_environment(); |
628 int argument_index_accumulator = 0; | 621 int argument_index_accumulator = 0; |
629 ZoneList<HValue*> objects_to_materialize(0, zone()); | 622 ZoneList<HValue*> objects_to_materialize(0, zone()); |
630 instr->set_environment(CreateEnvironment(hydrogen_env, | 623 instr->set_environment(CreateEnvironment(hydrogen_env, |
631 &argument_index_accumulator, | 624 &argument_index_accumulator, |
632 &objects_to_materialize)); | 625 &objects_to_materialize)); |
633 return instr; | 626 return instr; |
634 } | 627 } |
635 | 628 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 } | 675 } |
683 | 676 |
684 | 677 |
685 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 678 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
686 LUnallocated* operand = ToUnallocated(reg); | 679 LUnallocated* operand = ToUnallocated(reg); |
687 ASSERT(operand->HasFixedPolicy()); | 680 ASSERT(operand->HasFixedPolicy()); |
688 return operand; | 681 return operand; |
689 } | 682 } |
690 | 683 |
691 | 684 |
692 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { | |
693 LUnallocated* operand = ToUnallocated(reg); | |
694 ASSERT(operand->HasFixedPolicy()); | |
695 return operand; | |
696 } | |
697 | |
698 | |
699 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 685 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
700 return new(zone()) LLabel(instr->block()); | 686 return new(zone()) LLabel(instr->block()); |
701 } | 687 } |
702 | 688 |
703 | 689 |
704 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { | 690 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { |
705 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); | 691 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); |
706 } | 692 } |
707 | 693 |
708 | 694 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 ASSERT(fixed == 0 || used_at_start == 0); | 917 ASSERT(fixed == 0 || used_at_start == 0); |
932 } | 918 } |
933 #endif | 919 #endif |
934 | 920 |
935 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 921 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
936 instr = AssignPointerMap(instr); | 922 instr = AssignPointerMap(instr); |
937 } | 923 } |
938 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 924 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
939 instr = AssignEnvironment(instr); | 925 instr = AssignEnvironment(instr); |
940 } | 926 } |
| 927 if (instr->IsGoto() && LGoto::cast(instr)->jumps_to_join()) { |
| 928 // TODO(olivf) Since phis of spilled values are joined as registers |
| 929 // (not in the stack slot), we need to allow the goto gaps to keep one |
| 930 // x87 register alive. To ensure all other values are still spilled, we |
| 931 // insert a fpu register barrier right before. |
| 932 LClobberDoubles* clobber = new(zone()) LClobberDoubles(isolate()); |
| 933 clobber->set_hydrogen_value(hydrogen_val); |
| 934 chunk_->AddInstruction(clobber, current_block_); |
| 935 } |
941 chunk_->AddInstruction(instr, current_block_); | 936 chunk_->AddInstruction(instr, current_block_); |
942 | 937 |
943 if (instr->IsCall()) { | 938 if (instr->IsCall()) { |
944 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; | 939 HValue* hydrogen_value_for_lazy_bailout = hydrogen_val; |
945 LInstruction* instruction_needing_environment = NULL; | 940 LInstruction* instruction_needing_environment = NULL; |
946 if (hydrogen_val->HasObservableSideEffects()) { | 941 if (hydrogen_val->HasObservableSideEffects()) { |
947 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); | 942 HSimulate* sim = HSimulate::cast(hydrogen_val->next()); |
948 instruction_needing_environment = instr; | 943 instruction_needing_environment = instr; |
949 sim->ReplayEnvironment(current_block_->last_environment()); | 944 sim->ReplayEnvironment(current_block_->last_environment()); |
950 hydrogen_value_for_lazy_bailout = sim; | 945 hydrogen_value_for_lazy_bailout = sim; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 | 1161 |
1167 | 1162 |
1168 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { | 1163 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { |
1169 LOperand* input = UseRegisterAtStart(instr->value()); | 1164 LOperand* input = UseRegisterAtStart(instr->value()); |
1170 LMathFloor* result = new(zone()) LMathFloor(input); | 1165 LMathFloor* result = new(zone()) LMathFloor(input); |
1171 return AssignEnvironment(DefineAsRegister(result)); | 1166 return AssignEnvironment(DefineAsRegister(result)); |
1172 } | 1167 } |
1173 | 1168 |
1174 | 1169 |
1175 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 1170 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
1176 LOperand* input = UseRegister(instr->value()); | 1171 // Crankshaft is turned off for nosse2. |
1177 LOperand* temp = FixedTemp(xmm4); | 1172 UNREACHABLE(); |
1178 LMathRound* result = new(zone()) LMathRound(input, temp); | 1173 return NULL; |
1179 return AssignEnvironment(DefineAsRegister(result)); | |
1180 } | 1174 } |
1181 | 1175 |
1182 | 1176 |
1183 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1177 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
1184 LOperand* context = UseAny(instr->context()); // Deferred use. | 1178 LOperand* context = UseAny(instr->context()); // Deferred use. |
1185 LOperand* input = UseRegisterAtStart(instr->value()); | 1179 LOperand* input = UseRegisterAtStart(instr->value()); |
1186 LInstruction* result = | 1180 LInstruction* result = |
1187 DefineSameAsFirst(new(zone()) LMathAbs(context, input)); | 1181 DefineSameAsFirst(new(zone()) LMathAbs(context, input)); |
1188 Representation r = instr->value()->representation(); | 1182 Representation r = instr->value()->representation(); |
1189 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result); | 1183 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result); |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 ASSERT(instr->right()->representation().IsDouble()); | 1604 ASSERT(instr->right()->representation().IsDouble()); |
1611 left = UseRegisterAtStart(instr->left()); | 1605 left = UseRegisterAtStart(instr->left()); |
1612 right = UseRegisterAtStart(instr->right()); | 1606 right = UseRegisterAtStart(instr->right()); |
1613 } | 1607 } |
1614 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); | 1608 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); |
1615 return DefineSameAsFirst(minmax); | 1609 return DefineSameAsFirst(minmax); |
1616 } | 1610 } |
1617 | 1611 |
1618 | 1612 |
1619 LInstruction* LChunkBuilder::DoPower(HPower* instr) { | 1613 LInstruction* LChunkBuilder::DoPower(HPower* instr) { |
1620 ASSERT(instr->representation().IsDouble()); | 1614 // Crankshaft is turned off for nosse2. |
1621 // We call a C function for double power. It can't trigger a GC. | 1615 UNREACHABLE(); |
1622 // We need to use fixed result register for the call. | 1616 return NULL; |
1623 Representation exponent_type = instr->right()->representation(); | |
1624 ASSERT(instr->left()->representation().IsDouble()); | |
1625 LOperand* left = UseFixedDouble(instr->left(), xmm2); | |
1626 LOperand* right = exponent_type.IsDouble() ? | |
1627 UseFixedDouble(instr->right(), xmm1) : | |
1628 UseFixed(instr->right(), eax); | |
1629 LPower* result = new(zone()) LPower(left, right); | |
1630 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | |
1631 CAN_DEOPTIMIZE_EAGERLY); | |
1632 } | 1617 } |
1633 | 1618 |
1634 | 1619 |
1635 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1620 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1636 ASSERT(instr->left()->representation().IsSmiOrTagged()); | 1621 ASSERT(instr->left()->representation().IsSmiOrTagged()); |
1637 ASSERT(instr->right()->representation().IsSmiOrTagged()); | 1622 ASSERT(instr->right()->representation().IsSmiOrTagged()); |
1638 LOperand* context = UseFixed(instr->context(), esi); | 1623 LOperand* context = UseFixed(instr->context(), esi); |
1639 LOperand* left = UseFixed(instr->left(), edx); | 1624 LOperand* left = UseFixed(instr->left(), edx); |
1640 LOperand* right = UseFixed(instr->right(), eax); | 1625 LOperand* right = UseFixed(instr->right(), eax); |
1641 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1626 LCmpT* result = new(zone()) LCmpT(context, left, right); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1885 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
1901 } | 1886 } |
1902 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1887 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
1903 } else { | 1888 } else { |
1904 ASSERT(to.IsInteger32()); | 1889 ASSERT(to.IsInteger32()); |
1905 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1890 if (val->type().IsSmi() || val->representation().IsSmi()) { |
1906 LOperand* value = UseRegister(val); | 1891 LOperand* value = UseRegister(val); |
1907 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1892 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
1908 } else { | 1893 } else { |
1909 LOperand* value = UseRegister(val); | 1894 LOperand* value = UseRegister(val); |
1910 bool truncating = instr->CanTruncateToInt32(); | 1895 LInstruction* result = DefineSameAsFirst(new(zone()) LTaggedToI(value)); |
1911 LOperand* xmm_temp = !truncating ? FixedTemp(xmm1) : NULL; | |
1912 LInstruction* result = | |
1913 DefineSameAsFirst(new(zone()) LTaggedToI(value, xmm_temp)); | |
1914 if (!val->representation().IsSmi()) result = AssignEnvironment(result); | 1896 if (!val->representation().IsSmi()) result = AssignEnvironment(result); |
1915 return result; | 1897 return result; |
1916 } | 1898 } |
1917 } | 1899 } |
1918 } else if (from.IsDouble()) { | 1900 } else if (from.IsDouble()) { |
1919 if (to.IsTagged()) { | 1901 if (to.IsTagged()) { |
1920 info()->MarkAsDeferredCalling(); | 1902 info()->MarkAsDeferredCalling(); |
1921 LOperand* value = UseRegisterAtStart(val); | 1903 LOperand* value = UseRegisterAtStart(val); |
1922 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; | 1904 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; |
1923 LUnallocated* result_temp = TempRegister(); | 1905 LUnallocated* result_temp = TempRegister(); |
1924 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); | 1906 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |
1925 return AssignPointerMap(Define(result, result_temp)); | 1907 return AssignPointerMap(Define(result, result_temp)); |
1926 } else if (to.IsSmi()) { | 1908 } else if (to.IsSmi()) { |
1927 LOperand* value = UseRegister(val); | 1909 LOperand* value = UseRegister(val); |
1928 return AssignEnvironment( | 1910 return AssignEnvironment( |
1929 DefineAsRegister(new(zone()) LDoubleToSmi(value))); | 1911 DefineAsRegister(new(zone()) LDoubleToSmi(value))); |
1930 } else { | 1912 } else { |
1931 ASSERT(to.IsInteger32()); | 1913 ASSERT(to.IsInteger32()); |
1932 bool truncating = instr->CanTruncateToInt32(); | 1914 bool truncating = instr->CanTruncateToInt32(); |
1933 bool needs_temp = !truncating; | 1915 LOperand* value = UseRegister(val); |
1934 LOperand* value = needs_temp ? UseTempRegister(val) : UseRegister(val); | 1916 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value)); |
1935 LOperand* temp = needs_temp ? TempRegister() : NULL; | |
1936 LInstruction* result = | |
1937 DefineAsRegister(new(zone()) LDoubleToI(value, temp)); | |
1938 if (!truncating) result = AssignEnvironment(result); | 1917 if (!truncating) result = AssignEnvironment(result); |
1939 return result; | 1918 return result; |
1940 } | 1919 } |
1941 } else if (from.IsInteger32()) { | 1920 } else if (from.IsInteger32()) { |
1942 info()->MarkAsDeferredCalling(); | 1921 info()->MarkAsDeferredCalling(); |
1943 if (to.IsTagged()) { | 1922 if (to.IsTagged()) { |
1944 if (!instr->CheckFlag(HValue::kCanOverflow)) { | 1923 if (!instr->CheckFlag(HValue::kCanOverflow)) { |
1945 LOperand* value = UseRegister(val); | 1924 LOperand* value = UseRegister(val); |
1946 return DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1925 return DefineSameAsFirst(new(zone()) LSmiTag(value)); |
1947 } else if (val->CheckFlag(HInstruction::kUint32)) { | 1926 } else if (val->CheckFlag(HInstruction::kUint32)) { |
1948 LOperand* value = UseRegister(val); | 1927 LOperand* value = UseRegister(val); |
1949 LOperand* temp1 = TempRegister(); | 1928 LOperand* temp = TempRegister(); |
1950 LOperand* temp2 = FixedTemp(xmm1); | 1929 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); |
1951 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); | |
1952 return AssignPointerMap(DefineSameAsFirst(result)); | 1930 return AssignPointerMap(DefineSameAsFirst(result)); |
1953 } else { | 1931 } else { |
1954 LOperand* value = UseRegister(val); | 1932 LOperand* value = UseRegister(val); |
1955 LOperand* temp = TempRegister(); | 1933 LOperand* temp = TempRegister(); |
1956 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); | 1934 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); |
1957 return AssignPointerMap(DefineSameAsFirst(result)); | 1935 return AssignPointerMap(DefineSameAsFirst(result)); |
1958 } | 1936 } |
1959 } else if (to.IsSmi()) { | 1937 } else if (to.IsSmi()) { |
1960 LOperand* value = UseRegister(val); | 1938 LOperand* value = UseRegister(val); |
1961 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1939 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); |
1962 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1940 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1963 result = AssignEnvironment(result); | 1941 result = AssignEnvironment(result); |
1964 } | 1942 } |
1965 return result; | 1943 return result; |
1966 } else { | 1944 } else { |
1967 ASSERT(to.IsDouble()); | 1945 ASSERT(to.IsDouble()); |
1968 if (val->CheckFlag(HInstruction::kUint32)) { | 1946 if (val->CheckFlag(HInstruction::kUint32)) { |
1969 LOperand* temp = FixedTemp(xmm1); | 1947 return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val))); |
1970 return DefineAsRegister( | |
1971 new(zone()) LUint32ToDouble(UseRegister(val), temp)); | |
1972 } else { | 1948 } else { |
1973 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); | 1949 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); |
1974 } | 1950 } |
1975 } | 1951 } |
1976 } | 1952 } |
1977 UNREACHABLE(); | 1953 UNREACHABLE(); |
1978 return NULL; | 1954 return NULL; |
1979 } | 1955 } |
1980 | 1956 |
1981 | 1957 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 result = AssignPointerMap(result); | 1997 result = AssignPointerMap(result); |
2022 } | 1998 } |
2023 return result; | 1999 return result; |
2024 } | 2000 } |
2025 | 2001 |
2026 | 2002 |
2027 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 2003 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
2028 HValue* value = instr->value(); | 2004 HValue* value = instr->value(); |
2029 Representation input_rep = value->representation(); | 2005 Representation input_rep = value->representation(); |
2030 if (input_rep.IsDouble()) { | 2006 if (input_rep.IsDouble()) { |
2031 LOperand* reg = UseRegister(value); | 2007 UNREACHABLE(); |
2032 return DefineFixed(new(zone()) LClampDToUint8(reg), eax); | 2008 return NULL; |
2033 } else if (input_rep.IsInteger32()) { | 2009 } else if (input_rep.IsInteger32()) { |
2034 LOperand* reg = UseFixed(value, eax); | 2010 LOperand* reg = UseFixed(value, eax); |
2035 return DefineFixed(new(zone()) LClampIToUint8(reg), eax); | 2011 return DefineFixed(new(zone()) LClampIToUint8(reg), eax); |
2036 } else { | 2012 } else { |
2037 ASSERT(input_rep.IsSmiOrTagged()); | 2013 ASSERT(input_rep.IsSmiOrTagged()); |
2038 LOperand* reg = UseFixed(value, eax); | 2014 LOperand* value = UseRegister(instr->value()); |
2039 // Register allocator doesn't (yet) support allocation of double | 2015 LClampTToUint8NoSSE2* res = |
2040 // temps. Reserve xmm1 explicitly. | 2016 new(zone()) LClampTToUint8NoSSE2(value, TempRegister(), |
2041 LOperand* temp = FixedTemp(xmm1); | 2017 TempRegister(), TempRegister()); |
2042 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, temp); | 2018 return AssignEnvironment(DefineFixed(res, ecx)); |
2043 return AssignEnvironment(DefineFixed(result, eax)); | |
2044 } | 2019 } |
2045 } | 2020 } |
2046 | 2021 |
2047 | 2022 |
2048 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { | 2023 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { |
2049 HValue* value = instr->value(); | 2024 HValue* value = instr->value(); |
2050 ASSERT(value->representation().IsDouble()); | 2025 ASSERT(value->representation().IsDouble()); |
2051 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); | 2026 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); |
2052 } | 2027 } |
2053 | 2028 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 elements_kind == EXTERNAL_INT8_ELEMENTS || | 2204 elements_kind == EXTERNAL_INT8_ELEMENTS || |
2230 elements_kind == EXTERNAL_UINT8_ELEMENTS || | 2205 elements_kind == EXTERNAL_UINT8_ELEMENTS || |
2231 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2206 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
2232 elements_kind == UINT8_ELEMENTS || | 2207 elements_kind == UINT8_ELEMENTS || |
2233 elements_kind == INT8_ELEMENTS || | 2208 elements_kind == INT8_ELEMENTS || |
2234 elements_kind == UINT8_CLAMPED_ELEMENTS; | 2209 elements_kind == UINT8_CLAMPED_ELEMENTS; |
2235 if (val_is_fixed_register) { | 2210 if (val_is_fixed_register) { |
2236 return UseFixed(instr->value(), eax); | 2211 return UseFixed(instr->value(), eax); |
2237 } | 2212 } |
2238 | 2213 |
| 2214 if (IsDoubleOrFloatElementsKind(elements_kind)) { |
| 2215 return UseRegisterAtStart(instr->value()); |
| 2216 } |
| 2217 |
2239 return UseRegister(instr->value()); | 2218 return UseRegister(instr->value()); |
2240 } | 2219 } |
2241 | 2220 |
2242 | 2221 |
2243 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2222 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2244 if (!instr->is_typed_elements()) { | 2223 if (!instr->is_typed_elements()) { |
2245 ASSERT(instr->elements()->representation().IsTagged()); | 2224 ASSERT(instr->elements()->representation().IsTagged()); |
2246 ASSERT(instr->key()->representation().IsInteger32() || | 2225 ASSERT(instr->key()->representation().IsInteger32() || |
2247 instr->key()->representation().IsSmi()); | 2226 instr->key()->representation().IsSmi()); |
2248 | 2227 |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 LOperand* object = UseRegister(instr->object()); | 2656 LOperand* object = UseRegister(instr->object()); |
2678 LOperand* index = UseTempRegister(instr->index()); | 2657 LOperand* index = UseTempRegister(instr->index()); |
2679 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2658 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2680 LInstruction* result = DefineSameAsFirst(load); | 2659 LInstruction* result = DefineSameAsFirst(load); |
2681 return AssignPointerMap(result); | 2660 return AssignPointerMap(result); |
2682 } | 2661 } |
2683 | 2662 |
2684 | 2663 |
2685 } } // namespace v8::internal | 2664 } } // namespace v8::internal |
2686 | 2665 |
2687 #endif // V8_TARGET_ARCH_IA32 | 2666 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |