| 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 LInstruction* result = new LUnaryMathOperation(input); | 1365 LInstruction* result = new LUnaryMathOperation(input); |
| 1360 switch (op) { | 1366 switch (op) { |
| 1361 case kMathAbs: | 1367 case kMathAbs: |
| 1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1368 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1363 case kMathFloor: | 1369 case kMathFloor: |
| 1364 return AssignEnvironment(DefineAsRegister(result)); | 1370 return AssignEnvironment(DefineAsRegister(result)); |
| 1365 case kMathRound: | 1371 case kMathRound: |
| 1366 return AssignEnvironment(DefineAsRegister(result)); | 1372 return AssignEnvironment(DefineAsRegister(result)); |
| 1367 case kMathSqrt: | 1373 case kMathSqrt: |
| 1368 return DefineSameAsFirst(result); | 1374 return DefineSameAsFirst(result); |
| 1369 case kMathPowHalf: | |
| 1370 return AssignEnvironment(DefineSameAsFirst(result)); | |
| 1371 default: | 1375 default: |
| 1372 UNREACHABLE(); | 1376 UNREACHABLE(); |
| 1373 return NULL; | 1377 return NULL; |
| 1374 } | 1378 } |
| 1375 } | 1379 } |
| 1376 | 1380 |
| 1377 | 1381 |
| 1378 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1382 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
| 1379 ASSERT(instr->key()->representation().IsTagged()); | 1383 ASSERT(instr->key()->representation().IsTagged()); |
| 1380 argument_count_ -= instr->argument_count(); | 1384 argument_count_ -= instr->argument_count(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 return result; | 1565 return result; |
| 1562 } else if (instr->representation().IsDouble()) { | 1566 } else if (instr->representation().IsDouble()) { |
| 1563 return DoArithmeticD(Token::ADD, instr); | 1567 return DoArithmeticD(Token::ADD, instr); |
| 1564 } else { | 1568 } else { |
| 1565 ASSERT(instr->representation().IsTagged()); | 1569 ASSERT(instr->representation().IsTagged()); |
| 1566 return DoArithmeticT(Token::ADD, instr); | 1570 return DoArithmeticT(Token::ADD, instr); |
| 1567 } | 1571 } |
| 1568 } | 1572 } |
| 1569 | 1573 |
| 1570 | 1574 |
| 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 | |
| 1587 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { | 1575 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { |
| 1588 Token::Value op = instr->token(); | 1576 Token::Value op = instr->token(); |
| 1589 if (instr->left()->representation().IsInteger32()) { | 1577 if (instr->left()->representation().IsInteger32()) { |
| 1590 ASSERT(instr->right()->representation().IsInteger32()); | 1578 ASSERT(instr->right()->representation().IsInteger32()); |
| 1591 LOperand* left = UseRegisterAtStart(instr->left()); | 1579 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1592 LOperand* right = UseOrConstantAtStart(instr->right()); | 1580 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1593 return DefineAsRegister(new LCmpID(op, left, right, false)); | 1581 return DefineAsRegister(new LCmpID(op, left, right, false)); |
| 1594 } else if (instr->left()->representation().IsDouble()) { | 1582 } else if (instr->left()->representation().IsDouble()) { |
| 1595 ASSERT(instr->right()->representation().IsDouble()); | 1583 ASSERT(instr->right()->representation().IsDouble()); |
| 1596 LOperand* left = UseRegisterAtStart(instr->left()); | 1584 LOperand* left = UseRegisterAtStart(instr->left()); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 void LPointerMap::PrintTo(StringStream* stream) const { | 2087 void LPointerMap::PrintTo(StringStream* stream) const { |
| 2100 stream->Add("{"); | 2088 stream->Add("{"); |
| 2101 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2089 for (int i = 0; i < pointer_operands_.length(); ++i) { |
| 2102 if (i != 0) stream->Add(";"); | 2090 if (i != 0) stream->Add(";"); |
| 2103 pointer_operands_[i]->PrintTo(stream); | 2091 pointer_operands_[i]->PrintTo(stream); |
| 2104 } | 2092 } |
| 2105 stream->Add("} @%d", position()); | 2093 stream->Add("} @%d", position()); |
| 2106 } | 2094 } |
| 2107 | 2095 |
| 2108 } } // namespace v8::internal | 2096 } } // namespace v8::internal |
| OLD | NEW |