OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 1019 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 LOperand* right = exponent_type.IsDouble() ? | 1421 LOperand* right = exponent_type.IsDouble() ? |
1408 UseFixedDouble(instr->right(), f4) : | 1422 UseFixedDouble(instr->right(), f4) : |
1409 UseFixed(instr->right(), a2); | 1423 UseFixed(instr->right(), a2); |
1410 LPower* result = new LPower(left, right); | 1424 LPower* result = new LPower(left, right); |
1411 return MarkAsCall(DefineFixedDouble(result, f0), | 1425 return MarkAsCall(DefineFixedDouble(result, f0), |
1412 instr, | 1426 instr, |
1413 CAN_DEOPTIMIZE_EAGERLY); | 1427 CAN_DEOPTIMIZE_EAGERLY); |
1414 } | 1428 } |
1415 | 1429 |
1416 | 1430 |
| 1431 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { |
| 1432 ASSERT(instr->representation().IsDouble()); |
| 1433 ASSERT(instr->global_object()->representation().IsTagged()); |
| 1434 LOperand* global_object = UseFixed(instr->global_object(), a0); |
| 1435 LRandom* result = new LRandom(global_object); |
| 1436 return MarkAsCall(DefineFixedDouble(result, f0), instr); |
| 1437 } |
| 1438 |
| 1439 |
1417 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1440 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1418 Representation r = instr->GetInputRepresentation(); | 1441 Representation r = instr->GetInputRepresentation(); |
1419 ASSERT(instr->left()->representation().IsTagged()); | 1442 ASSERT(instr->left()->representation().IsTagged()); |
1420 ASSERT(instr->right()->representation().IsTagged()); | 1443 ASSERT(instr->right()->representation().IsTagged()); |
1421 LOperand* left = UseFixed(instr->left(), a1); | 1444 LOperand* left = UseFixed(instr->left(), a1); |
1422 LOperand* right = UseFixed(instr->right(), a0); | 1445 LOperand* right = UseFixed(instr->right(), a0); |
1423 LCmpT* result = new LCmpT(left, right); | 1446 LCmpT* result = new LCmpT(left, right); |
1424 return MarkAsCall(DefineFixed(result, v0), instr); | 1447 return MarkAsCall(DefineFixed(result, v0), instr); |
1425 } | 1448 } |
1426 | 1449 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 | 1574 |
1552 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1575 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
1553 LOperand* object = UseRegisterAtStart(instr->value()); | 1576 LOperand* object = UseRegisterAtStart(instr->value()); |
1554 return DefineAsRegister(new LElementsKind(object)); | 1577 return DefineAsRegister(new LElementsKind(object)); |
1555 } | 1578 } |
1556 | 1579 |
1557 | 1580 |
1558 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1581 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
1559 LOperand* object = UseRegister(instr->value()); | 1582 LOperand* object = UseRegister(instr->value()); |
1560 LValueOf* result = new LValueOf(object, TempRegister()); | 1583 LValueOf* result = new LValueOf(object, TempRegister()); |
1561 return AssignEnvironment(DefineAsRegister(result)); | 1584 return DefineAsRegister(result); |
1562 } | 1585 } |
1563 | 1586 |
1564 | 1587 |
1565 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1588 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1566 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1589 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), |
1567 UseRegister(instr->length()))); | 1590 UseRegister(instr->length()))); |
1568 } | 1591 } |
1569 | 1592 |
1570 | 1593 |
1571 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1594 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 } | 1893 } |
1871 | 1894 |
1872 | 1895 |
1873 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1896 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
1874 HLoadKeyedFastElement* instr) { | 1897 HLoadKeyedFastElement* instr) { |
1875 ASSERT(instr->representation().IsTagged()); | 1898 ASSERT(instr->representation().IsTagged()); |
1876 ASSERT(instr->key()->representation().IsInteger32()); | 1899 ASSERT(instr->key()->representation().IsInteger32()); |
1877 LOperand* obj = UseRegisterAtStart(instr->object()); | 1900 LOperand* obj = UseRegisterAtStart(instr->object()); |
1878 LOperand* key = UseRegisterAtStart(instr->key()); | 1901 LOperand* key = UseRegisterAtStart(instr->key()); |
1879 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1902 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1880 return AssignEnvironment(DefineAsRegister(result)); | 1903 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
| 1904 return DefineAsRegister(result); |
1881 } | 1905 } |
1882 | 1906 |
1883 | 1907 |
1884 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1908 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
1885 HLoadKeyedFastDoubleElement* instr) { | 1909 HLoadKeyedFastDoubleElement* instr) { |
1886 ASSERT(instr->representation().IsDouble()); | 1910 ASSERT(instr->representation().IsDouble()); |
1887 ASSERT(instr->key()->representation().IsInteger32()); | 1911 ASSERT(instr->key()->representation().IsInteger32()); |
1888 LOperand* elements = UseTempRegister(instr->elements()); | 1912 LOperand* elements = UseTempRegister(instr->elements()); |
1889 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1913 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1890 LLoadKeyedFastDoubleElement* result = | 1914 LLoadKeyedFastDoubleElement* result = |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 | 2265 |
2242 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2266 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2243 LOperand* key = UseRegisterAtStart(instr->key()); | 2267 LOperand* key = UseRegisterAtStart(instr->key()); |
2244 LOperand* object = UseRegisterAtStart(instr->object()); | 2268 LOperand* object = UseRegisterAtStart(instr->object()); |
2245 LIn* result = new LIn(key, object); | 2269 LIn* result = new LIn(key, object); |
2246 return MarkAsCall(DefineFixed(result, v0), instr); | 2270 return MarkAsCall(DefineFixed(result, v0), instr); |
2247 } | 2271 } |
2248 | 2272 |
2249 | 2273 |
2250 } } // namespace v8::internal | 2274 } } // namespace v8::internal |
OLD | NEW |