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

Side by Side Diff: src/x87/lithium-x87.cc

Issue 293743005: Introduce x87 port (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 7 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
OLDNEW
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
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
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
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
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 ASSERT(fixed == 0 || used_at_start == 0); 908 ASSERT(fixed == 0 || used_at_start == 0);
923 } 909 }
924 #endif 910 #endif
925 911
926 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 912 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
927 instr = AssignPointerMap(instr); 913 instr = AssignPointerMap(instr);
928 } 914 }
929 if (FLAG_stress_environments && !instr->HasEnvironment()) { 915 if (FLAG_stress_environments && !instr->HasEnvironment()) {
930 instr = AssignEnvironment(instr); 916 instr = AssignEnvironment(instr);
931 } 917 }
918 if (instr->IsGoto() && LGoto::cast(instr)->jumps_to_join()) {
919 // TODO(olivf) Since phis of spilled values are joined as registers
920 // (not in the stack slot), we need to allow the goto gaps to keep one
921 // x87 register alive. To ensure all other values are still spilled, we
922 // insert a fpu register barrier right before.
923 LClobberDoubles* clobber = new(zone()) LClobberDoubles(isolate());
924 clobber->set_hydrogen_value(current);
925 chunk_->AddInstruction(clobber, current_block_);
926 }
932 chunk_->AddInstruction(instr, current_block_); 927 chunk_->AddInstruction(instr, current_block_);
933 928
934 if (instr->IsCall()) { 929 if (instr->IsCall()) {
935 HValue* hydrogen_value_for_lazy_bailout = current; 930 HValue* hydrogen_value_for_lazy_bailout = current;
936 LInstruction* instruction_needing_environment = NULL; 931 LInstruction* instruction_needing_environment = NULL;
937 if (current->HasObservableSideEffects()) { 932 if (current->HasObservableSideEffects()) {
938 HSimulate* sim = HSimulate::cast(current->next()); 933 HSimulate* sim = HSimulate::cast(current->next());
939 instruction_needing_environment = instr; 934 instruction_needing_environment = instr;
940 sim->ReplayEnvironment(current_block_->last_environment()); 935 sim->ReplayEnvironment(current_block_->last_environment());
941 hydrogen_value_for_lazy_bailout = sim; 936 hydrogen_value_for_lazy_bailout = sim;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1150
1156 1151
1157 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) { 1152 LInstruction* LChunkBuilder::DoMathFloor(HUnaryMathOperation* instr) {
1158 LOperand* input = UseRegisterAtStart(instr->value()); 1153 LOperand* input = UseRegisterAtStart(instr->value());
1159 LMathFloor* result = new(zone()) LMathFloor(input); 1154 LMathFloor* result = new(zone()) LMathFloor(input);
1160 return AssignEnvironment(DefineAsRegister(result)); 1155 return AssignEnvironment(DefineAsRegister(result));
1161 } 1156 }
1162 1157
1163 1158
1164 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { 1159 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1165 LOperand* input = UseRegister(instr->value()); 1160 // Crankshaft is turned off for nosse2.
1166 LOperand* temp = FixedTemp(xmm4); 1161 UNREACHABLE();
1167 LMathRound* result = new(zone()) LMathRound(input, temp); 1162 return NULL;
1168 return AssignEnvironment(DefineAsRegister(result));
1169 } 1163 }
1170 1164
1171 1165
1172 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { 1166 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1173 LOperand* context = UseAny(instr->context()); // Deferred use. 1167 LOperand* context = UseAny(instr->context()); // Deferred use.
1174 LOperand* input = UseRegisterAtStart(instr->value()); 1168 LOperand* input = UseRegisterAtStart(instr->value());
1175 LInstruction* result = 1169 LInstruction* result =
1176 DefineSameAsFirst(new(zone()) LMathAbs(context, input)); 1170 DefineSameAsFirst(new(zone()) LMathAbs(context, input));
1177 Representation r = instr->value()->representation(); 1171 Representation r = instr->value()->representation();
1178 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result); 1172 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 ASSERT(instr->right()->representation().IsDouble()); 1593 ASSERT(instr->right()->representation().IsDouble());
1600 left = UseRegisterAtStart(instr->left()); 1594 left = UseRegisterAtStart(instr->left());
1601 right = UseRegisterAtStart(instr->right()); 1595 right = UseRegisterAtStart(instr->right());
1602 } 1596 }
1603 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); 1597 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right);
1604 return DefineSameAsFirst(minmax); 1598 return DefineSameAsFirst(minmax);
1605 } 1599 }
1606 1600
1607 1601
1608 LInstruction* LChunkBuilder::DoPower(HPower* instr) { 1602 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1609 ASSERT(instr->representation().IsDouble()); 1603 // Crankshaft is turned off for nosse2.
1610 // We call a C function for double power. It can't trigger a GC. 1604 UNREACHABLE();
1611 // We need to use fixed result register for the call. 1605 return NULL;
1612 Representation exponent_type = instr->right()->representation();
1613 ASSERT(instr->left()->representation().IsDouble());
1614 LOperand* left = UseFixedDouble(instr->left(), xmm2);
1615 LOperand* right = exponent_type.IsDouble() ?
1616 UseFixedDouble(instr->right(), xmm1) :
1617 UseFixed(instr->right(), eax);
1618 LPower* result = new(zone()) LPower(left, right);
1619 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1620 CAN_DEOPTIMIZE_EAGERLY);
1621 } 1606 }
1622 1607
1623 1608
1624 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1609 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1625 ASSERT(instr->left()->representation().IsSmiOrTagged()); 1610 ASSERT(instr->left()->representation().IsSmiOrTagged());
1626 ASSERT(instr->right()->representation().IsSmiOrTagged()); 1611 ASSERT(instr->right()->representation().IsSmiOrTagged());
1627 LOperand* context = UseFixed(instr->context(), esi); 1612 LOperand* context = UseFixed(instr->context(), esi);
1628 LOperand* left = UseFixed(instr->left(), edx); 1613 LOperand* left = UseFixed(instr->left(), edx);
1629 LOperand* right = UseFixed(instr->right(), eax); 1614 LOperand* right = UseFixed(instr->right(), eax);
1630 LCmpT* result = new(zone()) LCmpT(context, left, right); 1615 LCmpT* result = new(zone()) LCmpT(context, left, right);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 return DefineSameAsFirst(new(zone()) LDummyUse(value)); 1874 return DefineSameAsFirst(new(zone()) LDummyUse(value));
1890 } 1875 }
1891 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); 1876 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value)));
1892 } else { 1877 } else {
1893 ASSERT(to.IsInteger32()); 1878 ASSERT(to.IsInteger32());
1894 if (val->type().IsSmi() || val->representation().IsSmi()) { 1879 if (val->type().IsSmi() || val->representation().IsSmi()) {
1895 LOperand* value = UseRegister(val); 1880 LOperand* value = UseRegister(val);
1896 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); 1881 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false));
1897 } else { 1882 } else {
1898 LOperand* value = UseRegister(val); 1883 LOperand* value = UseRegister(val);
1899 bool truncating = instr->CanTruncateToInt32(); 1884 LInstruction* result = DefineSameAsFirst(new(zone()) LTaggedToI(value));
1900 LOperand* xmm_temp = !truncating ? FixedTemp(xmm1) : NULL;
1901 LInstruction* result =
1902 DefineSameAsFirst(new(zone()) LTaggedToI(value, xmm_temp));
1903 if (!val->representation().IsSmi()) result = AssignEnvironment(result); 1885 if (!val->representation().IsSmi()) result = AssignEnvironment(result);
1904 return result; 1886 return result;
1905 } 1887 }
1906 } 1888 }
1907 } else if (from.IsDouble()) { 1889 } else if (from.IsDouble()) {
1908 if (to.IsTagged()) { 1890 if (to.IsTagged()) {
1909 info()->MarkAsDeferredCalling(); 1891 info()->MarkAsDeferredCalling();
1910 LOperand* value = UseRegisterAtStart(val); 1892 LOperand* value = UseRegisterAtStart(val);
1911 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; 1893 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL;
1912 LUnallocated* result_temp = TempRegister(); 1894 LUnallocated* result_temp = TempRegister();
1913 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); 1895 LNumberTagD* result = new(zone()) LNumberTagD(value, temp);
1914 return AssignPointerMap(Define(result, result_temp)); 1896 return AssignPointerMap(Define(result, result_temp));
1915 } else if (to.IsSmi()) { 1897 } else if (to.IsSmi()) {
1916 LOperand* value = UseRegister(val); 1898 LOperand* value = UseRegister(val);
1917 return AssignEnvironment( 1899 return AssignEnvironment(
1918 DefineAsRegister(new(zone()) LDoubleToSmi(value))); 1900 DefineAsRegister(new(zone()) LDoubleToSmi(value)));
1919 } else { 1901 } else {
1920 ASSERT(to.IsInteger32()); 1902 ASSERT(to.IsInteger32());
1921 bool truncating = instr->CanTruncateToInt32(); 1903 bool truncating = instr->CanTruncateToInt32();
1922 bool needs_temp = !truncating; 1904 LOperand* value = UseRegister(val);
1923 LOperand* value = needs_temp ? UseTempRegister(val) : UseRegister(val); 1905 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value));
1924 LOperand* temp = needs_temp ? TempRegister() : NULL;
1925 LInstruction* result =
1926 DefineAsRegister(new(zone()) LDoubleToI(value, temp));
1927 if (!truncating) result = AssignEnvironment(result); 1906 if (!truncating) result = AssignEnvironment(result);
1928 return result; 1907 return result;
1929 } 1908 }
1930 } else if (from.IsInteger32()) { 1909 } else if (from.IsInteger32()) {
1931 info()->MarkAsDeferredCalling(); 1910 info()->MarkAsDeferredCalling();
1932 if (to.IsTagged()) { 1911 if (to.IsTagged()) {
1933 if (!instr->CheckFlag(HValue::kCanOverflow)) { 1912 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1934 LOperand* value = UseRegister(val); 1913 LOperand* value = UseRegister(val);
1935 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1914 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1936 } else if (val->CheckFlag(HInstruction::kUint32)) { 1915 } else if (val->CheckFlag(HInstruction::kUint32)) {
1937 LOperand* value = UseRegister(val); 1916 LOperand* value = UseRegister(val);
1938 LOperand* temp1 = TempRegister(); 1917 LOperand* temp = TempRegister();
1939 LOperand* temp2 = FixedTemp(xmm1); 1918 LNumberTagU* result = new(zone()) LNumberTagU(value, temp);
1940 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1941 return AssignPointerMap(DefineSameAsFirst(result)); 1919 return AssignPointerMap(DefineSameAsFirst(result));
1942 } else { 1920 } else {
1943 LOperand* value = UseRegister(val); 1921 LOperand* value = UseRegister(val);
1944 LOperand* temp = TempRegister(); 1922 LOperand* temp = TempRegister();
1945 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); 1923 LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
1946 return AssignPointerMap(DefineSameAsFirst(result)); 1924 return AssignPointerMap(DefineSameAsFirst(result));
1947 } 1925 }
1948 } else if (to.IsSmi()) { 1926 } else if (to.IsSmi()) {
1949 LOperand* value = UseRegister(val); 1927 LOperand* value = UseRegister(val);
1950 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); 1928 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value));
1951 if (instr->CheckFlag(HValue::kCanOverflow)) { 1929 if (instr->CheckFlag(HValue::kCanOverflow)) {
1952 result = AssignEnvironment(result); 1930 result = AssignEnvironment(result);
1953 } 1931 }
1954 return result; 1932 return result;
1955 } else { 1933 } else {
1956 ASSERT(to.IsDouble()); 1934 ASSERT(to.IsDouble());
1957 if (val->CheckFlag(HInstruction::kUint32)) { 1935 if (val->CheckFlag(HInstruction::kUint32)) {
1958 LOperand* temp = FixedTemp(xmm1); 1936 return DefineAsRegister(new(zone()) LUint32ToDouble(UseRegister(val)));
1959 return DefineAsRegister(
1960 new(zone()) LUint32ToDouble(UseRegister(val), temp));
1961 } else { 1937 } else {
1962 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val))); 1938 return DefineAsRegister(new(zone()) LInteger32ToDouble(Use(val)));
1963 } 1939 }
1964 } 1940 }
1965 } 1941 }
1966 UNREACHABLE(); 1942 UNREACHABLE();
1967 return NULL; 1943 return NULL;
1968 } 1944 }
1969 1945
1970 1946
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 result = AssignPointerMap(result); 1986 result = AssignPointerMap(result);
2011 } 1987 }
2012 return result; 1988 return result;
2013 } 1989 }
2014 1990
2015 1991
2016 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { 1992 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2017 HValue* value = instr->value(); 1993 HValue* value = instr->value();
2018 Representation input_rep = value->representation(); 1994 Representation input_rep = value->representation();
2019 if (input_rep.IsDouble()) { 1995 if (input_rep.IsDouble()) {
2020 LOperand* reg = UseRegister(value); 1996 UNREACHABLE();
2021 return DefineFixed(new(zone()) LClampDToUint8(reg), eax); 1997 return NULL;
2022 } else if (input_rep.IsInteger32()) { 1998 } else if (input_rep.IsInteger32()) {
2023 LOperand* reg = UseFixed(value, eax); 1999 LOperand* reg = UseFixed(value, eax);
2024 return DefineFixed(new(zone()) LClampIToUint8(reg), eax); 2000 return DefineFixed(new(zone()) LClampIToUint8(reg), eax);
2025 } else { 2001 } else {
2026 ASSERT(input_rep.IsSmiOrTagged()); 2002 ASSERT(input_rep.IsSmiOrTagged());
2027 LOperand* reg = UseFixed(value, eax); 2003 LOperand* value = UseRegister(instr->value());
2028 // Register allocator doesn't (yet) support allocation of double 2004 LClampTToUint8NoSSE2* res =
2029 // temps. Reserve xmm1 explicitly. 2005 new(zone()) LClampTToUint8NoSSE2(value, TempRegister(),
2030 LOperand* temp = FixedTemp(xmm1); 2006 TempRegister(), TempRegister());
2031 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, temp); 2007 return AssignEnvironment(DefineFixed(res, ecx));
2032 return AssignEnvironment(DefineFixed(result, eax));
2033 } 2008 }
2034 } 2009 }
2035 2010
2036 2011
2037 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) { 2012 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
2038 HValue* value = instr->value(); 2013 HValue* value = instr->value();
2039 ASSERT(value->representation().IsDouble()); 2014 ASSERT(value->representation().IsDouble());
2040 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value))); 2015 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value)));
2041 } 2016 }
2042 2017
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 elements_kind == EXTERNAL_INT8_ELEMENTS || 2193 elements_kind == EXTERNAL_INT8_ELEMENTS ||
2219 elements_kind == EXTERNAL_UINT8_ELEMENTS || 2194 elements_kind == EXTERNAL_UINT8_ELEMENTS ||
2220 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || 2195 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
2221 elements_kind == UINT8_ELEMENTS || 2196 elements_kind == UINT8_ELEMENTS ||
2222 elements_kind == INT8_ELEMENTS || 2197 elements_kind == INT8_ELEMENTS ||
2223 elements_kind == UINT8_CLAMPED_ELEMENTS; 2198 elements_kind == UINT8_CLAMPED_ELEMENTS;
2224 if (val_is_fixed_register) { 2199 if (val_is_fixed_register) {
2225 return UseFixed(instr->value(), eax); 2200 return UseFixed(instr->value(), eax);
2226 } 2201 }
2227 2202
2203 if (IsDoubleOrFloatElementsKind(elements_kind)) {
2204 return UseRegisterAtStart(instr->value());
2205 }
2206
2228 return UseRegister(instr->value()); 2207 return UseRegister(instr->value());
2229 } 2208 }
2230 2209
2231 2210
2232 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 2211 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2233 if (!instr->is_typed_elements()) { 2212 if (!instr->is_typed_elements()) {
2234 ASSERT(instr->elements()->representation().IsTagged()); 2213 ASSERT(instr->elements()->representation().IsTagged());
2235 ASSERT(instr->key()->representation().IsInteger32() || 2214 ASSERT(instr->key()->representation().IsInteger32() ||
2236 instr->key()->representation().IsSmi()); 2215 instr->key()->representation().IsSmi());
2237 2216
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2666 LOperand* object = UseRegister(instr->object()); 2645 LOperand* object = UseRegister(instr->object());
2667 LOperand* index = UseTempRegister(instr->index()); 2646 LOperand* index = UseTempRegister(instr->index());
2668 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2647 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2669 LInstruction* result = DefineSameAsFirst(load); 2648 LInstruction* result = DefineSameAsFirst(load);
2670 return AssignPointerMap(result); 2649 return AssignPointerMap(result);
2671 } 2650 }
2672 2651
2673 2652
2674 } } // namespace v8::internal 2653 } } // namespace v8::internal
2675 2654
2676 #endif // V8_TARGET_ARCH_IA32 2655 #endif // V8_TARGET_ARCH_X87
OLDNEW
« src/x87/OWNERS ('K') | « src/x87/lithium-x87.h ('k') | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698