| 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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 UseRegisterAtStart(compare->right())); | 1070 UseRegisterAtStart(compare->right())); |
| 1071 } else if (v->IsInstanceOf()) { | 1071 } else if (v->IsInstanceOf()) { |
| 1072 HInstanceOf* instance_of = HInstanceOf::cast(v); | 1072 HInstanceOf* instance_of = HInstanceOf::cast(v); |
| 1073 LInstruction* result = | 1073 LInstruction* result = |
| 1074 new LInstanceOfAndBranch(UseFixed(instance_of->left(), r0), | 1074 new LInstanceOfAndBranch(UseFixed(instance_of->left(), r0), |
| 1075 UseFixed(instance_of->right(), r1)); | 1075 UseFixed(instance_of->right(), r1)); |
| 1076 return MarkAsCall(result, instr); | 1076 return MarkAsCall(result, instr); |
| 1077 } else if (v->IsTypeofIs()) { | 1077 } else if (v->IsTypeofIs()) { |
| 1078 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1078 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
| 1079 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); | 1079 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); |
| 1080 } else if (v->IsIsConstructCall()) { |
| 1081 return new LIsConstructCallAndBranch(TempRegister()); |
| 1080 } else { | 1082 } else { |
| 1081 if (v->IsConstant()) { | 1083 if (v->IsConstant()) { |
| 1082 if (HConstant::cast(v)->handle()->IsTrue()) { | 1084 if (HConstant::cast(v)->handle()->IsTrue()) { |
| 1083 return new LGoto(instr->FirstSuccessor()->block_id()); | 1085 return new LGoto(instr->FirstSuccessor()->block_id()); |
| 1084 } else if (HConstant::cast(v)->handle()->IsFalse()) { | 1086 } else if (HConstant::cast(v)->handle()->IsFalse()) { |
| 1085 return new LGoto(instr->SecondSuccessor()->block_id()); | 1087 return new LGoto(instr->SecondSuccessor()->block_id()); |
| 1086 } | 1088 } |
| 1087 } | 1089 } |
| 1088 Abort("Undefined compare before branch"); | 1090 Abort("Undefined compare before branch"); |
| 1089 return NULL; | 1091 return NULL; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 | 1299 |
| 1298 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1300 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1299 if (instr->representation().IsDouble()) { | 1301 if (instr->representation().IsDouble()) { |
| 1300 return DoArithmeticD(Token::DIV, instr); | 1302 return DoArithmeticD(Token::DIV, instr); |
| 1301 } else if (instr->representation().IsInteger32()) { | 1303 } else if (instr->representation().IsInteger32()) { |
| 1302 // TODO(1042) The fixed register allocation | 1304 // TODO(1042) The fixed register allocation |
| 1303 // is needed because we call GenericBinaryOpStub from | 1305 // is needed because we call GenericBinaryOpStub from |
| 1304 // the generated code, which requires registers r0 | 1306 // the generated code, which requires registers r0 |
| 1305 // and r1 to be used. We should remove that | 1307 // and r1 to be used. We should remove that |
| 1306 // when we provide a native implementation. | 1308 // when we provide a native implementation. |
| 1307 LOperand* value = UseFixed(instr->left(), r0); | 1309 LOperand* dividend = UseFixed(instr->left(), r0); |
| 1308 LOperand* divisor = UseFixed(instr->right(), r1); | 1310 LOperand* divisor = UseFixed(instr->right(), r1); |
| 1309 return AssignEnvironment(AssignPointerMap( | 1311 return AssignEnvironment(AssignPointerMap( |
| 1310 DefineFixed(new LDivI(value, divisor), r0))); | 1312 DefineFixed(new LDivI(dividend, divisor), r0))); |
| 1311 } else { | 1313 } else { |
| 1312 return DoArithmeticT(Token::DIV, instr); | 1314 return DoArithmeticT(Token::DIV, instr); |
| 1313 } | 1315 } |
| 1314 } | 1316 } |
| 1315 | 1317 |
| 1316 | 1318 |
| 1317 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1319 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1318 if (instr->representation().IsInteger32()) { | 1320 if (instr->representation().IsInteger32()) { |
| 1319 // TODO(1042) The fixed register allocation | 1321 // TODO(1042) The fixed register allocation |
| 1320 // is needed because we call GenericBinaryOpStub from | 1322 // is needed because we call GenericBinaryOpStub from |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 | 1637 |
| 1636 | 1638 |
| 1637 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1639 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 1638 return new LReturn(UseFixed(instr->value(), r0)); | 1640 return new LReturn(UseFixed(instr->value(), r0)); |
| 1639 } | 1641 } |
| 1640 | 1642 |
| 1641 | 1643 |
| 1642 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1644 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1643 Representation r = instr->representation(); | 1645 Representation r = instr->representation(); |
| 1644 if (r.IsInteger32()) { | 1646 if (r.IsInteger32()) { |
| 1645 int32_t value = instr->Integer32Value(); | 1647 return DefineAsRegister(new LConstantI); |
| 1646 return DefineAsRegister(new LConstantI(value)); | |
| 1647 } else if (r.IsDouble()) { | 1648 } else if (r.IsDouble()) { |
| 1648 double value = instr->DoubleValue(); | 1649 return DefineAsRegister(new LConstantD); |
| 1649 return DefineAsRegister(new LConstantD(value)); | |
| 1650 } else if (r.IsTagged()) { | 1650 } else if (r.IsTagged()) { |
| 1651 return DefineAsRegister(new LConstantT(instr->handle())); | 1651 return DefineAsRegister(new LConstantT); |
| 1652 } else { | 1652 } else { |
| 1653 UNREACHABLE(); | 1653 UNREACHABLE(); |
| 1654 return NULL; | 1654 return NULL; |
| 1655 } | 1655 } |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 | 1658 |
| 1659 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { | 1659 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { |
| 1660 LLoadGlobal* result = new LLoadGlobal(); | 1660 LLoadGlobal* result = new LLoadGlobal(); |
| 1661 return instr->check_hole_value() | 1661 return instr->check_hole_value() |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 1883 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 1884 LTypeof* result = new LTypeof(UseRegisterAtStart(instr->value())); | 1884 LTypeof* result = new LTypeof(UseRegisterAtStart(instr->value())); |
| 1885 return MarkAsCall(DefineFixed(result, r0), instr); | 1885 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1886 } | 1886 } |
| 1887 | 1887 |
| 1888 | 1888 |
| 1889 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { | 1889 LInstruction* LChunkBuilder::DoTypeofIs(HTypeofIs* instr) { |
| 1890 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); | 1890 return DefineSameAsFirst(new LTypeofIs(UseRegister(instr->value()))); |
| 1891 } | 1891 } |
| 1892 | 1892 |
| 1893 |
| 1894 LInstruction* LChunkBuilder::DoIsConstructCall(HIsConstructCall* instr) { |
| 1895 return DefineAsRegister(new LIsConstructCall()); |
| 1896 } |
| 1897 |
| 1898 |
| 1893 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { | 1899 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { |
| 1894 HEnvironment* env = current_block_->last_environment(); | 1900 HEnvironment* env = current_block_->last_environment(); |
| 1895 ASSERT(env != NULL); | 1901 ASSERT(env != NULL); |
| 1896 | 1902 |
| 1897 env->set_ast_id(instr->ast_id()); | 1903 env->set_ast_id(instr->ast_id()); |
| 1898 | 1904 |
| 1899 env->Drop(instr->pop_count()); | 1905 env->Drop(instr->pop_count()); |
| 1900 for (int i = 0; i < instr->values()->length(); ++i) { | 1906 for (int i = 0; i < instr->values()->length(); ++i) { |
| 1901 HValue* value = instr->values()->at(i); | 1907 HValue* value = instr->values()->at(i); |
| 1902 if (instr->HasAssignedIndexAt(i)) { | 1908 if (instr->HasAssignedIndexAt(i)) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 | 1948 |
| 1943 | 1949 |
| 1944 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1950 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 1945 HEnvironment* outer = current_block_->last_environment()->outer(); | 1951 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 1946 current_block_->UpdateEnvironment(outer); | 1952 current_block_->UpdateEnvironment(outer); |
| 1947 return NULL; | 1953 return NULL; |
| 1948 } | 1954 } |
| 1949 | 1955 |
| 1950 | 1956 |
| 1951 } } // namespace v8::internal | 1957 } } // namespace v8::internal |
| OLD | NEW |