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 | 1061 |
1053 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1062 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
1054 ASSERT(instr->value()->representation().IsTagged()); | 1063 ASSERT(instr->value()->representation().IsTagged()); |
1055 LOperand* value = UseRegisterAtStart(instr->value()); | 1064 LOperand* value = UseRegisterAtStart(instr->value()); |
1056 LOperand* temp = TempRegister(); | 1065 LOperand* temp = TempRegister(); |
1057 return new LCmpMapAndBranch(value, temp); | 1066 return new LCmpMapAndBranch(value, temp); |
1058 } | 1067 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1346 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
1338 LOperand* temp = NULL; | 1347 LOperand* temp = NULL; |
1339 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && | 1348 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && |
1340 (instr->CheckFlag(HValue::kCanOverflow) || | 1349 (instr->CheckFlag(HValue::kCanOverflow) || |
1341 !right->IsConstantOperand())) { | 1350 !right->IsConstantOperand())) { |
1342 left = UseRegister(instr->LeastConstantOperand()); | 1351 left = UseRegister(instr->LeastConstantOperand()); |
1343 temp = TempRegister(); | 1352 temp = TempRegister(); |
1344 } else { | 1353 } else { |
1345 left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1354 left = UseRegisterAtStart(instr->LeastConstantOperand()); |
1346 } | 1355 } |
1347 return AssignEnvironment(DefineAsRegister(new LMulI(left, right, temp))); | 1356 LMulI* mul = new LMulI(left, right, temp); |
| 1357 if (instr->CheckFlag(HValue::kCanOverflow) || |
| 1358 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1359 AssignEnvironment(mul); |
| 1360 } |
| 1361 return DefineAsRegister(mul); |
1348 | 1362 |
1349 } else if (instr->representation().IsDouble()) { | 1363 } else if (instr->representation().IsDouble()) { |
1350 return DoArithmeticD(Token::MUL, instr); | 1364 return DoArithmeticD(Token::MUL, instr); |
1351 | 1365 |
1352 } else { | 1366 } else { |
1353 return DoArithmeticT(Token::MUL, instr); | 1367 return DoArithmeticT(Token::MUL, instr); |
1354 } | 1368 } |
1355 } | 1369 } |
1356 | 1370 |
1357 | 1371 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 | 1563 |
1550 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1564 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
1551 LOperand* object = UseRegisterAtStart(instr->value()); | 1565 LOperand* object = UseRegisterAtStart(instr->value()); |
1552 return DefineAsRegister(new LElementsKind(object)); | 1566 return DefineAsRegister(new LElementsKind(object)); |
1553 } | 1567 } |
1554 | 1568 |
1555 | 1569 |
1556 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1570 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
1557 LOperand* object = UseRegister(instr->value()); | 1571 LOperand* object = UseRegister(instr->value()); |
1558 LValueOf* result = new LValueOf(object, TempRegister()); | 1572 LValueOf* result = new LValueOf(object, TempRegister()); |
1559 return AssignEnvironment(DefineAsRegister(result)); | 1573 return DefineAsRegister(result); |
1560 } | 1574 } |
1561 | 1575 |
1562 | 1576 |
1563 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1577 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1564 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1578 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), |
1565 UseRegister(instr->length()))); | 1579 UseRegister(instr->length()))); |
1566 } | 1580 } |
1567 | 1581 |
1568 | 1582 |
1569 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1583 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 } | 1881 } |
1868 | 1882 |
1869 | 1883 |
1870 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1884 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
1871 HLoadKeyedFastElement* instr) { | 1885 HLoadKeyedFastElement* instr) { |
1872 ASSERT(instr->representation().IsTagged()); | 1886 ASSERT(instr->representation().IsTagged()); |
1873 ASSERT(instr->key()->representation().IsInteger32()); | 1887 ASSERT(instr->key()->representation().IsInteger32()); |
1874 LOperand* obj = UseRegisterAtStart(instr->object()); | 1888 LOperand* obj = UseRegisterAtStart(instr->object()); |
1875 LOperand* key = UseRegisterAtStart(instr->key()); | 1889 LOperand* key = UseRegisterAtStart(instr->key()); |
1876 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1890 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1877 return AssignEnvironment(DefineAsRegister(result)); | 1891 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
| 1892 return DefineAsRegister(result); |
1878 } | 1893 } |
1879 | 1894 |
1880 | 1895 |
1881 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1896 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
1882 HLoadKeyedFastDoubleElement* instr) { | 1897 HLoadKeyedFastDoubleElement* instr) { |
1883 ASSERT(instr->representation().IsDouble()); | 1898 ASSERT(instr->representation().IsDouble()); |
1884 ASSERT(instr->key()->representation().IsInteger32()); | 1899 ASSERT(instr->key()->representation().IsInteger32()); |
1885 LOperand* elements = UseTempRegister(instr->elements()); | 1900 LOperand* elements = UseTempRegister(instr->elements()); |
1886 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1901 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1887 LLoadKeyedFastDoubleElement* result = | 1902 LLoadKeyedFastDoubleElement* result = |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2238 | 2253 |
2239 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2254 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2240 LOperand* key = UseRegisterAtStart(instr->key()); | 2255 LOperand* key = UseRegisterAtStart(instr->key()); |
2241 LOperand* object = UseRegisterAtStart(instr->object()); | 2256 LOperand* object = UseRegisterAtStart(instr->object()); |
2242 LIn* result = new LIn(key, object); | 2257 LIn* result = new LIn(key, object); |
2243 return MarkAsCall(DefineFixed(result, r0), instr); | 2258 return MarkAsCall(DefineFixed(result, r0), instr); |
2244 } | 2259 } |
2245 | 2260 |
2246 | 2261 |
2247 } } // namespace v8::internal | 2262 } } // namespace v8::internal |
OLD | NEW |