OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 LInstruction* result = new LUnaryMathOperation(input); | 1359 LInstruction* result = new LUnaryMathOperation(input); |
1360 switch (op) { | 1360 switch (op) { |
1361 case kMathAbs: | 1361 case kMathAbs: |
1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1363 case kMathFloor: | 1363 case kMathFloor: |
1364 return AssignEnvironment(DefineAsRegister(result)); | 1364 return AssignEnvironment(DefineAsRegister(result)); |
1365 case kMathRound: | 1365 case kMathRound: |
1366 return AssignEnvironment(DefineAsRegister(result)); | 1366 return AssignEnvironment(DefineAsRegister(result)); |
1367 case kMathSqrt: | 1367 case kMathSqrt: |
1368 return DefineSameAsFirst(result); | 1368 return DefineSameAsFirst(result); |
| 1369 case kMathPowHalf: |
| 1370 return AssignEnvironment(DefineSameAsFirst(result)); |
1369 default: | 1371 default: |
1370 UNREACHABLE(); | 1372 UNREACHABLE(); |
1371 return NULL; | 1373 return NULL; |
1372 } | 1374 } |
1373 } | 1375 } |
1374 | 1376 |
1375 | 1377 |
1376 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1378 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1377 ASSERT(instr->key()->representation().IsTagged()); | 1379 ASSERT(instr->key()->representation().IsTagged()); |
1378 argument_count_ -= instr->argument_count(); | 1380 argument_count_ -= instr->argument_count(); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 return result; | 1561 return result; |
1560 } else if (instr->representation().IsDouble()) { | 1562 } else if (instr->representation().IsDouble()) { |
1561 return DoArithmeticD(Token::ADD, instr); | 1563 return DoArithmeticD(Token::ADD, instr); |
1562 } else { | 1564 } else { |
1563 ASSERT(instr->representation().IsTagged()); | 1565 ASSERT(instr->representation().IsTagged()); |
1564 return DoArithmeticT(Token::ADD, instr); | 1566 return DoArithmeticT(Token::ADD, instr); |
1565 } | 1567 } |
1566 } | 1568 } |
1567 | 1569 |
1568 | 1570 |
| 1571 LInstruction* LChunkBuilder::DoPower(HPower* instr) { |
| 1572 ASSERT(instr->representation().IsDouble()); |
| 1573 // We call a C function for double power. It can't trigger a GC. |
| 1574 // We need to use fixed result register for the call. |
| 1575 Representation exponent_type = instr->right()->representation(); |
| 1576 ASSERT(instr->left()->representation().IsDouble()); |
| 1577 LOperand* left = UseFixedDouble(instr->left(), xmm1); |
| 1578 LOperand* right = exponent_type.IsDouble() ? |
| 1579 UseFixedDouble(instr->right(), xmm2) : |
| 1580 UseFixed(instr->right(), eax); |
| 1581 LPower* result = new LPower(left, right); |
| 1582 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, |
| 1583 CAN_DEOPTIMIZE_EAGERLY); |
| 1584 } |
| 1585 |
| 1586 |
1569 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { | 1587 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { |
1570 Token::Value op = instr->token(); | 1588 Token::Value op = instr->token(); |
1571 if (instr->left()->representation().IsInteger32()) { | 1589 if (instr->left()->representation().IsInteger32()) { |
1572 ASSERT(instr->right()->representation().IsInteger32()); | 1590 ASSERT(instr->right()->representation().IsInteger32()); |
1573 LOperand* left = UseRegisterAtStart(instr->left()); | 1591 LOperand* left = UseRegisterAtStart(instr->left()); |
1574 LOperand* right = UseOrConstantAtStart(instr->right()); | 1592 LOperand* right = UseOrConstantAtStart(instr->right()); |
1575 return DefineAsRegister(new LCmpID(op, left, right, false)); | 1593 return DefineAsRegister(new LCmpID(op, left, right, false)); |
1576 } else if (instr->left()->representation().IsDouble()) { | 1594 } else if (instr->left()->representation().IsDouble()) { |
1577 ASSERT(instr->right()->representation().IsDouble()); | 1595 ASSERT(instr->right()->representation().IsDouble()); |
1578 LOperand* left = UseRegisterAtStart(instr->left()); | 1596 LOperand* left = UseRegisterAtStart(instr->left()); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 void LPointerMap::PrintTo(StringStream* stream) const { | 2099 void LPointerMap::PrintTo(StringStream* stream) const { |
2082 stream->Add("{"); | 2100 stream->Add("{"); |
2083 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2101 for (int i = 0; i < pointer_operands_.length(); ++i) { |
2084 if (i != 0) stream->Add(";"); | 2102 if (i != 0) stream->Add(";"); |
2085 pointer_operands_[i]->PrintTo(stream); | 2103 pointer_operands_[i]->PrintTo(stream); |
2086 } | 2104 } |
2087 stream->Add("} @%d", position()); | 2105 stream->Add("} @%d", position()); |
2088 } | 2106 } |
2089 | 2107 |
2090 } } // namespace v8::internal | 2108 } } // namespace v8::internal |
OLD | NEW |