OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 | 199 |
200 | 200 |
201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const { | 201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const { |
202 stream->Add("if "); | 202 stream->Add("if "); |
203 input()->PrintTo(stream); | 203 input()->PrintTo(stream); |
204 stream->Add(is_strict() ? " === null" : " == null"); | 204 stream->Add(is_strict() ? " === null" : " == null"); |
205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) const { | |
210 stream->Add("if is_object("); | |
211 input()->PrintTo(stream); | |
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | |
213 } | |
214 | |
215 | |
209 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const { | 216 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const { |
210 stream->Add("if is_smi("); | 217 stream->Add("if is_smi("); |
211 input()->PrintTo(stream); | 218 input()->PrintTo(stream); |
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 219 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
213 } | 220 } |
214 | 221 |
215 | 222 |
216 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const { | 223 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const { |
217 stream->Add("if has_instance_type("); | 224 stream->Add("if has_instance_type("); |
218 input()->PrintTo(stream); | 225 input()->PrintTo(stream); |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 HIsNull* compare = HIsNull::cast(v); | 1238 HIsNull* compare = HIsNull::cast(v); |
1232 ASSERT(compare->value()->representation().IsTagged()); | 1239 ASSERT(compare->value()->representation().IsTagged()); |
1233 | 1240 |
1234 // We only need a temp register for non-strict compare. | 1241 // We only need a temp register for non-strict compare. |
1235 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); | 1242 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); |
1236 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), | 1243 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), |
1237 compare->is_strict(), | 1244 compare->is_strict(), |
1238 temp, | 1245 temp, |
1239 first_id, | 1246 first_id, |
1240 second_id); | 1247 second_id); |
1248 } else if (v->IsIsObject()) { | |
1249 HIsObject* compare = HIsObject::cast(v); | |
1250 ASSERT(compare->value()->representation().IsTagged()); | |
1251 | |
1252 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), | |
Kevin Millikin (Chromium)
2010/12/15 11:45:38
Since evaluation order is unspecified and we want
| |
1253 TempRegister(), | |
1254 TempRegister(), | |
1255 first_id, | |
1256 second_id); | |
1241 } else if (v->IsCompareJSObjectEq()) { | 1257 } else if (v->IsCompareJSObjectEq()) { |
1242 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1258 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
1243 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1259 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
1244 UseRegisterAtStart(compare->right()), | 1260 UseRegisterAtStart(compare->right()), |
1245 first_id, | 1261 first_id, |
1246 second_id); | 1262 second_id); |
1247 } else if (v->IsInstanceOf()) { | 1263 } else if (v->IsInstanceOf()) { |
1248 HInstanceOf* instance_of = HInstanceOf::cast(v); | 1264 HInstanceOf* instance_of = HInstanceOf::cast(v); |
1249 LInstruction* result = | 1265 LInstruction* result = |
1250 new LInstanceOfAndBranch(Use(instance_of->left()), | 1266 new LInstanceOfAndBranch(Use(instance_of->left()), |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1590 | 1606 |
1591 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { | 1607 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
1592 ASSERT(instr->value()->representation().IsTagged()); | 1608 ASSERT(instr->value()->representation().IsTagged()); |
1593 LOperand* value = UseRegisterAtStart(instr->value()); | 1609 LOperand* value = UseRegisterAtStart(instr->value()); |
1594 | 1610 |
1595 return DefineAsRegister(new LIsNull(value, | 1611 return DefineAsRegister(new LIsNull(value, |
1596 instr->is_strict())); | 1612 instr->is_strict())); |
1597 } | 1613 } |
1598 | 1614 |
1599 | 1615 |
1616 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { | |
1617 ASSERT(instr->value()->representation().IsTagged()); | |
1618 LOperand* value = UseRegisterAtStart(instr->value()); | |
1619 | |
1620 return DefineAsRegister(new LIsObject(value, TempRegister())); | |
1621 } | |
1622 | |
1623 | |
1600 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { | 1624 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { |
1601 ASSERT(instr->value()->representation().IsTagged()); | 1625 ASSERT(instr->value()->representation().IsTagged()); |
1602 LOperand* value = UseAtStart(instr->value()); | 1626 LOperand* value = UseAtStart(instr->value()); |
1603 | 1627 |
1604 return DefineAsRegister(new LIsSmi(value)); | 1628 return DefineAsRegister(new LIsSmi(value)); |
1605 } | 1629 } |
1606 | 1630 |
1607 | 1631 |
1608 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { | 1632 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { |
1609 ASSERT(instr->value()->representation().IsTagged()); | 1633 ASSERT(instr->value()->representation().IsTagged()); |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2077 void LPointerMap::PrintTo(StringStream* stream) const { | 2101 void LPointerMap::PrintTo(StringStream* stream) const { |
2078 stream->Add("{"); | 2102 stream->Add("{"); |
2079 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2103 for (int i = 0; i < pointer_operands_.length(); ++i) { |
2080 if (i != 0) stream->Add(";"); | 2104 if (i != 0) stream->Add(";"); |
2081 pointer_operands_[i]->PrintTo(stream); | 2105 pointer_operands_[i]->PrintTo(stream); |
2082 } | 2106 } |
2083 stream->Add("} @%d", position()); | 2107 stream->Add("} @%d", position()); |
2084 } | 2108 } |
2085 | 2109 |
2086 } } // namespace v8::internal | 2110 } } // namespace v8::internal |
OLD | NEW |