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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 1048 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
1049 LInstruction* result = new LGoto(instr->FirstSuccessor()->block_id(), | 1049 LInstruction* result = new LGoto(instr->FirstSuccessor()->block_id(), |
1050 instr->include_stack_check()); | 1050 instr->include_stack_check()); |
1051 if (instr->include_stack_check()) result = AssignPointerMap(result); | 1051 if (instr->include_stack_check()) result = AssignPointerMap(result); |
1052 return result; | 1052 return result; |
1053 } | 1053 } |
1054 | 1054 |
1055 | 1055 |
1056 LInstruction* LChunkBuilder::DoTest(HTest* instr) { | 1056 LInstruction* LChunkBuilder::DoTest(HTest* instr) { |
1057 HValue* v = instr->value(); | 1057 HValue* v = instr->value(); |
1058 if (!v->EmitAtUses()) { | 1058 if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v)); |
1059 return new LBranch(UseRegisterAtStart(v)); | 1059 ASSERT(!v->HasSideEffects()); |
1060 } else if (v->IsClassOfTest()) { | 1060 if (v->IsClassOfTest()) { |
1061 HClassOfTest* compare = HClassOfTest::cast(v); | 1061 HClassOfTest* compare = HClassOfTest::cast(v); |
1062 ASSERT(compare->value()->representation().IsTagged()); | 1062 ASSERT(compare->value()->representation().IsTagged()); |
1063 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), | 1063 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), |
1064 TempRegister()); | 1064 TempRegister()); |
1065 } else if (v->IsCompare()) { | 1065 } else if (v->IsCompare()) { |
1066 HCompare* compare = HCompare::cast(v); | 1066 HCompare* compare = HCompare::cast(v); |
1067 Token::Value op = compare->token(); | |
1068 HValue* left = compare->left(); | 1067 HValue* left = compare->left(); |
1069 HValue* right = compare->right(); | 1068 HValue* right = compare->right(); |
1070 Representation r = compare->GetInputRepresentation(); | 1069 Representation r = compare->GetInputRepresentation(); |
1071 if (r.IsInteger32()) { | 1070 if (r.IsInteger32()) { |
1072 ASSERT(left->representation().IsInteger32()); | 1071 ASSERT(left->representation().IsInteger32()); |
1073 ASSERT(right->representation().IsInteger32()); | 1072 ASSERT(right->representation().IsInteger32()); |
1074 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1073 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1075 UseRegisterAtStart(right)); | 1074 UseRegisterAtStart(right)); |
1076 } else if (r.IsDouble()) { | 1075 } else { |
| 1076 ASSERT(r.IsDouble()); |
1077 ASSERT(left->representation().IsDouble()); | 1077 ASSERT(left->representation().IsDouble()); |
1078 ASSERT(right->representation().IsDouble()); | 1078 ASSERT(right->representation().IsDouble()); |
1079 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1079 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1080 UseRegisterAtStart(right)); | 1080 UseRegisterAtStart(right)); |
1081 } else { | |
1082 ASSERT(left->representation().IsTagged()); | |
1083 ASSERT(right->representation().IsTagged()); | |
1084 bool reversed = op == Token::GT || op == Token::LTE; | |
1085 LOperand* left_operand = UseFixed(left, reversed ? r0 : r1); | |
1086 LOperand* right_operand = UseFixed(right, reversed ? r1 : r0); | |
1087 LInstruction* result = new LCmpTAndBranch(left_operand, right_operand); | |
1088 return MarkAsCall(result, instr); | |
1089 } | 1081 } |
1090 } else if (v->IsIsSmi()) { | 1082 } else if (v->IsIsSmi()) { |
1091 HIsSmi* compare = HIsSmi::cast(v); | 1083 HIsSmi* compare = HIsSmi::cast(v); |
1092 ASSERT(compare->value()->representation().IsTagged()); | 1084 ASSERT(compare->value()->representation().IsTagged()); |
1093 return new LIsSmiAndBranch(Use(compare->value())); | 1085 return new LIsSmiAndBranch(Use(compare->value())); |
1094 } else if (v->IsIsUndetectable()) { | 1086 } else if (v->IsIsUndetectable()) { |
1095 HIsUndetectable* compare = HIsUndetectable::cast(v); | 1087 HIsUndetectable* compare = HIsUndetectable::cast(v); |
1096 ASSERT(compare->value()->representation().IsTagged()); | 1088 ASSERT(compare->value()->representation().IsTagged()); |
1097 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), | 1089 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), |
1098 TempRegister()); | 1090 TempRegister()); |
(...skipping 16 matching lines...) Expand all Loading... |
1115 LOperand* temp = TempRegister(); | 1107 LOperand* temp = TempRegister(); |
1116 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), temp); | 1108 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), temp); |
1117 } else if (v->IsCompareJSObjectEq()) { | 1109 } else if (v->IsCompareJSObjectEq()) { |
1118 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1110 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
1119 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1111 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
1120 UseRegisterAtStart(compare->right())); | 1112 UseRegisterAtStart(compare->right())); |
1121 } else if (v->IsCompareSymbolEq()) { | 1113 } else if (v->IsCompareSymbolEq()) { |
1122 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); | 1114 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); |
1123 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), | 1115 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), |
1124 UseRegisterAtStart(compare->right())); | 1116 UseRegisterAtStart(compare->right())); |
1125 } else if (v->IsInstanceOf()) { | |
1126 HInstanceOf* instance_of = HInstanceOf::cast(v); | |
1127 LInstruction* result = | |
1128 new LInstanceOfAndBranch(UseFixed(instance_of->left(), r0), | |
1129 UseFixed(instance_of->right(), r1)); | |
1130 return MarkAsCall(result, instr); | |
1131 } else if (v->IsTypeofIs()) { | 1117 } else if (v->IsTypeofIs()) { |
1132 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1118 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
1133 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); | 1119 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); |
1134 } else if (v->IsIsConstructCall()) { | 1120 } else if (v->IsIsConstructCall()) { |
1135 return new LIsConstructCallAndBranch(TempRegister()); | 1121 return new LIsConstructCallAndBranch(TempRegister()); |
1136 } else if (v->IsConstant()) { | 1122 } else if (v->IsConstant()) { |
1137 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1123 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
1138 ? instr->FirstSuccessor() | 1124 ? instr->FirstSuccessor() |
1139 : instr->SecondSuccessor(); | 1125 : instr->SecondSuccessor(); |
1140 return new LGoto(successor->block_id()); | 1126 return new LGoto(successor->block_id()); |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 | 2226 |
2241 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2227 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2242 LOperand* key = UseRegisterAtStart(instr->key()); | 2228 LOperand* key = UseRegisterAtStart(instr->key()); |
2243 LOperand* object = UseRegisterAtStart(instr->object()); | 2229 LOperand* object = UseRegisterAtStart(instr->object()); |
2244 LIn* result = new LIn(key, object); | 2230 LIn* result = new LIn(key, object); |
2245 return MarkAsCall(DefineFixed(result, r0), instr); | 2231 return MarkAsCall(DefineFixed(result, r0), instr); |
2246 } | 2232 } |
2247 | 2233 |
2248 | 2234 |
2249 } } // namespace v8::internal | 2235 } } // namespace v8::internal |
OLD | NEW |