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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 return instructions_[index]->IsGap(); | 453 return instructions_[index]->IsGap(); |
454 } | 454 } |
455 | 455 |
456 | 456 |
457 int LChunk::NearestGapPos(int index) const { | 457 int LChunk::NearestGapPos(int index) const { |
458 while (!IsGapAt(index)) index--; | 458 while (!IsGapAt(index)) index--; |
459 return index; | 459 return index; |
460 } | 460 } |
461 | 461 |
462 | 462 |
| 463 int LChunk::NearestNextGapPos(int index) const { |
| 464 while (!IsGapAt(index)) index++; |
| 465 return index; |
| 466 } |
| 467 |
| 468 |
463 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) { | 469 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) { |
464 GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to); | 470 GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to); |
465 } | 471 } |
466 | 472 |
467 | 473 |
468 class LGapNode: public ZoneObject { | 474 class LGapNode: public ZoneObject { |
469 public: | 475 public: |
470 explicit LGapNode(LOperand* operand) | 476 explicit LGapNode(LOperand* operand) |
471 : operand_(operand), resolved_(false), visited_id_(-1) { } | 477 : operand_(operand), resolved_(false), visited_id_(-1) { } |
472 | 478 |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 MathFunctionId op = instr->op(); | 1350 MathFunctionId op = instr->op(); |
1345 LOperand* input = UseRegisterAtStart(instr->value()); | 1351 LOperand* input = UseRegisterAtStart(instr->value()); |
1346 LInstruction* result = new LUnaryMathOperation(input); | 1352 LInstruction* result = new LUnaryMathOperation(input); |
1347 switch (op) { | 1353 switch (op) { |
1348 case kMathAbs: | 1354 case kMathAbs: |
1349 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1355 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1350 case kMathFloor: | 1356 case kMathFloor: |
1351 return AssignEnvironment(DefineAsRegister(result)); | 1357 return AssignEnvironment(DefineAsRegister(result)); |
1352 case kMathSqrt: | 1358 case kMathSqrt: |
1353 return DefineSameAsFirst(result); | 1359 return DefineSameAsFirst(result); |
1354 case kMathPowHalf: | |
1355 Abort("MathPowHalf LUnaryMathOperation not implemented"); | |
1356 return NULL; | |
1357 default: | 1360 default: |
1358 UNREACHABLE(); | 1361 UNREACHABLE(); |
1359 return NULL; | 1362 return NULL; |
1360 } | 1363 } |
1361 } | 1364 } |
1362 | 1365 |
1363 | 1366 |
1364 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1367 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1365 ASSERT(instr->key()->representation().IsTagged()); | 1368 ASSERT(instr->key()->representation().IsTagged()); |
1366 argument_count_ -= instr->argument_count(); | 1369 argument_count_ -= instr->argument_count(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 return result; | 1547 return result; |
1545 } else if (instr->representation().IsDouble()) { | 1548 } else if (instr->representation().IsDouble()) { |
1546 return DoArithmeticD(Token::ADD, instr); | 1549 return DoArithmeticD(Token::ADD, instr); |
1547 } else { | 1550 } else { |
1548 ASSERT(instr->representation().IsTagged()); | 1551 ASSERT(instr->representation().IsTagged()); |
1549 return DoArithmeticT(Token::ADD, instr); | 1552 return DoArithmeticT(Token::ADD, instr); |
1550 } | 1553 } |
1551 } | 1554 } |
1552 | 1555 |
1553 | 1556 |
1554 LInstruction* LChunkBuilder::DoPower(HPower* instr) { | |
1555 Abort("LPower instruction not implemented on ARM"); | |
1556 return NULL; | |
1557 } | |
1558 | |
1559 | |
1560 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { | 1557 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { |
1561 Token::Value op = instr->token(); | 1558 Token::Value op = instr->token(); |
1562 if (instr->left()->representation().IsInteger32()) { | 1559 if (instr->left()->representation().IsInteger32()) { |
1563 ASSERT(instr->right()->representation().IsInteger32()); | 1560 ASSERT(instr->right()->representation().IsInteger32()); |
1564 LOperand* left = UseRegisterAtStart(instr->left()); | 1561 LOperand* left = UseRegisterAtStart(instr->left()); |
1565 LOperand* right = UseOrConstantAtStart(instr->right()); | 1562 LOperand* right = UseOrConstantAtStart(instr->right()); |
1566 return DefineAsRegister(new LCmpID(op, left, right, false)); | 1563 return DefineAsRegister(new LCmpID(op, left, right, false)); |
1567 } else if (instr->left()->representation().IsDouble()) { | 1564 } else if (instr->left()->representation().IsDouble()) { |
1568 ASSERT(instr->right()->representation().IsDouble()); | 1565 ASSERT(instr->right()->representation().IsDouble()); |
1569 LOperand* left = UseRegisterAtStart(instr->left()); | 1566 LOperand* left = UseRegisterAtStart(instr->left()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); | 1681 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
1685 } | 1682 } |
1686 if (needs_check) { | 1683 if (needs_check) { |
1687 res = AssignEnvironment(res); | 1684 res = AssignEnvironment(res); |
1688 } | 1685 } |
1689 return res; | 1686 return res; |
1690 } | 1687 } |
1691 } else if (from.IsDouble()) { | 1688 } else if (from.IsDouble()) { |
1692 if (to.IsTagged()) { | 1689 if (to.IsTagged()) { |
1693 LOperand* value = UseRegister(instr->value()); | 1690 LOperand* value = UseRegister(instr->value()); |
1694 LOperand* temp1 = TempRegister(); | 1691 LOperand* temp = TempRegister(); |
1695 LOperand* temp2 = TempRegister(); | |
1696 | 1692 |
1697 // Make sure that the temp and result_temp registers are | 1693 // Make sure that temp and result_temp are different registers. |
1698 // different. | |
1699 LUnallocated* result_temp = TempRegister(); | 1694 LUnallocated* result_temp = TempRegister(); |
1700 LInstruction* result = new LNumberTagD(value, temp1, temp2); | 1695 LInstruction* result = new LNumberTagD(value, temp); |
1701 Define(result, result_temp); | 1696 Define(result, result_temp); |
1702 return AssignPointerMap(result); | 1697 return AssignPointerMap(result); |
1703 } else { | 1698 } else { |
1704 ASSERT(to.IsInteger32()); | 1699 ASSERT(to.IsInteger32()); |
1705 LOperand* value = UseRegister(instr->value()); | 1700 LOperand* value = UseRegister(instr->value()); |
1706 LInstruction* res = new LDoubleToI(value); | 1701 LInstruction* res = new LDoubleToI(value); |
1707 return AssignEnvironment(DefineAsRegister(res)); | 1702 return AssignEnvironment(DefineAsRegister(res)); |
1708 } | 1703 } |
1709 } else if (from.IsInteger32()) { | 1704 } else if (from.IsInteger32()) { |
1710 if (to.IsTagged()) { | 1705 if (to.IsTagged()) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 void LPointerMap::PrintTo(StringStream* stream) const { | 2072 void LPointerMap::PrintTo(StringStream* stream) const { |
2078 stream->Add("{"); | 2073 stream->Add("{"); |
2079 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2074 for (int i = 0; i < pointer_operands_.length(); ++i) { |
2080 if (i != 0) stream->Add(";"); | 2075 if (i != 0) stream->Add(";"); |
2081 pointer_operands_[i]->PrintTo(stream); | 2076 pointer_operands_[i]->PrintTo(stream); |
2082 } | 2077 } |
2083 stream->Add("} @%d", position()); | 2078 stream->Add("} @%d", position()); |
2084 } | 2079 } |
2085 | 2080 |
2086 } } // namespace v8::internal | 2081 } } // namespace v8::internal |
OLD | NEW |