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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 440 |
441 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { | 441 void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) { |
442 object()->PrintTo(stream); | 442 object()->PrintTo(stream); |
443 stream->Add("["); | 443 stream->Add("["); |
444 key()->PrintTo(stream); | 444 key()->PrintTo(stream); |
445 stream->Add("] <- "); | 445 stream->Add("] <- "); |
446 value()->PrintTo(stream); | 446 value()->PrintTo(stream); |
447 } | 447 } |
448 | 448 |
449 | 449 |
| 450 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { |
| 451 object()->PrintTo(stream); |
| 452 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); |
| 453 } |
| 454 |
| 455 |
450 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { | 456 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { |
451 LInstructionGap* gap = new LInstructionGap(block); | 457 LInstructionGap* gap = new LInstructionGap(block); |
452 int index = -1; | 458 int index = -1; |
453 if (instr->IsControl()) { | 459 if (instr->IsControl()) { |
454 instructions_.Add(gap); | 460 instructions_.Add(gap); |
455 index = instructions_.length(); | 461 index = instructions_.length(); |
456 instructions_.Add(instr); | 462 instructions_.Add(instr); |
457 } else { | 463 } else { |
458 index = instructions_.length(); | 464 index = instructions_.length(); |
459 instructions_.Add(instr); | 465 instructions_.Add(instr); |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 #else | 1395 #else |
1390 UseFixed(instr->right(), rdi); | 1396 UseFixed(instr->right(), rdi); |
1391 #endif | 1397 #endif |
1392 LPower* result = new LPower(left, right); | 1398 LPower* result = new LPower(left, right); |
1393 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, | 1399 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, |
1394 CAN_DEOPTIMIZE_EAGERLY); | 1400 CAN_DEOPTIMIZE_EAGERLY); |
1395 } | 1401 } |
1396 | 1402 |
1397 | 1403 |
1398 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1404 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1399 Token::Value op = instr->token(); | |
1400 ASSERT(instr->left()->representation().IsTagged()); | 1405 ASSERT(instr->left()->representation().IsTagged()); |
1401 ASSERT(instr->right()->representation().IsTagged()); | 1406 ASSERT(instr->right()->representation().IsTagged()); |
1402 bool reversed = (op == Token::GT || op == Token::LTE); | 1407 LOperand* left = UseFixed(instr->left(), rdx); |
1403 LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx); | 1408 LOperand* right = UseFixed(instr->right(), rax); |
1404 LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax); | |
1405 LCmpT* result = new LCmpT(left, right); | 1409 LCmpT* result = new LCmpT(left, right); |
1406 return MarkAsCall(DefineFixed(result, rax), instr); | 1410 return MarkAsCall(DefineFixed(result, rax), instr); |
1407 } | 1411 } |
1408 | 1412 |
1409 | 1413 |
1410 LInstruction* LChunkBuilder::DoCompareIDAndBranch( | 1414 LInstruction* LChunkBuilder::DoCompareIDAndBranch( |
1411 HCompareIDAndBranch* instr) { | 1415 HCompareIDAndBranch* instr) { |
1412 Representation r = instr->GetInputRepresentation(); | 1416 Representation r = instr->GetInputRepresentation(); |
1413 if (r.IsInteger32()) { | 1417 if (r.IsInteger32()) { |
1414 ASSERT(instr->left()->representation().IsInteger32()); | 1418 ASSERT(instr->left()->representation().IsInteger32()); |
1415 ASSERT(instr->right()->representation().IsInteger32()); | 1419 ASSERT(instr->right()->representation().IsInteger32()); |
1416 LOperand* left = UseRegisterAtStart(instr->left()); | 1420 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
1417 LOperand* right = UseOrConstantAtStart(instr->right()); | 1421 LOperand* right = UseOrConstantAtStart(instr->right()); |
1418 return new LCmpIDAndBranch(left, right); | 1422 return new LCmpIDAndBranch(left, right); |
1419 } else { | 1423 } else { |
1420 ASSERT(r.IsDouble()); | 1424 ASSERT(r.IsDouble()); |
1421 ASSERT(instr->left()->representation().IsDouble()); | 1425 ASSERT(instr->left()->representation().IsDouble()); |
1422 ASSERT(instr->right()->representation().IsDouble()); | 1426 ASSERT(instr->right()->representation().IsDouble()); |
1423 LOperand* left = UseRegisterAtStart(instr->left()); | 1427 LOperand* left; |
1424 LOperand* right = UseRegisterAtStart(instr->right()); | 1428 LOperand* right; |
| 1429 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { |
| 1430 left = UseRegisterOrConstantAtStart(instr->left()); |
| 1431 right = UseRegisterOrConstantAtStart(instr->right()); |
| 1432 } else { |
| 1433 left = UseRegisterAtStart(instr->left()); |
| 1434 right = UseRegisterAtStart(instr->right()); |
| 1435 } |
1425 return new LCmpIDAndBranch(left, right); | 1436 return new LCmpIDAndBranch(left, right); |
1426 } | 1437 } |
1427 } | 1438 } |
1428 | 1439 |
1429 | 1440 |
1430 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1441 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
1431 HCompareObjectEqAndBranch* instr) { | 1442 HCompareObjectEqAndBranch* instr) { |
1432 LOperand* left = UseRegisterAtStart(instr->left()); | 1443 LOperand* left = UseRegisterAtStart(instr->left()); |
1433 LOperand* right = UseRegisterAtStart(instr->right()); | 1444 LOperand* right = UseRegisterAtStart(instr->right()); |
1434 return new LCmpObjectEqAndBranch(left, right); | 1445 return new LCmpObjectEqAndBranch(left, right); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 | 1960 |
1950 ASSERT(instr->object()->representation().IsTagged()); | 1961 ASSERT(instr->object()->representation().IsTagged()); |
1951 ASSERT(instr->key()->representation().IsTagged()); | 1962 ASSERT(instr->key()->representation().IsTagged()); |
1952 ASSERT(instr->value()->representation().IsTagged()); | 1963 ASSERT(instr->value()->representation().IsTagged()); |
1953 | 1964 |
1954 LStoreKeyedGeneric* result = new LStoreKeyedGeneric(object, key, value); | 1965 LStoreKeyedGeneric* result = new LStoreKeyedGeneric(object, key, value); |
1955 return MarkAsCall(result, instr); | 1966 return MarkAsCall(result, instr); |
1956 } | 1967 } |
1957 | 1968 |
1958 | 1969 |
| 1970 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
| 1971 HTransitionElementsKind* instr) { |
| 1972 if (instr->original_map()->elements_kind() == FAST_SMI_ONLY_ELEMENTS && |
| 1973 instr->transitioned_map()->elements_kind() == FAST_ELEMENTS) { |
| 1974 LOperand* object = UseRegister(instr->object()); |
| 1975 LOperand* new_map_reg = TempRegister(); |
| 1976 LOperand* temp_reg = TempRegister(); |
| 1977 LTransitionElementsKind* result = |
| 1978 new LTransitionElementsKind(object, new_map_reg, temp_reg); |
| 1979 return DefineSameAsFirst(result); |
| 1980 } else { |
| 1981 LOperand* object = UseFixed(instr->object(), rax); |
| 1982 LOperand* fixed_object_reg = FixedTemp(rdx); |
| 1983 LOperand* new_map_reg = FixedTemp(rbx); |
| 1984 LTransitionElementsKind* result = |
| 1985 new LTransitionElementsKind(object, new_map_reg, fixed_object_reg); |
| 1986 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1987 } |
| 1988 } |
| 1989 |
| 1990 |
1959 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 1991 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
1960 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1992 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
1961 | 1993 |
1962 LOperand* obj = needs_write_barrier | 1994 LOperand* obj = needs_write_barrier |
1963 ? UseTempRegister(instr->object()) | 1995 ? UseTempRegister(instr->object()) |
1964 : UseRegisterAtStart(instr->object()); | 1996 : UseRegisterAtStart(instr->object()); |
1965 | 1997 |
1966 LOperand* val = needs_write_barrier | 1998 LOperand* val = needs_write_barrier |
1967 ? UseTempRegister(instr->value()) | 1999 ? UseTempRegister(instr->value()) |
1968 : UseRegister(instr->value()); | 2000 : UseRegister(instr->value()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2177 LOperand* key = UseOrConstantAtStart(instr->key()); | 2209 LOperand* key = UseOrConstantAtStart(instr->key()); |
2178 LOperand* object = UseOrConstantAtStart(instr->object()); | 2210 LOperand* object = UseOrConstantAtStart(instr->object()); |
2179 LIn* result = new LIn(key, object); | 2211 LIn* result = new LIn(key, object); |
2180 return MarkAsCall(DefineFixed(result, rax), instr); | 2212 return MarkAsCall(DefineFixed(result, rax), instr); |
2181 } | 2213 } |
2182 | 2214 |
2183 | 2215 |
2184 } } // namespace v8::internal | 2216 } } // namespace v8::internal |
2185 | 2217 |
2186 #endif // V8_TARGET_ARCH_X64 | 2218 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |