Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2550683003: [stubs] Cleanup usages of CSA::Select(). (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 __ Word32Equal(lhs_instance_type, __ Int32Constant(ODDBALL_TYPE)), 1051 __ Word32Equal(lhs_instance_type, __ Int32Constant(ODDBALL_TYPE)),
1052 &lhs_is_not_oddball); 1052 &lhs_is_not_oddball);
1053 1053
1054 var_type_feedback.Bind( 1054 var_type_feedback.Bind(
1055 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball)); 1055 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball));
1056 __ Goto(&gather_rhs_type); 1056 __ Goto(&gather_rhs_type);
1057 1057
1058 __ Bind(&lhs_is_not_oddball); 1058 __ Bind(&lhs_is_not_oddball);
1059 } 1059 }
1060 1060
1061 var_type_feedback.Bind( 1061 var_type_feedback.Bind(__ SelectInt32Constant(
1062 __ Select(__ IsStringInstanceType(lhs_instance_type), 1062 __ IsStringInstanceType(lhs_instance_type),
1063 __ Int32Constant(CompareOperationFeedback::kString), 1063 CompareOperationFeedback::kString, CompareOperationFeedback::kAny));
1064 __ Int32Constant(CompareOperationFeedback::kAny)));
1065 __ Goto(&gather_rhs_type); 1064 __ Goto(&gather_rhs_type);
1066 } 1065 }
1067 } 1066 }
1068 1067
1069 __ Bind(&gather_rhs_type); 1068 __ Bind(&gather_rhs_type);
1070 { 1069 {
1071 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler); 1070 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler);
1072 1071
1073 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi); 1072 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi);
1074 1073
(...skipping 24 matching lines...) Expand all
1099 var_type_feedback.Bind(__ Word32Or( 1098 var_type_feedback.Bind(__ Word32Or(
1100 var_type_feedback.value(), 1099 var_type_feedback.value(),
1101 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball))); 1100 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball)));
1102 __ Goto(&update_feedback); 1101 __ Goto(&update_feedback);
1103 1102
1104 __ Bind(&rhs_is_not_oddball); 1103 __ Bind(&rhs_is_not_oddball);
1105 } 1104 }
1106 1105
1107 var_type_feedback.Bind(__ Word32Or( 1106 var_type_feedback.Bind(__ Word32Or(
1108 var_type_feedback.value(), 1107 var_type_feedback.value(),
1109 __ Select(__ IsStringInstanceType(rhs_instance_type), 1108 __ SelectInt32Constant(__ IsStringInstanceType(rhs_instance_type),
1110 __ Int32Constant(CompareOperationFeedback::kString), 1109 CompareOperationFeedback::kString,
1111 __ Int32Constant(CompareOperationFeedback::kAny)))); 1110 CompareOperationFeedback::kAny)));
1112 __ Goto(&update_feedback); 1111 __ Goto(&update_feedback);
1113 } 1112 }
1114 } 1113 }
1115 } 1114 }
1116 1115
1117 __ Bind(&update_feedback); 1116 __ Bind(&update_feedback);
1118 { 1117 {
1119 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector, 1118 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
1120 slot_index); 1119 slot_index);
1121 __ Goto(&do_compare); 1120 __ Goto(&do_compare);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } break; 1236 } break;
1238 case Token::SAR: { 1237 case Token::SAR: {
1239 Node* value = __ Word32Sar( 1238 Node* value = __ Word32Sar(
1240 lhs_value, __ Word32And(rhs_value, __ Int32Constant(0x1f))); 1239 lhs_value, __ Word32And(rhs_value, __ Int32Constant(0x1f)));
1241 result = __ ChangeInt32ToTagged(value); 1240 result = __ ChangeInt32ToTagged(value);
1242 } break; 1241 } break;
1243 default: 1242 default:
1244 UNREACHABLE(); 1243 UNREACHABLE();
1245 } 1244 }
1246 1245
1247 Node* result_type = 1246 Node* result_type = __ SelectInt32Constant(
1248 __ Select(__ TaggedIsSmi(result), 1247 __ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
1249 __ Int32Constant(BinaryOperationFeedback::kSignedSmall), 1248 BinaryOperationFeedback::kNumber);
1250 __ Int32Constant(BinaryOperationFeedback::kNumber));
1251 1249
1252 if (FLAG_debug_code) { 1250 if (FLAG_debug_code) {
1253 Label ok(assembler); 1251 Label ok(assembler);
1254 __ GotoIf(__ TaggedIsSmi(result), &ok); 1252 __ GotoIf(__ TaggedIsSmi(result), &ok);
1255 Node* result_map = __ LoadMap(result); 1253 Node* result_map = __ LoadMap(result);
1256 __ AbortIfWordNotEqual(result_map, __ HeapNumberMapConstant(), 1254 __ AbortIfWordNotEqual(result_map, __ HeapNumberMapConstant(),
1257 kExpectedHeapNumber); 1255 kExpectedHeapNumber);
1258 __ Goto(&ok); 1256 __ Goto(&ok);
1259 __ Bind(&ok); 1257 __ Bind(&ok);
1260 } 1258 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 Node* right = __ SmiTag(raw_int); 1435 Node* right = __ SmiTag(raw_int);
1438 Node* context = __ GetContext(); 1436 Node* context = __ GetContext();
1439 Node* slot_index = __ BytecodeOperandIdx(2); 1437 Node* slot_index = __ BytecodeOperandIdx(2);
1440 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 1438 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
1441 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32); 1439 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
1442 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback( 1440 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
1443 context, left, &var_lhs_type_feedback); 1441 context, left, &var_lhs_type_feedback);
1444 Node* rhs_value = __ SmiToWord32(right); 1442 Node* rhs_value = __ SmiToWord32(right);
1445 Node* value = __ Word32Or(lhs_value, rhs_value); 1443 Node* value = __ Word32Or(lhs_value, rhs_value);
1446 Node* result = __ ChangeInt32ToTagged(value); 1444 Node* result = __ ChangeInt32ToTagged(value);
1447 Node* result_type = 1445 Node* result_type = __ SelectInt32Constant(
1448 __ Select(__ TaggedIsSmi(result), 1446 __ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
1449 __ Int32Constant(BinaryOperationFeedback::kSignedSmall), 1447 BinaryOperationFeedback::kNumber);
1450 __ Int32Constant(BinaryOperationFeedback::kNumber));
1451 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()), 1448 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
1452 type_feedback_vector, slot_index); 1449 type_feedback_vector, slot_index);
1453 __ SetAccumulator(result); 1450 __ SetAccumulator(result);
1454 __ Dispatch(); 1451 __ Dispatch();
1455 } 1452 }
1456 1453
1457 // BitwiseAnd <imm> <reg> 1454 // BitwiseAnd <imm> <reg>
1458 // 1455 //
1459 // BitwiseAnd <reg> with <imm>. For this operation <reg> is the lhs 1456 // BitwiseAnd <reg> with <imm>. For this operation <reg> is the lhs
1460 // operand and <imm> is the rhs operand. 1457 // operand and <imm> is the rhs operand.
1461 void Interpreter::DoBitwiseAndSmi(InterpreterAssembler* assembler) { 1458 void Interpreter::DoBitwiseAndSmi(InterpreterAssembler* assembler) {
1462 Node* reg_index = __ BytecodeOperandReg(1); 1459 Node* reg_index = __ BytecodeOperandReg(1);
1463 Node* left = __ LoadRegister(reg_index); 1460 Node* left = __ LoadRegister(reg_index);
1464 Node* raw_int = __ BytecodeOperandImm(0); 1461 Node* raw_int = __ BytecodeOperandImm(0);
1465 Node* right = __ SmiTag(raw_int); 1462 Node* right = __ SmiTag(raw_int);
1466 Node* context = __ GetContext(); 1463 Node* context = __ GetContext();
1467 Node* slot_index = __ BytecodeOperandIdx(2); 1464 Node* slot_index = __ BytecodeOperandIdx(2);
1468 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 1465 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
1469 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32); 1466 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
1470 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback( 1467 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
1471 context, left, &var_lhs_type_feedback); 1468 context, left, &var_lhs_type_feedback);
1472 Node* rhs_value = __ SmiToWord32(right); 1469 Node* rhs_value = __ SmiToWord32(right);
1473 Node* value = __ Word32And(lhs_value, rhs_value); 1470 Node* value = __ Word32And(lhs_value, rhs_value);
1474 Node* result = __ ChangeInt32ToTagged(value); 1471 Node* result = __ ChangeInt32ToTagged(value);
1475 Node* result_type = 1472 Node* result_type = __ SelectInt32Constant(
1476 __ Select(__ TaggedIsSmi(result), 1473 __ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
1477 __ Int32Constant(BinaryOperationFeedback::kSignedSmall), 1474 BinaryOperationFeedback::kNumber);
1478 __ Int32Constant(BinaryOperationFeedback::kNumber));
1479 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()), 1475 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
1480 type_feedback_vector, slot_index); 1476 type_feedback_vector, slot_index);
1481 __ SetAccumulator(result); 1477 __ SetAccumulator(result);
1482 __ Dispatch(); 1478 __ Dispatch();
1483 } 1479 }
1484 1480
1485 // ShiftLeftSmi <imm> <reg> 1481 // ShiftLeftSmi <imm> <reg>
1486 // 1482 //
1487 // Left shifts register <src> by the count specified in <imm>. 1483 // Left shifts register <src> by the count specified in <imm>.
1488 // Register <src> is converted to an int32 before the operation. The 5 1484 // Register <src> is converted to an int32 before the operation. The 5
1489 // lsb bits from <imm> are used as count i.e. <src> << (<imm> & 0x1F). 1485 // lsb bits from <imm> are used as count i.e. <src> << (<imm> & 0x1F).
1490 void Interpreter::DoShiftLeftSmi(InterpreterAssembler* assembler) { 1486 void Interpreter::DoShiftLeftSmi(InterpreterAssembler* assembler) {
1491 Node* reg_index = __ BytecodeOperandReg(1); 1487 Node* reg_index = __ BytecodeOperandReg(1);
1492 Node* left = __ LoadRegister(reg_index); 1488 Node* left = __ LoadRegister(reg_index);
1493 Node* raw_int = __ BytecodeOperandImm(0); 1489 Node* raw_int = __ BytecodeOperandImm(0);
1494 Node* right = __ SmiTag(raw_int); 1490 Node* right = __ SmiTag(raw_int);
1495 Node* context = __ GetContext(); 1491 Node* context = __ GetContext();
1496 Node* slot_index = __ BytecodeOperandIdx(2); 1492 Node* slot_index = __ BytecodeOperandIdx(2);
1497 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 1493 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
1498 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32); 1494 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
1499 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback( 1495 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
1500 context, left, &var_lhs_type_feedback); 1496 context, left, &var_lhs_type_feedback);
1501 Node* rhs_value = __ SmiToWord32(right); 1497 Node* rhs_value = __ SmiToWord32(right);
1502 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f)); 1498 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f));
1503 Node* value = __ Word32Shl(lhs_value, shift_count); 1499 Node* value = __ Word32Shl(lhs_value, shift_count);
1504 Node* result = __ ChangeInt32ToTagged(value); 1500 Node* result = __ ChangeInt32ToTagged(value);
1505 Node* result_type = 1501 Node* result_type = __ SelectInt32Constant(
1506 __ Select(__ TaggedIsSmi(result), 1502 __ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
1507 __ Int32Constant(BinaryOperationFeedback::kSignedSmall), 1503 BinaryOperationFeedback::kNumber);
1508 __ Int32Constant(BinaryOperationFeedback::kNumber));
1509 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()), 1504 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
1510 type_feedback_vector, slot_index); 1505 type_feedback_vector, slot_index);
1511 __ SetAccumulator(result); 1506 __ SetAccumulator(result);
1512 __ Dispatch(); 1507 __ Dispatch();
1513 } 1508 }
1514 1509
1515 // ShiftRightSmi <imm> <reg> 1510 // ShiftRightSmi <imm> <reg>
1516 // 1511 //
1517 // Right shifts register <src> by the count specified in <imm>. 1512 // Right shifts register <src> by the count specified in <imm>.
1518 // Register <src> is converted to an int32 before the operation. The 5 1513 // Register <src> is converted to an int32 before the operation. The 5
1519 // lsb bits from <imm> are used as count i.e. <src> << (<imm> & 0x1F). 1514 // lsb bits from <imm> are used as count i.e. <src> << (<imm> & 0x1F).
1520 void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) { 1515 void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) {
1521 Node* reg_index = __ BytecodeOperandReg(1); 1516 Node* reg_index = __ BytecodeOperandReg(1);
1522 Node* left = __ LoadRegister(reg_index); 1517 Node* left = __ LoadRegister(reg_index);
1523 Node* raw_int = __ BytecodeOperandImm(0); 1518 Node* raw_int = __ BytecodeOperandImm(0);
1524 Node* right = __ SmiTag(raw_int); 1519 Node* right = __ SmiTag(raw_int);
1525 Node* context = __ GetContext(); 1520 Node* context = __ GetContext();
1526 Node* slot_index = __ BytecodeOperandIdx(2); 1521 Node* slot_index = __ BytecodeOperandIdx(2);
1527 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); 1522 Node* type_feedback_vector = __ LoadTypeFeedbackVector();
1528 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32); 1523 Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
1529 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback( 1524 Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
1530 context, left, &var_lhs_type_feedback); 1525 context, left, &var_lhs_type_feedback);
1531 Node* rhs_value = __ SmiToWord32(right); 1526 Node* rhs_value = __ SmiToWord32(right);
1532 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f)); 1527 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f));
1533 Node* value = __ Word32Sar(lhs_value, shift_count); 1528 Node* value = __ Word32Sar(lhs_value, shift_count);
1534 Node* result = __ ChangeInt32ToTagged(value); 1529 Node* result = __ ChangeInt32ToTagged(value);
1535 Node* result_type = 1530 Node* result_type = __ SelectInt32Constant(
1536 __ Select(__ TaggedIsSmi(result), 1531 __ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
1537 __ Int32Constant(BinaryOperationFeedback::kSignedSmall), 1532 BinaryOperationFeedback::kNumber);
1538 __ Int32Constant(BinaryOperationFeedback::kNumber));
1539 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()), 1533 __ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
1540 type_feedback_vector, slot_index); 1534 type_feedback_vector, slot_index);
1541 __ SetAccumulator(result); 1535 __ SetAccumulator(result);
1542 __ Dispatch(); 1536 __ Dispatch();
1543 } 1537 }
1544 1538
1545 Node* Interpreter::BuildUnaryOp(Callable callable, 1539 Node* Interpreter::BuildUnaryOp(Callable callable,
1546 InterpreterAssembler* assembler) { 1540 InterpreterAssembler* assembler) {
1547 Node* target = __ HeapConstant(callable.code()); 1541 Node* target = __ HeapConstant(callable.code());
1548 Node* accumulator = __ GetAccumulator(); 1542 Node* accumulator = __ GetAccumulator();
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2771 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2778 __ SmiTag(new_state)); 2772 __ SmiTag(new_state));
2779 __ SetAccumulator(old_state); 2773 __ SetAccumulator(old_state);
2780 2774
2781 __ Dispatch(); 2775 __ Dispatch();
2782 } 2776 }
2783 2777
2784 } // namespace interpreter 2778 } // namespace interpreter
2785 } // namespace internal 2779 } // namespace internal
2786 } // namespace v8 2780 } // namespace v8
OLDNEW
« src/builtins/builtins-regexp.cc ('K') | « src/compiler/code-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698