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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), | 950 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), |
951 TempRegister(), | 951 TempRegister(), |
952 TempRegister(), | 952 TempRegister(), |
953 first_id, | 953 first_id, |
954 second_id); | 954 second_id); |
955 } else if (v->IsCompare()) { | 955 } else if (v->IsCompare()) { |
956 HCompare* compare = HCompare::cast(v); | 956 HCompare* compare = HCompare::cast(v); |
957 Token::Value op = compare->token(); | 957 Token::Value op = compare->token(); |
958 HValue* left = compare->left(); | 958 HValue* left = compare->left(); |
959 HValue* right = compare->right(); | 959 HValue* right = compare->right(); |
960 if (left->representation().IsInteger32()) { | 960 Representation r = compare->GetInputRepresentation(); |
| 961 if (r.IsInteger32()) { |
| 962 ASSERT(left->representation().IsInteger32()); |
961 ASSERT(right->representation().IsInteger32()); | 963 ASSERT(right->representation().IsInteger32()); |
962 return new LCmpIDAndBranch(op, | 964 |
963 UseRegisterAtStart(left), | 965 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
964 UseOrConstantAtStart(right), | 966 UseOrConstantAtStart(right), |
965 first_id, | 967 first_id, |
966 second_id, | 968 second_id); |
967 false); | 969 } else if (r.IsDouble()) { |
968 } else if (left->representation().IsDouble()) { | 970 ASSERT(left->representation().IsDouble()); |
969 ASSERT(right->representation().IsDouble()); | 971 ASSERT(right->representation().IsDouble()); |
970 return new LCmpIDAndBranch(op, | 972 |
971 UseRegisterAtStart(left), | 973 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
972 UseRegisterAtStart(right), | 974 UseRegisterAtStart(right), |
973 first_id, | 975 first_id, |
974 second_id, | 976 second_id); |
975 true); | |
976 } else { | 977 } else { |
977 ASSERT(left->representation().IsTagged()); | 978 ASSERT(left->representation().IsTagged()); |
978 ASSERT(right->representation().IsTagged()); | 979 ASSERT(right->representation().IsTagged()); |
979 bool reversed = op == Token::GT || op == Token::LTE; | 980 bool reversed = op == Token::GT || op == Token::LTE; |
980 LOperand* left_operand = UseFixed(left, reversed ? eax : edx); | 981 LOperand* left_operand = UseFixed(left, reversed ? eax : edx); |
981 LOperand* right_operand = UseFixed(right, reversed ? edx : eax); | 982 LOperand* right_operand = UseFixed(right, reversed ? edx : eax); |
982 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, | 983 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, |
983 right_operand, | 984 right_operand, |
984 first_id, | 985 first_id, |
985 second_id); | 986 second_id); |
(...skipping 20 matching lines...) Expand all Loading... |
1006 | 1007 |
1007 return new LHasCachedArrayIndexAndBranch( | 1008 return new LHasCachedArrayIndexAndBranch( |
1008 UseRegisterAtStart(compare->value()), first_id, second_id); | 1009 UseRegisterAtStart(compare->value()), first_id, second_id); |
1009 } else if (v->IsIsNull()) { | 1010 } else if (v->IsIsNull()) { |
1010 HIsNull* compare = HIsNull::cast(v); | 1011 HIsNull* compare = HIsNull::cast(v); |
1011 ASSERT(compare->value()->representation().IsTagged()); | 1012 ASSERT(compare->value()->representation().IsTagged()); |
1012 | 1013 |
1013 // We only need a temp register for non-strict compare. | 1014 // We only need a temp register for non-strict compare. |
1014 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); | 1015 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); |
1015 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), | 1016 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), |
1016 compare->is_strict(), | |
1017 temp, | 1017 temp, |
1018 first_id, | 1018 first_id, |
1019 second_id); | 1019 second_id); |
1020 } else if (v->IsIsObject()) { | 1020 } else if (v->IsIsObject()) { |
1021 HIsObject* compare = HIsObject::cast(v); | 1021 HIsObject* compare = HIsObject::cast(v); |
1022 ASSERT(compare->value()->representation().IsTagged()); | 1022 ASSERT(compare->value()->representation().IsTagged()); |
1023 | 1023 |
1024 LOperand* temp1 = TempRegister(); | 1024 LOperand* temp1 = TempRegister(); |
1025 LOperand* temp2 = TempRegister(); | 1025 LOperand* temp2 = TempRegister(); |
1026 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), | 1026 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 UseFixedDouble(instr->right(), xmm2) : | 1372 UseFixedDouble(instr->right(), xmm2) : |
1373 UseFixed(instr->right(), eax); | 1373 UseFixed(instr->right(), eax); |
1374 LPower* result = new LPower(left, right); | 1374 LPower* result = new LPower(left, right); |
1375 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | 1375 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, |
1376 CAN_DEOPTIMIZE_EAGERLY); | 1376 CAN_DEOPTIMIZE_EAGERLY); |
1377 } | 1377 } |
1378 | 1378 |
1379 | 1379 |
1380 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { | 1380 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { |
1381 Token::Value op = instr->token(); | 1381 Token::Value op = instr->token(); |
1382 if (instr->left()->representation().IsInteger32()) { | 1382 Representation r = instr->GetInputRepresentation(); |
| 1383 if (r.IsInteger32()) { |
| 1384 ASSERT(instr->left()->representation().IsInteger32()); |
1383 ASSERT(instr->right()->representation().IsInteger32()); | 1385 ASSERT(instr->right()->representation().IsInteger32()); |
1384 LOperand* left = UseRegisterAtStart(instr->left()); | 1386 LOperand* left = UseRegisterAtStart(instr->left()); |
1385 LOperand* right = UseOrConstantAtStart(instr->right()); | 1387 LOperand* right = UseOrConstantAtStart(instr->right()); |
1386 return DefineAsRegister(new LCmpID(op, left, right, false)); | 1388 return DefineAsRegister(new LCmpID(left, right)); |
1387 } else if (instr->left()->representation().IsDouble()) { | 1389 } else if (r.IsDouble()) { |
| 1390 ASSERT(instr->left()->representation().IsDouble()); |
1388 ASSERT(instr->right()->representation().IsDouble()); | 1391 ASSERT(instr->right()->representation().IsDouble()); |
1389 LOperand* left = UseRegisterAtStart(instr->left()); | 1392 LOperand* left = UseRegisterAtStart(instr->left()); |
1390 LOperand* right = UseRegisterAtStart(instr->right()); | 1393 LOperand* right = UseRegisterAtStart(instr->right()); |
1391 return DefineAsRegister(new LCmpID(op, left, right, true)); | 1394 return DefineAsRegister(new LCmpID(left, right)); |
1392 } else { | 1395 } else { |
| 1396 ASSERT(instr->left()->representation().IsTagged()); |
| 1397 ASSERT(instr->right()->representation().IsTagged()); |
1393 bool reversed = (op == Token::GT || op == Token::LTE); | 1398 bool reversed = (op == Token::GT || op == Token::LTE); |
1394 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); | 1399 LOperand* left = UseFixed(instr->left(), reversed ? eax : edx); |
1395 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); | 1400 LOperand* right = UseFixed(instr->right(), reversed ? edx : eax); |
1396 LCmpT* result = new LCmpT(left, right); | 1401 LCmpT* result = new LCmpT(left, right); |
1397 return MarkAsCall(DefineFixed(result, eax), instr); | 1402 return MarkAsCall(DefineFixed(result, eax), instr); |
1398 } | 1403 } |
1399 } | 1404 } |
1400 | 1405 |
1401 | 1406 |
1402 LInstruction* LChunkBuilder::DoCompareJSObjectEq( | 1407 LInstruction* LChunkBuilder::DoCompareJSObjectEq( |
1403 HCompareJSObjectEq* instr) { | 1408 HCompareJSObjectEq* instr) { |
1404 LOperand* left = UseRegisterAtStart(instr->left()); | 1409 LOperand* left = UseRegisterAtStart(instr->left()); |
1405 LOperand* right = UseRegisterAtStart(instr->right()); | 1410 LOperand* right = UseRegisterAtStart(instr->right()); |
1406 LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); | 1411 LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); |
1407 return DefineAsRegister(result); | 1412 return DefineAsRegister(result); |
1408 } | 1413 } |
1409 | 1414 |
1410 | 1415 |
1411 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { | 1416 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
1412 ASSERT(instr->value()->representation().IsTagged()); | 1417 ASSERT(instr->value()->representation().IsTagged()); |
1413 LOperand* value = UseRegisterAtStart(instr->value()); | 1418 LOperand* value = UseRegisterAtStart(instr->value()); |
1414 | 1419 |
1415 return DefineAsRegister(new LIsNull(value, | 1420 return DefineAsRegister(new LIsNull(value)); |
1416 instr->is_strict())); | |
1417 } | 1421 } |
1418 | 1422 |
1419 | 1423 |
1420 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { | 1424 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { |
1421 ASSERT(instr->value()->representation().IsTagged()); | 1425 ASSERT(instr->value()->representation().IsTagged()); |
1422 LOperand* value = UseRegister(instr->value()); | 1426 LOperand* value = UseRegister(instr->value()); |
1423 | 1427 |
1424 return DefineAsRegister(new LIsObject(value, TempRegister())); | 1428 return DefineAsRegister(new LIsObject(value, TempRegister())); |
1425 } | 1429 } |
1426 | 1430 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1863 | 1867 |
1864 | 1868 |
1865 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1869 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
1866 HEnvironment* outer = current_block_->last_environment()->outer(); | 1870 HEnvironment* outer = current_block_->last_environment()->outer(); |
1867 current_block_->UpdateEnvironment(outer); | 1871 current_block_->UpdateEnvironment(outer); |
1868 return NULL; | 1872 return NULL; |
1869 } | 1873 } |
1870 | 1874 |
1871 | 1875 |
1872 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
OLD | NEW |