OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 } else if (v->IsInstanceOf()) { | 1091 } else if (v->IsInstanceOf()) { |
1092 HInstanceOf* instance_of = HInstanceOf::cast(v); | 1092 HInstanceOf* instance_of = HInstanceOf::cast(v); |
1093 LInstanceOfAndBranch* result = | 1093 LInstanceOfAndBranch* result = |
1094 new LInstanceOfAndBranch( | 1094 new LInstanceOfAndBranch( |
1095 UseFixed(instance_of->left(), InstanceofStub::left()), | 1095 UseFixed(instance_of->left(), InstanceofStub::left()), |
1096 UseFixed(instance_of->right(), InstanceofStub::right())); | 1096 UseFixed(instance_of->right(), InstanceofStub::right())); |
1097 return MarkAsCall(result, instr); | 1097 return MarkAsCall(result, instr); |
1098 } else if (v->IsTypeofIs()) { | 1098 } else if (v->IsTypeofIs()) { |
1099 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1099 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
1100 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); | 1100 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); |
| 1101 } else if (v->IsIsConstructCall()) { |
| 1102 return new LIsConstructCallAndBranch(TempRegister()); |
1101 } else { | 1103 } else { |
1102 if (v->IsConstant()) { | 1104 if (v->IsConstant()) { |
1103 if (HConstant::cast(v)->handle()->IsTrue()) { | 1105 if (HConstant::cast(v)->handle()->IsTrue()) { |
1104 return new LGoto(instr->FirstSuccessor()->block_id()); | 1106 return new LGoto(instr->FirstSuccessor()->block_id()); |
1105 } else if (HConstant::cast(v)->handle()->IsFalse()) { | 1107 } else if (HConstant::cast(v)->handle()->IsFalse()) { |
1106 return new LGoto(instr->SecondSuccessor()->block_id()); | 1108 return new LGoto(instr->SecondSuccessor()->block_id()); |
1107 } | 1109 } |
1108 } | 1110 } |
1109 Abort("Undefined compare before branch"); | 1111 Abort("Undefined compare before branch"); |
1110 return NULL; | 1112 return NULL; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 } | 1315 } |
1314 | 1316 |
1315 | 1317 |
1316 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1318 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
1317 if (instr->representation().IsDouble()) { | 1319 if (instr->representation().IsDouble()) { |
1318 return DoArithmeticD(Token::DIV, instr); | 1320 return DoArithmeticD(Token::DIV, instr); |
1319 } else if (instr->representation().IsInteger32()) { | 1321 } else if (instr->representation().IsInteger32()) { |
1320 // The temporary operand is necessary to ensure that right is not allocated | 1322 // The temporary operand is necessary to ensure that right is not allocated |
1321 // into edx. | 1323 // into edx. |
1322 LOperand* temp = FixedTemp(edx); | 1324 LOperand* temp = FixedTemp(edx); |
1323 LOperand* value = UseFixed(instr->left(), eax); | 1325 LOperand* dividend = UseFixed(instr->left(), eax); |
1324 LOperand* divisor = UseRegister(instr->right()); | 1326 LOperand* divisor = UseRegister(instr->right()); |
1325 LDivI* result = new LDivI(value, divisor, temp); | 1327 LDivI* result = new LDivI(dividend, divisor, temp); |
1326 return AssignEnvironment(DefineFixed(result, eax)); | 1328 return AssignEnvironment(DefineFixed(result, eax)); |
1327 } else { | 1329 } else { |
1328 ASSERT(instr->representation().IsTagged()); | 1330 ASSERT(instr->representation().IsTagged()); |
1329 return DoArithmeticT(Token::DIV, instr); | 1331 return DoArithmeticT(Token::DIV, instr); |
1330 } | 1332 } |
1331 } | 1333 } |
1332 | 1334 |
1333 | 1335 |
1334 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1336 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
1335 if (instr->representation().IsInteger32()) { | 1337 if (instr->representation().IsInteger32()) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 | 1667 |
1666 | 1668 |
1667 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1669 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
1668 return new LReturn(UseFixed(instr->value(), eax)); | 1670 return new LReturn(UseFixed(instr->value(), eax)); |
1669 } | 1671 } |
1670 | 1672 |
1671 | 1673 |
1672 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1674 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1673 Representation r = instr->representation(); | 1675 Representation r = instr->representation(); |
1674 if (r.IsInteger32()) { | 1676 if (r.IsInteger32()) { |
1675 int32_t value = instr->Integer32Value(); | 1677 return DefineAsRegister(new LConstantI); |
1676 return DefineAsRegister(new LConstantI(value)); | |
1677 } else if (r.IsDouble()) { | 1678 } else if (r.IsDouble()) { |
1678 double value = instr->DoubleValue(); | 1679 double value = instr->DoubleValue(); |
1679 return DefineAsRegister(new LConstantD(value)); | 1680 LOperand* temp = (BitCast<uint64_t, double>(value) != 0) |
| 1681 ? TempRegister() |
| 1682 : NULL; |
| 1683 return DefineAsRegister(new LConstantD(temp)); |
1680 } else if (r.IsTagged()) { | 1684 } else if (r.IsTagged()) { |
1681 return DefineAsRegister(new LConstantT(instr->handle())); | 1685 return DefineAsRegister(new LConstantT); |
1682 } else { | 1686 } else { |
1683 UNREACHABLE(); | 1687 UNREACHABLE(); |
1684 return NULL; | 1688 return NULL; |
1685 } | 1689 } |
1686 } | 1690 } |
1687 | 1691 |
1688 | 1692 |
1689 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { | 1693 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { |
1690 LLoadGlobal* result = new LLoadGlobal; | 1694 LLoadGlobal* result = new LLoadGlobal; |
1691 return instr->check_hole_value() | 1695 return instr->check_hole_value() |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 1922 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
1919 LTypeof* result = new LTypeof(UseAtStart(instr->value())); | 1923 LTypeof* result = new LTypeof(UseAtStart(instr->value())); |
1920 return MarkAsCall(DefineFixed(result, eax), instr); | 1924 return MarkAsCall(DefineFixed(result, eax), instr); |
1921 } | 1925 } |
1922 | 1926 |
1923 | 1927 |
1924 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { | 1928 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { |
1925 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); | 1929 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); |
1926 } | 1930 } |
1927 | 1931 |
| 1932 |
| 1933 LInstruction* LChunkBuilder::DoIsConstructCall(HIsConstructCall* instr) { |
| 1934 return DefineAsRegister(new LIsConstructCall); |
| 1935 } |
| 1936 |
| 1937 |
1928 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 1938 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
1929 HEnvironment* env = current_block_->last_environment(); | 1939 HEnvironment* env = current_block_->last_environment(); |
1930 ASSERT(env != NULL); | 1940 ASSERT(env != NULL); |
1931 | 1941 |
1932 env->set_ast_id(instr->ast_id()); | 1942 env->set_ast_id(instr->ast_id()); |
1933 | 1943 |
1934 env->Drop(instr->pop_count()); | 1944 env->Drop(instr->pop_count()); |
1935 for (int i = 0; i < instr->values()->length(); ++i) { | 1945 for (int i = 0; i < instr->values()->length(); ++i) { |
1936 HValue* value = instr->values()->at(i); | 1946 HValue* value = instr->values()->at(i); |
1937 if (instr->HasAssignedIndexAt(i)) { | 1947 if (instr->HasAssignedIndexAt(i)) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1989 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
1980 HEnvironment* outer = current_block_->last_environment()->outer(); | 1990 HEnvironment* outer = current_block_->last_environment()->outer(); |
1981 current_block_->UpdateEnvironment(outer); | 1991 current_block_->UpdateEnvironment(outer); |
1982 return NULL; | 1992 return NULL; |
1983 } | 1993 } |
1984 | 1994 |
1985 | 1995 |
1986 } } // namespace v8::internal | 1996 } } // namespace v8::internal |
1987 | 1997 |
1988 #endif // V8_TARGET_ARCH_IA32 | 1998 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |