| 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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1029 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 1030 HValue* v = instr->value(); | 1030 HValue* v = instr->value(); |
| 1031 if (v->EmitAtUses()) { | 1031 if (v->EmitAtUses()) { |
| 1032 ASSERT(v->IsConstant()); | 1032 ASSERT(v->IsConstant()); |
| 1033 ASSERT(!v->representation().IsDouble()); | 1033 ASSERT(!v->representation().IsDouble()); |
| 1034 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1034 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
| 1035 ? instr->FirstSuccessor() | 1035 ? instr->FirstSuccessor() |
| 1036 : instr->SecondSuccessor(); | 1036 : instr->SecondSuccessor(); |
| 1037 return new LGoto(successor->block_id()); | 1037 return new LGoto(successor->block_id()); |
| 1038 } | 1038 } |
| 1039 LInstruction* branch = new LBranch(UseRegister(v)); | 1039 return AssignEnvironment(new LBranch(UseRegister(v))); |
| 1040 // When we handle all cases, we never deopt, so we don't need to assign the | |
| 1041 // environment then. | |
| 1042 bool all_cases_handled = instr->expected_input_types().IsAll(); | |
| 1043 return all_cases_handled ? branch : AssignEnvironment(branch); | |
| 1044 } | 1040 } |
| 1045 | 1041 |
| 1046 | 1042 |
| 1047 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1043 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1048 ASSERT(instr->value()->representation().IsTagged()); | 1044 ASSERT(instr->value()->representation().IsTagged()); |
| 1049 LOperand* value = UseRegisterAtStart(instr->value()); | 1045 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1050 return new LCmpMapAndBranch(value); | 1046 return new LCmpMapAndBranch(value); |
| 1051 } | 1047 } |
| 1052 | 1048 |
| 1053 | 1049 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 TempRegister()); | 1491 TempRegister()); |
| 1496 } | 1492 } |
| 1497 | 1493 |
| 1498 | 1494 |
| 1499 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) { | 1495 LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) { |
| 1500 LOperand* array = UseRegisterAtStart(instr->value()); | 1496 LOperand* array = UseRegisterAtStart(instr->value()); |
| 1501 return DefineAsRegister(new LJSArrayLength(array)); | 1497 return DefineAsRegister(new LJSArrayLength(array)); |
| 1502 } | 1498 } |
| 1503 | 1499 |
| 1504 | 1500 |
| 1505 LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) { | 1501 LInstruction* LChunkBuilder::DoFixedArrayBaseLength( |
| 1502 HFixedArrayBaseLength* instr) { |
| 1506 LOperand* array = UseRegisterAtStart(instr->value()); | 1503 LOperand* array = UseRegisterAtStart(instr->value()); |
| 1507 return DefineAsRegister(new LFixedArrayLength(array)); | 1504 return DefineAsRegister(new LFixedArrayBaseLength(array)); |
| 1508 } | |
| 1509 | |
| 1510 | |
| 1511 LInstruction* LChunkBuilder::DoExternalArrayLength( | |
| 1512 HExternalArrayLength* instr) { | |
| 1513 LOperand* array = UseRegisterAtStart(instr->value()); | |
| 1514 return DefineAsRegister(new LExternalArrayLength(array)); | |
| 1515 } | 1505 } |
| 1516 | 1506 |
| 1517 | 1507 |
| 1518 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { | 1508 LInstruction* LChunkBuilder::DoElementsKind(HElementsKind* instr) { |
| 1519 LOperand* object = UseRegisterAtStart(instr->value()); | 1509 LOperand* object = UseRegisterAtStart(instr->value()); |
| 1520 return DefineAsRegister(new LElementsKind(object)); | 1510 return DefineAsRegister(new LElementsKind(object)); |
| 1521 } | 1511 } |
| 1522 | 1512 |
| 1523 | 1513 |
| 1524 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1514 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
| 1525 LOperand* object = UseRegister(instr->value()); | 1515 LOperand* object = UseRegister(instr->value()); |
| 1526 LValueOf* result = new LValueOf(object); | 1516 LValueOf* result = new LValueOf(object); |
| 1527 return AssignEnvironment(DefineSameAsFirst(result)); | 1517 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1528 } | 1518 } |
| 1529 | 1519 |
| 1530 | 1520 |
| 1531 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1521 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1532 return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()), | 1522 return AssignEnvironment(new LBoundsCheck( |
| 1533 Use(instr->length()))); | 1523 UseRegisterOrConstantAtStart(instr->index()), |
| 1524 Use(instr->length()))); |
| 1534 } | 1525 } |
| 1535 | 1526 |
| 1536 | 1527 |
| 1537 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1528 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
| 1538 // The control instruction marking the end of a block that completed | 1529 // The control instruction marking the end of a block that completed |
| 1539 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1530 // abruptly (e.g., threw an exception). There is nothing specific to do. |
| 1540 return NULL; | 1531 return NULL; |
| 1541 } | 1532 } |
| 1542 | 1533 |
| 1543 | 1534 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 LOperand* input = UseRegisterAtStart(instr->value()); | 1815 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1825 return DefineAsRegister(new LLoadExternalArrayPointer(input)); | 1816 return DefineAsRegister(new LLoadExternalArrayPointer(input)); |
| 1826 } | 1817 } |
| 1827 | 1818 |
| 1828 | 1819 |
| 1829 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( | 1820 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( |
| 1830 HLoadKeyedFastElement* instr) { | 1821 HLoadKeyedFastElement* instr) { |
| 1831 ASSERT(instr->representation().IsTagged()); | 1822 ASSERT(instr->representation().IsTagged()); |
| 1832 ASSERT(instr->key()->representation().IsInteger32()); | 1823 ASSERT(instr->key()->representation().IsInteger32()); |
| 1833 LOperand* obj = UseRegisterAtStart(instr->object()); | 1824 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1834 LOperand* key = UseRegisterAtStart(instr->key()); | 1825 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1835 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1826 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1836 return AssignEnvironment(DefineSameAsFirst(result)); | 1827 return AssignEnvironment(DefineAsRegister(result)); |
| 1837 } | 1828 } |
| 1838 | 1829 |
| 1839 | 1830 |
| 1840 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( | 1831 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( |
| 1841 HLoadKeyedFastDoubleElement* instr) { | 1832 HLoadKeyedFastDoubleElement* instr) { |
| 1842 ASSERT(instr->representation().IsDouble()); | 1833 ASSERT(instr->representation().IsDouble()); |
| 1843 ASSERT(instr->key()->representation().IsInteger32()); | 1834 ASSERT(instr->key()->representation().IsInteger32()); |
| 1844 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1835 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1845 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1836 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1846 LLoadKeyedFastDoubleElement* result = | 1837 LLoadKeyedFastDoubleElement* result = |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 LOperand* key = UseOrConstantAtStart(instr->key()); | 2170 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2180 LOperand* object = UseOrConstantAtStart(instr->object()); | 2171 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2181 LIn* result = new LIn(key, object); | 2172 LIn* result = new LIn(key, object); |
| 2182 return MarkAsCall(DefineFixed(result, rax), instr); | 2173 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2183 } | 2174 } |
| 2184 | 2175 |
| 2185 | 2176 |
| 2186 } } // namespace v8::internal | 2177 } } // namespace v8::internal |
| 2187 | 2178 |
| 2188 #endif // V8_TARGET_ARCH_X64 | 2179 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |