| 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 return result; | 1031 return result; |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 | 1034 |
| 1035 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1035 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 1036 return new LGoto(instr->FirstSuccessor()->block_id()); | 1036 return new LGoto(instr->FirstSuccessor()->block_id()); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 | 1039 |
| 1040 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1040 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1041 HValue* v = instr->value(); | 1041 HValue* value = instr->value(); |
| 1042 if (v->EmitAtUses()) { | 1042 if (value->EmitAtUses()) { |
| 1043 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1043 HBasicBlock* successor = HConstant::cast(value)->ToBoolean() |
| 1044 ? instr->FirstSuccessor() | 1044 ? instr->FirstSuccessor() |
| 1045 : instr->SecondSuccessor(); | 1045 : instr->SecondSuccessor(); |
| 1046 return new LGoto(successor->block_id()); | 1046 return new LGoto(successor->block_id()); |
| 1047 } | 1047 } |
| 1048 return AssignEnvironment(new LBranch(UseRegister(v))); | 1048 |
| 1049 LBranch* result = new LBranch(UseRegister(value)); |
| 1050 // Tagged values that are not known smis or booleans require a |
| 1051 // deoptimization environment. |
| 1052 Representation rep = value->representation(); |
| 1053 HType type = value->type(); |
| 1054 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) { |
| 1055 return AssignEnvironment(result); |
| 1056 } |
| 1057 return result; |
| 1049 } | 1058 } |
| 1050 | 1059 |
| 1051 | 1060 |
| 1052 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1061 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1053 ASSERT(instr->value()->representation().IsTagged()); | 1062 ASSERT(instr->value()->representation().IsTagged()); |
| 1054 LOperand* value = UseRegisterAtStart(instr->value()); | 1063 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1055 LOperand* temp = TempRegister(); | 1064 LOperand* temp = TempRegister(); |
| 1056 return new LCmpMapAndBranch(value, temp); | 1065 return new LCmpMapAndBranch(value, temp); |
| 1057 } | 1066 } |
| 1058 | 1067 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1347 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
| 1339 LOperand* temp = NULL; | 1348 LOperand* temp = NULL; |
| 1340 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1349 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
| 1341 (instr->CheckFlag(HValue::kCanOverflow) || | 1350 (instr->CheckFlag(HValue::kCanOverflow) || |
| 1342 !right->IsConstantOperand())) { | 1351 !right->IsConstantOperand())) { |
| 1343 left = UseRegister(instr->LeastConstantOperand()); | 1352 left = UseRegister(instr->LeastConstantOperand()); |
| 1344 temp = TempRegister(); | 1353 temp = TempRegister(); |
| 1345 } else { | 1354 } else { |
| 1346 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1355 left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1347 } | 1356 } |
| 1348 return AssignEnvironment(DefineAsRegister(new LMulI(left, right, temp))); | 1357 LMulI* mul = new LMulI(left, right, temp); |
| 1358 if (instr->CheckFlag(HValue::kCanOverflow) || |
| 1359 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1360 AssignEnvironment(mul); |
| 1361 } |
| 1362 return DefineAsRegister(mul); |
| 1349 | 1363 |
| 1350 } else if (instr->representation().IsDouble()) { | 1364 } else if (instr->representation().IsDouble()) { |
| 1351 return DoArithmeticD(Token::MUL, instr); | 1365 return DoArithmeticD(Token::MUL, instr); |
| 1352 | 1366 |
| 1353 } else { | 1367 } else { |
| 1354 return DoArithmeticT(Token::MUL, instr); | 1368 return DoArithmeticT(Token::MUL, instr); |
| 1355 } | 1369 } |
| 1356 } | 1370 } |
| 1357 | 1371 |
| 1358 | 1372 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 | 1565 |
| 1552 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1566 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
| 1553 LOperand* object = UseRegisterAtStart(instr->value()); | 1567 LOperand* object = UseRegisterAtStart(instr->value()); |
| 1554 return DefineAsRegister(new LElementsKind(object)); | 1568 return DefineAsRegister(new LElementsKind(object)); |
| 1555 } | 1569 } |
| 1556 | 1570 |
| 1557 | 1571 |
| 1558 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1572 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
| 1559 LOperand* object = UseRegister(instr->value()); | 1573 LOperand* object = UseRegister(instr->value()); |
| 1560 LValueOf* result = new LValueOf(object, TempRegister()); | 1574 LValueOf* result = new LValueOf(object, TempRegister()); |
| 1561 return AssignEnvironment(DefineAsRegister(result)); | 1575 return DefineAsRegister(result); |
| 1562 } | 1576 } |
| 1563 | 1577 |
| 1564 | 1578 |
| 1565 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1579 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1566 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1580 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), |
| 1567 UseRegister(instr->length()))); | 1581 UseRegister(instr->length()))); |
| 1568 } | 1582 } |
| 1569 | 1583 |
| 1570 | 1584 |
| 1571 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1585 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 } | 1884 } |
| 1871 | 1885 |
| 1872 | 1886 |
| 1873 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1887 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
| 1874 HLoadKeyedFastElement* instr) { | 1888 HLoadKeyedFastElement* instr) { |
| 1875 ASSERT(instr->representation().IsTagged()); | 1889 ASSERT(instr->representation().IsTagged()); |
| 1876 ASSERT(instr->key()->representation().IsInteger32()); | 1890 ASSERT(instr->key()->representation().IsInteger32()); |
| 1877 LOperand* obj = UseRegisterAtStart(instr->object()); | 1891 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1878 LOperand* key = UseRegisterAtStart(instr->key()); | 1892 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1879 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1893 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1880 return AssignEnvironment(DefineAsRegister(result)); | 1894 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
| 1895 return DefineAsRegister(result); |
| 1881 } | 1896 } |
| 1882 | 1897 |
| 1883 | 1898 |
| 1884 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1899 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1885 HLoadKeyedFastDoubleElement* instr) { | 1900 HLoadKeyedFastDoubleElement* instr) { |
| 1886 ASSERT(instr->representation().IsDouble()); | 1901 ASSERT(instr->representation().IsDouble()); |
| 1887 ASSERT(instr->key()->representation().IsInteger32()); | 1902 ASSERT(instr->key()->representation().IsInteger32()); |
| 1888 LOperand* elements = UseTempRegister(instr->elements()); | 1903 LOperand* elements = UseTempRegister(instr->elements()); |
| 1889 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1904 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1890 LLoadKeyedFastDoubleElement* result = | 1905 LLoadKeyedFastDoubleElement* result = |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 | 2256 |
| 2242 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2257 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2243 LOperand* key = UseRegisterAtStart(instr->key()); | 2258 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2244 LOperand* object = UseRegisterAtStart(instr->object()); | 2259 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2245 LIn* result = new LIn(key, object); | 2260 LIn* result = new LIn(key, object); |
| 2246 return MarkAsCall(DefineFixed(result, v0), instr); | 2261 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2247 } | 2262 } |
| 2248 | 2263 |
| 2249 | 2264 |
| 2250 } } // namespace v8::internal | 2265 } } // namespace v8::internal |
| OLD | NEW |