| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 return result; | 1026 return result; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 | 1029 |
| 1030 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1030 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 1031 return new LGoto(instr->FirstSuccessor()->block_id()); | 1031 return new LGoto(instr->FirstSuccessor()->block_id()); |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 | 1034 |
| 1035 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1035 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1036 HValue* v = instr->value(); | 1036 HValue* value = instr->value(); |
| 1037 if (v->EmitAtUses()) { | 1037 if (value->EmitAtUses()) { |
| 1038 ASSERT(v->IsConstant()); | 1038 ASSERT(value->IsConstant()); |
| 1039 ASSERT(!v->representation().IsDouble()); | 1039 ASSERT(!value->representation().IsDouble()); |
| 1040 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1040 HBasicBlock* successor = HConstant::cast(value)->ToBoolean() |
| 1041 ? instr->FirstSuccessor() | 1041 ? instr->FirstSuccessor() |
| 1042 : instr->SecondSuccessor(); | 1042 : instr->SecondSuccessor(); |
| 1043 return new LGoto(successor->block_id()); | 1043 return new LGoto(successor->block_id()); |
| 1044 } | 1044 } |
| 1045 return AssignEnvironment(new LBranch(UseRegister(v))); | 1045 |
| 1046 LBranch* result = new LBranch(UseRegister(value)); |
| 1047 // Tagged values that are not known smis or booleans require a |
| 1048 // deoptimization environment. |
| 1049 Representation rep = value->representation(); |
| 1050 HType type = value->type(); |
| 1051 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) { |
| 1052 return AssignEnvironment(result); |
| 1053 } |
| 1054 return result; |
| 1046 } | 1055 } |
| 1047 | 1056 |
| 1048 | 1057 |
| 1049 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1058 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1050 ASSERT(instr->value()->representation().IsTagged()); | 1059 ASSERT(instr->value()->representation().IsTagged()); |
| 1051 LOperand* value = UseRegisterAtStart(instr->value()); | 1060 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1052 return new LCmpMapAndBranch(value); | 1061 return new LCmpMapAndBranch(value); |
| 1053 } | 1062 } |
| 1054 | 1063 |
| 1055 | 1064 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 } | 1331 } |
| 1323 | 1332 |
| 1324 | 1333 |
| 1325 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1334 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1326 if (instr->representation().IsInteger32()) { | 1335 if (instr->representation().IsInteger32()) { |
| 1327 ASSERT(instr->left()->representation().IsInteger32()); | 1336 ASSERT(instr->left()->representation().IsInteger32()); |
| 1328 ASSERT(instr->right()->representation().IsInteger32()); | 1337 ASSERT(instr->right()->representation().IsInteger32()); |
| 1329 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1338 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1330 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1339 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
| 1331 LMulI* mul = new LMulI(left, right); | 1340 LMulI* mul = new LMulI(left, right); |
| 1332 return AssignEnvironment(DefineSameAsFirst(mul)); | 1341 if (instr->CheckFlag(HValue::kCanOverflow) || |
| 1342 instr->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1343 AssignEnvironment(mul); |
| 1344 } |
| 1345 return DefineSameAsFirst(mul); |
| 1333 } else if (instr->representation().IsDouble()) { | 1346 } else if (instr->representation().IsDouble()) { |
| 1334 return DoArithmeticD(Token::MUL, instr); | 1347 return DoArithmeticD(Token::MUL, instr); |
| 1335 } else { | 1348 } else { |
| 1336 ASSERT(instr->representation().IsTagged()); | 1349 ASSERT(instr->representation().IsTagged()); |
| 1337 return DoArithmeticT(Token::MUL, instr); | 1350 return DoArithmeticT(Token::MUL, instr); |
| 1338 } | 1351 } |
| 1339 } | 1352 } |
| 1340 | 1353 |
| 1341 | 1354 |
| 1342 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 1355 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 | 1559 |
| 1547 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1560 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
| 1548 LOperand* object = UseRegisterAtStart(instr->value()); | 1561 LOperand* object = UseRegisterAtStart(instr->value()); |
| 1549 return DefineAsRegister(new LElementsKind(object)); | 1562 return DefineAsRegister(new LElementsKind(object)); |
| 1550 } | 1563 } |
| 1551 | 1564 |
| 1552 | 1565 |
| 1553 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1566 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
| 1554 LOperand* object = UseRegister(instr->value()); | 1567 LOperand* object = UseRegister(instr->value()); |
| 1555 LValueOf* result = new LValueOf(object); | 1568 LValueOf* result = new LValueOf(object); |
| 1556 return AssignEnvironment(DefineSameAsFirst(result)); | 1569 return DefineSameAsFirst(result); |
| 1557 } | 1570 } |
| 1558 | 1571 |
| 1559 | 1572 |
| 1560 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1573 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1561 return AssignEnvironment(new LBoundsCheck( | 1574 return AssignEnvironment(new LBoundsCheck( |
| 1562 UseRegisterOrConstantAtStart(instr->index()), | 1575 UseRegisterOrConstantAtStart(instr->index()), |
| 1563 Use(instr->length()))); | 1576 Use(instr->length()))); |
| 1564 } | 1577 } |
| 1565 | 1578 |
| 1566 | 1579 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 } | 1872 } |
| 1860 | 1873 |
| 1861 | 1874 |
| 1862 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1875 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
| 1863 HLoadKeyedFastElement* instr) { | 1876 HLoadKeyedFastElement* instr) { |
| 1864 ASSERT(instr->representation().IsTagged()); | 1877 ASSERT(instr->representation().IsTagged()); |
| 1865 ASSERT(instr->key()->representation().IsInteger32()); | 1878 ASSERT(instr->key()->representation().IsInteger32()); |
| 1866 LOperand* obj = UseRegisterAtStart(instr->object()); | 1879 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1867 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1880 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1868 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1881 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1869 return AssignEnvironment(DefineAsRegister(result)); | 1882 if (instr->RequiresHoleCheck()) AssignEnvironment(result); |
| 1883 return DefineAsRegister(result); |
| 1870 } | 1884 } |
| 1871 | 1885 |
| 1872 | 1886 |
| 1873 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1887 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1874 HLoadKeyedFastDoubleElement* instr) { | 1888 HLoadKeyedFastDoubleElement* instr) { |
| 1875 ASSERT(instr->representation().IsDouble()); | 1889 ASSERT(instr->representation().IsDouble()); |
| 1876 ASSERT(instr->key()->representation().IsInteger32()); | 1890 ASSERT(instr->key()->representation().IsInteger32()); |
| 1877 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1891 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1878 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1892 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1879 LLoadKeyedFastDoubleElement* result = | 1893 LLoadKeyedFastDoubleElement* result = |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2238 LOperand* key = UseOrConstantAtStart(instr->key()); | 2252 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2239 LOperand* object = UseOrConstantAtStart(instr->object()); | 2253 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2240 LIn* result = new LIn(key, object); | 2254 LIn* result = new LIn(key, object); |
| 2241 return MarkAsCall(DefineFixed(result, rax), instr); | 2255 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2242 } | 2256 } |
| 2243 | 2257 |
| 2244 | 2258 |
| 2245 } } // namespace v8::internal | 2259 } } // namespace v8::internal |
| 2246 | 2260 |
| 2247 #endif // V8_TARGET_ARCH_X64 | 2261 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |