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 } else if (v->IsCompare()) { | 1061 } else if (v->IsCompare()) { |
1062 HCompare* compare = HCompare::cast(v); | 1062 HCompare* compare = HCompare::cast(v); |
1063 Token::Value op = compare->token(); | |
1064 HValue* left = compare->left(); | 1063 HValue* left = compare->left(); |
1065 HValue* right = compare->right(); | 1064 HValue* right = compare->right(); |
1066 Representation r = compare->GetInputRepresentation(); | 1065 Representation r = compare->GetInputRepresentation(); |
1067 if (r.IsInteger32()) { | 1066 if (r.IsInteger32()) { |
1068 ASSERT(left->representation().IsInteger32()); | 1067 ASSERT(left->representation().IsInteger32()); |
1069 ASSERT(right->representation().IsInteger32()); | 1068 ASSERT(right->representation().IsInteger32()); |
1070 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1069 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1071 UseOrConstantAtStart(right)); | 1070 UseOrConstantAtStart(right)); |
1072 } else if (r.IsDouble()) { | 1071 } else { |
| 1072 ASSERT(r.IsDouble()); |
1073 ASSERT(left->representation().IsDouble()); | 1073 ASSERT(left->representation().IsDouble()); |
1074 ASSERT(right->representation().IsDouble()); | 1074 ASSERT(right->representation().IsDouble()); |
1075 return new LCmpIDAndBranch(UseRegisterAtStart(left), | 1075 return new LCmpIDAndBranch(UseRegisterAtStart(left), |
1076 UseRegisterAtStart(right)); | 1076 UseRegisterAtStart(right)); |
1077 } else { | |
1078 ASSERT(left->representation().IsTagged()); | |
1079 ASSERT(right->representation().IsTagged()); | |
1080 bool reversed = op == Token::GT || op == Token::LTE; | |
1081 LOperand* left_operand = UseFixed(left, reversed ? rax : rdx); | |
1082 LOperand* right_operand = UseFixed(right, reversed ? rdx : rax); | |
1083 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, right_operand); | |
1084 return MarkAsCall(result, instr); | |
1085 } | 1077 } |
1086 } else if (v->IsIsSmi()) { | 1078 } else if (v->IsIsSmi()) { |
1087 HIsSmi* compare = HIsSmi::cast(v); | 1079 HIsSmi* compare = HIsSmi::cast(v); |
1088 ASSERT(compare->value()->representation().IsTagged()); | 1080 ASSERT(compare->value()->representation().IsTagged()); |
1089 return new LIsSmiAndBranch(Use(compare->value())); | 1081 return new LIsSmiAndBranch(Use(compare->value())); |
1090 } else if (v->IsIsUndetectable()) { | 1082 } else if (v->IsIsUndetectable()) { |
1091 HIsUndetectable* compare = HIsUndetectable::cast(v); | 1083 HIsUndetectable* compare = HIsUndetectable::cast(v); |
1092 ASSERT(compare->value()->representation().IsTagged()); | 1084 ASSERT(compare->value()->representation().IsTagged()); |
1093 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), | 1085 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), |
1094 TempRegister()); | 1086 TempRegister()); |
(...skipping 17 matching lines...) Expand all Loading... |
1112 ASSERT(compare->value()->representation().IsTagged()); | 1104 ASSERT(compare->value()->representation().IsTagged()); |
1113 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value())); | 1105 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value())); |
1114 } else if (v->IsCompareJSObjectEq()) { | 1106 } else if (v->IsCompareJSObjectEq()) { |
1115 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1107 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
1116 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1108 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
1117 UseRegisterAtStart(compare->right())); | 1109 UseRegisterAtStart(compare->right())); |
1118 } else if (v->IsCompareSymbolEq()) { | 1110 } else if (v->IsCompareSymbolEq()) { |
1119 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); | 1111 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); |
1120 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), | 1112 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), |
1121 UseRegisterAtStart(compare->right())); | 1113 UseRegisterAtStart(compare->right())); |
1122 } else if (v->IsInstanceOf()) { | |
1123 HInstanceOf* instance_of = HInstanceOf::cast(v); | |
1124 LInstanceOfAndBranch* result = | |
1125 new LInstanceOfAndBranch(UseFixed(instance_of->left(), rax), | |
1126 UseFixed(instance_of->right(), rdx)); | |
1127 return MarkAsCall(result, instr); | |
1128 } else if (v->IsTypeofIs()) { | 1114 } else if (v->IsTypeofIs()) { |
1129 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1115 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
1130 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); | 1116 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value())); |
1131 } else if (v->IsIsConstructCall()) { | 1117 } else if (v->IsIsConstructCall()) { |
1132 return new LIsConstructCallAndBranch(TempRegister()); | 1118 return new LIsConstructCallAndBranch(TempRegister()); |
1133 } else if (v->IsConstant()) { | 1119 } else if (v->IsConstant()) { |
1134 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() | 1120 HBasicBlock* successor = HConstant::cast(v)->ToBoolean() |
1135 ? instr->FirstSuccessor() | 1121 ? instr->FirstSuccessor() |
1136 : instr->SecondSuccessor(); | 1122 : instr->SecondSuccessor(); |
1137 return new LGoto(successor->block_id()); | 1123 return new LGoto(successor->block_id()); |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 LOperand* key = UseOrConstantAtStart(instr->key()); | 2220 LOperand* key = UseOrConstantAtStart(instr->key()); |
2235 LOperand* object = UseOrConstantAtStart(instr->object()); | 2221 LOperand* object = UseOrConstantAtStart(instr->object()); |
2236 LIn* result = new LIn(key, object); | 2222 LIn* result = new LIn(key, object); |
2237 return MarkAsCall(DefineFixed(result, rax), instr); | 2223 return MarkAsCall(DefineFixed(result, rax), instr); |
2238 } | 2224 } |
2239 | 2225 |
2240 | 2226 |
2241 } } // namespace v8::internal | 2227 } } // namespace v8::internal |
2242 | 2228 |
2243 #endif // V8_TARGET_ARCH_X64 | 2229 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |