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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), | 1044 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), |
1045 instr->include_stack_check()); | 1045 instr->include_stack_check()); |
1046 return (instr->include_stack_check()) | 1046 return (instr->include_stack_check()) |
1047 ? AssignPointerMap(result) | 1047 ? AssignPointerMap(result) |
1048 : result; | 1048 : result; |
1049 } | 1049 } |
1050 | 1050 |
1051 | 1051 |
1052 LInstruction* LChunkBuilder::DoTest(HTest* instr) { | 1052 LInstruction* LChunkBuilder::DoTest(HTest* instr) { |
1053 HValue* v = instr->value(); | 1053 HValue* v = instr->value(); |
1054 if (!v->EmitAtUses()) { | 1054 if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v)); |
1055 return new LBranch(UseRegisterAtStart(v)); | 1055 ASSERT(!v->HasSideEffects()); |
1056 } else if (v->IsClassOfTest()) { | 1056 if (v->IsClassOfTest()) { |
1057 HClassOfTest* compare = HClassOfTest::cast(v); | 1057 HClassOfTest* compare = HClassOfTest::cast(v); |
1058 ASSERT(compare->value()->representation().IsTagged()); | 1058 ASSERT(compare->value()->representation().IsTagged()); |
1059 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), | 1059 return new LClassOfTestAndBranch(UseTempRegister(compare->value()), |
1060 TempRegister(), | 1060 TempRegister(), |
1061 TempRegister()); | 1061 TempRegister()); |
1062 } else if (v->IsCompare()) { | 1062 } else if (v->IsCompare()) { |
1063 HCompare* compare = HCompare::cast(v); | 1063 HCompare* compare = HCompare::cast(v); |
1064 Token::Value op = compare->token(); | |
1065 HValue* left = compare->left(); | 1064 HValue* left = compare->left(); |
1066 HValue* right = compare->right(); | 1065 HValue* right = compare->right(); |
1067 Representation r = compare->GetInputRepresentation(); | 1066 Representation r = compare->GetInputRepresentation(); |
1068 if (r.IsInteger32()) { | 1067 if (r.IsInteger32()) { |
1069 ASSERT(left->representation().IsInteger32()); | 1068 ASSERT(left->representation().IsInteger32()); |
1070 ASSERT(right->representation().IsInteger32()); | 1069 ASSERT(right->representation().IsInteger32()); |
1071 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1070 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1072 UseOrConstantAtStart(right)); | 1071 UseOrConstantAtStart(right)); |
1073 } else if (r.IsDouble()) { | 1072 } else { |
| 1073 ASSERT(r.IsDouble()); |
1074 ASSERT(left->representation().IsDouble()); | 1074 ASSERT(left->representation().IsDouble()); |
1075 ASSERT(right->representation().IsDouble()); | 1075 ASSERT(right->representation().IsDouble()); |
1076 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1076 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1077 UseRegisterAtStart(right)); | 1077 UseRegisterAtStart(right)); |
1078 } else { | |
1079 ASSERT(left->representation().IsTagged()); | |
1080 ASSERT(right->representation().IsTagged()); | |
1081 bool reversed = op == Token::GT || op == Token::LTE; | |
1082 LOperand* left_operand = UseFixed(left, reversed ? eax : edx); | |
1083 LOperand* right_operand = UseFixed(right, reversed ? edx : eax); | |
1084 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, right_operand); | |
1085 return MarkAsCall(result, instr); | |
1086 } | 1078 } |
1087 } else if (v->IsIsSmi()) { | 1079 } else if (v->IsIsSmi()) { |
1088 HIsSmi* compare = HIsSmi::cast(v); | 1080 HIsSmi* compare = HIsSmi::cast(v); |
1089 ASSERT(compare->value()->representation().IsTagged()); | 1081 ASSERT(compare->value()->representation().IsTagged()); |
1090 return new LIsSmiAndBranch(Use(compare->value())); | 1082 return new LIsSmiAndBranch(Use(compare->value())); |
1091 } else if (v->IsIsUndetectable()) { | 1083 } else if (v->IsIsUndetectable()) { |
1092 HIsUndetectable* compare = HIsUndetectable::cast(v); | 1084 HIsUndetectable* compare = HIsUndetectable::cast(v); |
1093 ASSERT(compare->value()->representation().IsTagged()); | 1085 ASSERT(compare->value()->representation().IsTagged()); |
1094 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), | 1086 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), |
1095 TempRegister()); | 1087 TempRegister()); |
(...skipping 22 matching lines...) Expand all Loading... |
1118 temp1, | 1110 temp1, |
1119 temp2); | 1111 temp2); |
1120 } else if (v->IsCompareJSObjectEq()) { | 1112 } else if (v->IsCompareJSObjectEq()) { |
1121 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1113 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
1122 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1114 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
1123 UseRegisterAtStart(compare->right())); | 1115 UseRegisterAtStart(compare->right())); |
1124 } else if (v->IsCompareSymbolEq()) { | 1116 } else if (v->IsCompareSymbolEq()) { |
1125 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); | 1117 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); |
1126 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), | 1118 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), |
1127 UseRegisterAtStart(compare->right())); | 1119 UseRegisterAtStart(compare->right())); |
1128 } else if (v->IsInstanceOf()) { | |
1129 HInstanceOf* instance_of = HInstanceOf::cast(v); | |
1130 LOperand* left = UseFixed(instance_of->left(), InstanceofStub::left()); | |
1131 LOperand* right = UseFixed(instance_of->right(), InstanceofStub::right()); | |
1132 LOperand* context = UseFixed(instance_of->context(), esi); | |
1133 LInstanceOfAndBranch* result = | |
1134 new LInstanceOfAndBranch(context, left, right); | |
1135 return MarkAsCall(result, instr); | |
1136 } else if (v->IsTypeofIs()) { | 1120 } else if (v->IsTypeofIs()) { |
1137 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1121 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
1138 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); | 1122 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); |
1139 } else if (v->IsIsConstructCall()) { | 1123 } else if (v->IsIsConstructCall()) { |
1140 return new LIsConstructCallAndBranch(TempRegister()); | 1124 return new LIsConstructCallAndBranch(TempRegister()); |
1141 } else if (v->IsConstant()) { | 1125 } else if (v->IsConstant()) { |
1142 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1126 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
1143 ? instr->FirstSuccessor() | 1127 ? instr->FirstSuccessor() |
1144 : instr->SecondSuccessor(); | 1128 : instr->SecondSuccessor(); |
1145 return new LGoto(successor->block_id()); | 1129 return new LGoto(successor->block_id()); |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 LOperand* key = UseOrConstantAtStart(instr->key()); | 2280 LOperand* key = UseOrConstantAtStart(instr->key()); |
2297 LOperand* object = UseOrConstantAtStart(instr->object()); | 2281 LOperand* object = UseOrConstantAtStart(instr->object()); |
2298 LIn* result = new LIn(key, object); | 2282 LIn* result = new LIn(key, object); |
2299 return MarkAsCall(DefineFixed(result, eax), instr); | 2283 return MarkAsCall(DefineFixed(result, eax), instr); |
2300 } | 2284 } |
2301 | 2285 |
2302 | 2286 |
2303 } } // namespace v8::internal | 2287 } } // namespace v8::internal |
2304 | 2288 |
2305 #endif // V8_TARGET_ARCH_IA32 | 2289 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |