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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 446 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
447 object()->PrintTo(stream); | 447 object()->PrintTo(stream); |
448 stream->Add("["); | 448 stream->Add("["); |
449 key()->PrintTo(stream); | 449 key()->PrintTo(stream); |
450 stream->Add("] <- "); | 450 stream->Add("] <- "); |
451 value()->PrintTo(stream); | 451 value()->PrintTo(stream); |
452 } | 452 } |
453 | 453 |
454 | 454 |
| 455 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { |
| 456 object()->PrintTo(stream); |
| 457 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); |
| 458 } |
| 459 |
| 460 |
455 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { | 461 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { |
456 LInstructionGap* gap = new LInstructionGap(block); | 462 LInstructionGap* gap = new LInstructionGap(block); |
457 int index = -1; | 463 int index = -1; |
458 if (instr->IsControl()) { | 464 if (instr->IsControl()) { |
459 instructions_.Add(gap); | 465 instructions_.Add(gap); |
460 index = instructions_.length(); | 466 index = instructions_.length(); |
461 instructions_.Add(instr); | 467 instructions_.Add(instr); |
462 } else { | 468 } else { |
463 index = instructions_.length(); | 469 index = instructions_.length(); |
464 instructions_.Add(instr); | 470 instructions_.Add(instr); |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 LOperand* right = exponent_type.IsDouble() ? | 1433 LOperand* right = exponent_type.IsDouble() ? |
1428 UseFixedDouble(instr->right(), xmm2) : | 1434 UseFixedDouble(instr->right(), xmm2) : |
1429 UseFixed(instr->right(), eax); | 1435 UseFixed(instr->right(), eax); |
1430 LPower* result = new LPower(left, right); | 1436 LPower* result = new LPower(left, right); |
1431 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | 1437 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, |
1432 CAN_DEOPTIMIZE_EAGERLY); | 1438 CAN_DEOPTIMIZE_EAGERLY); |
1433 } | 1439 } |
1434 | 1440 |
1435 | 1441 |
1436 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1442 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1437 Token::Value op = instr->token(); | |
1438 ASSERT(instr->left()->representation().IsTagged()); | 1443 ASSERT(instr->left()->representation().IsTagged()); |
1439 ASSERT(instr->right()->representation().IsTagged()); | 1444 ASSERT(instr->right()->representation().IsTagged()); |
1440 bool reversed = (op == Token::GT || op == Token::LTE); | |
1441 LOperand* context = UseFixed(instr->context(), esi); | 1445 LOperand* context = UseFixed(instr->context(), esi); |
1442 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); | 1446 LOperand* left = UseFixed(instr->left(), edx); |
1443 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); | 1447 LOperand* right = UseFixed(instr->right(), eax); |
1444 LCmpT* result = new LCmpT(context, left, right); | 1448 LCmpT* result = new LCmpT(context, left, right); |
1445 return MarkAsCall(DefineFixed(result, eax), instr); | 1449 return MarkAsCall(DefineFixed(result, eax), instr); |
1446 } | 1450 } |
1447 | 1451 |
1448 | 1452 |
1449 LInstruction* LChunkBuilder::DoCompareIDAndBranch( | 1453 LInstruction* LChunkBuilder::DoCompareIDAndBranch( |
1450 HCompareIDAndBranch* instr) { | 1454 HCompareIDAndBranch* instr) { |
1451 Representation r = instr->GetInputRepresentation(); | 1455 Representation r = instr->GetInputRepresentation(); |
1452 if (r.IsInteger32()) { | 1456 if (r.IsInteger32()) { |
1453 ASSERT(instr->left()->representation().IsInteger32()); | 1457 ASSERT(instr->left()->representation().IsInteger32()); |
1454 ASSERT(instr->right()->representation().IsInteger32()); | 1458 ASSERT(instr->right()->representation().IsInteger32()); |
1455 LOperand* left = UseRegisterAtStart(instr->left()); | 1459 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
1456 LOperand* right = UseOrConstantAtStart(instr->right()); | 1460 LOperand* right = UseOrConstantAtStart(instr->right()); |
1457 return new LCmpIDAndBranch(left, right); | 1461 return new LCmpIDAndBranch(left, right); |
1458 } else { | 1462 } else { |
1459 ASSERT(r.IsDouble()); | 1463 ASSERT(r.IsDouble()); |
1460 ASSERT(instr->left()->representation().IsDouble()); | 1464 ASSERT(instr->left()->representation().IsDouble()); |
1461 ASSERT(instr->right()->representation().IsDouble()); | 1465 ASSERT(instr->right()->representation().IsDouble()); |
1462 LOperand* left = UseRegisterAtStart(instr->left()); | 1466 LOperand* left; |
1463 LOperand* right = UseRegisterAtStart(instr->right()); | 1467 LOperand* right; |
| 1468 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { |
| 1469 left = UseRegisterOrConstantAtStart(instr->left()); |
| 1470 right = UseRegisterOrConstantAtStart(instr->right()); |
| 1471 } else { |
| 1472 left = UseRegisterAtStart(instr->left()); |
| 1473 right = UseRegisterAtStart(instr->right()); |
| 1474 } |
1464 return new LCmpIDAndBranch(left, right); | 1475 return new LCmpIDAndBranch(left, right); |
1465 } | 1476 } |
1466 } | 1477 } |
1467 | 1478 |
1468 | 1479 |
1469 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1480 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
1470 HCompareObjectEqAndBranch* instr) { | 1481 HCompareObjectEqAndBranch* instr) { |
1471 LOperand* left = UseRegisterAtStart(instr->left()); | 1482 LOperand* left = UseRegisterAtStart(instr->left()); |
1472 LOperand* right = UseAtStart(instr->right()); | 1483 LOperand* right = UseAtStart(instr->right()); |
1473 return new LCmpObjectEqAndBranch(left, right); | 1484 return new LCmpObjectEqAndBranch(left, right); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 ASSERT(instr->object()->representation().IsTagged()); | 2037 ASSERT(instr->object()->representation().IsTagged()); |
2027 ASSERT(instr->key()->representation().IsTagged()); | 2038 ASSERT(instr->key()->representation().IsTagged()); |
2028 ASSERT(instr->value()->representation().IsTagged()); | 2039 ASSERT(instr->value()->representation().IsTagged()); |
2029 | 2040 |
2030 LStoreKeyedGeneric* result = | 2041 LStoreKeyedGeneric* result = |
2031 new LStoreKeyedGeneric(context, object, key, value); | 2042 new LStoreKeyedGeneric(context, object, key, value); |
2032 return MarkAsCall(result, instr); | 2043 return MarkAsCall(result, instr); |
2033 } | 2044 } |
2034 | 2045 |
2035 | 2046 |
| 2047 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
| 2048 HTransitionElementsKind* instr) { |
| 2049 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS && |
| 2050 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) { |
| 2051 LOperand* object = UseRegister(instr->object()); |
| 2052 LOperand* new_map_reg = TempRegister(); |
| 2053 LOperand* temp_reg = TempRegister(); |
| 2054 LTransitionElementsKind* result = |
| 2055 new LTransitionElementsKind(object, new_map_reg, temp_reg); |
| 2056 return DefineSameAsFirst(result); |
| 2057 } else { |
| 2058 LOperand* object = UseFixed(instr->object(), eax); |
| 2059 LOperand* fixed_object_reg = FixedTemp(edx); |
| 2060 LOperand* new_map_reg = FixedTemp(ebx); |
| 2061 LTransitionElementsKind* result = |
| 2062 new LTransitionElementsKind(object, new_map_reg, fixed_object_reg); |
| 2063 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2064 } |
| 2065 } |
| 2066 |
| 2067 |
2036 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2068 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2037 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2069 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2038 | 2070 |
2039 LOperand* obj; | 2071 LOperand* obj; |
2040 if (needs_write_barrier) { | 2072 if (needs_write_barrier) { |
2041 obj = instr->is_in_object() | 2073 obj = instr->is_in_object() |
2042 ? UseRegister(instr->object()) | 2074 ? UseRegister(instr->object()) |
2043 : UseTempRegister(instr->object()); | 2075 : UseTempRegister(instr->object()); |
2044 } else { | 2076 } else { |
2045 obj = UseRegisterAtStart(instr->object()); | 2077 obj = UseRegisterAtStart(instr->object()); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 LOperand* key = UseOrConstantAtStart(instr->key()); | 2310 LOperand* key = UseOrConstantAtStart(instr->key()); |
2279 LOperand* object = UseOrConstantAtStart(instr->object()); | 2311 LOperand* object = UseOrConstantAtStart(instr->object()); |
2280 LIn* result = new LIn(context, key, object); | 2312 LIn* result = new LIn(context, key, object); |
2281 return MarkAsCall(DefineFixed(result, eax), instr); | 2313 return MarkAsCall(DefineFixed(result, eax), instr); |
2282 } | 2314 } |
2283 | 2315 |
2284 | 2316 |
2285 } } // namespace v8::internal | 2317 } } // namespace v8::internal |
2286 | 2318 |
2287 #endif // V8_TARGET_ARCH_IA32 | 2319 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |