| 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 LOperand* temp1 = TempRegister(); |
| 1253 LOperand* temp2 = TempRegister(); |
| 1254 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), |
| 1255 temp1, |
| 1256 temp2, |
| 1257 first_id, |
| 1258 second_id); |
| 1241 } else if (v->IsCompareJSObjectEq()) { | 1259 } else if (v->IsCompareJSObjectEq()) { |
| 1242 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1260 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
| 1243 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1261 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
| 1244 UseRegisterAtStart(compare->right()), | 1262 UseRegisterAtStart(compare->right()), |
| 1245 first_id, | 1263 first_id, |
| 1246 second_id); | 1264 second_id); |
| 1247 } else if (v->IsInstanceOf()) { | 1265 } else if (v->IsInstanceOf()) { |
| 1248 HInstanceOf* instance_of = HInstanceOf::cast(v); | 1266 HInstanceOf* instance_of = HInstanceOf::cast(v); |
| 1249 LInstruction* result = | 1267 LInstruction* result = |
| 1250 new LInstanceOfAndBranch(Use(instance_of->left()), | 1268 new LInstanceOfAndBranch(Use(instance_of->left()), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1309 } |
| 1292 | 1310 |
| 1293 | 1311 |
| 1294 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { | 1312 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
| 1295 return DefineAsRegister(new LArgumentsElements); | 1313 return DefineAsRegister(new LArgumentsElements); |
| 1296 } | 1314 } |
| 1297 | 1315 |
| 1298 | 1316 |
| 1299 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1317 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
| 1300 LInstruction* result = | 1318 LInstruction* result = |
| 1301 new LInstanceOf(Use(instr->left()), Use(instr->right())); | 1319 new LInstanceOf(UseFixed(instr->left(), r1), |
| 1320 UseFixed(instr->right(), r0)); |
| 1302 return MarkAsCall(DefineFixed(result, r0), instr); | 1321 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1303 } | 1322 } |
| 1304 | 1323 |
| 1305 | 1324 |
| 1306 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1325 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
| 1307 LOperand* function = UseFixed(instr->function(), r1); | 1326 LOperand* function = UseFixed(instr->function(), r1); |
| 1308 LOperand* receiver = UseFixed(instr->receiver(), r0); | 1327 LOperand* receiver = UseFixed(instr->receiver(), r0); |
| 1309 LOperand* length = UseRegisterAtStart(instr->length()); | 1328 LOperand* length = UseRegisterAtStart(instr->length()); |
| 1310 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1329 LOperand* elements = UseRegisterAtStart(instr->elements()); |
| 1311 LInstruction* result = new LApplyArguments(function, | 1330 LInstruction* result = new LApplyArguments(function, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1334 | 1353 |
| 1335 | 1354 |
| 1336 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1355 LInstruction* LChunkBuilder::DoCallConstantFunction( |
| 1337 HCallConstantFunction* instr) { | 1356 HCallConstantFunction* instr) { |
| 1338 argument_count_ -= instr->argument_count(); | 1357 argument_count_ -= instr->argument_count(); |
| 1339 return MarkAsCall(DefineFixed(new LCallConstantFunction, r0), instr); | 1358 return MarkAsCall(DefineFixed(new LCallConstantFunction, r0), instr); |
| 1340 } | 1359 } |
| 1341 | 1360 |
| 1342 | 1361 |
| 1343 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1362 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1344 MathFunctionId op = instr->op(); | 1363 BuiltinFunctionId op = instr->op(); |
| 1345 LOperand* input = UseRegisterAtStart(instr->value()); | 1364 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1346 LInstruction* result = new LUnaryMathOperation(input); | 1365 LInstruction* result = new LUnaryMathOperation(input); |
| 1347 switch (op) { | 1366 switch (op) { |
| 1348 case kMathAbs: | 1367 case kMathAbs: |
| 1349 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1368 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1350 case kMathFloor: | 1369 case kMathFloor: |
| 1351 return AssignEnvironment(DefineAsRegister(result)); | 1370 return AssignEnvironment(DefineAsRegister(result)); |
| 1352 case kMathSqrt: | 1371 case kMathSqrt: |
| 1353 return DefineSameAsFirst(result); | 1372 return DefineSameAsFirst(result); |
| 1354 case kMathPowHalf: | 1373 case kMathPowHalf: |
| 1355 Abort("MathPowHalf LUnaryMathOperation not implemented"); | 1374 Abort("MathPowHalf LUnaryMathOperation not implemented"); |
| 1356 return NULL; | 1375 return NULL; |
| 1376 case kMathLog: |
| 1377 Abort("MathLog LUnaryMathOperation not implemented"); |
| 1378 return NULL; |
| 1379 case kMathCos: |
| 1380 Abort("MathCos LUnaryMathOperation not implemented"); |
| 1381 return NULL; |
| 1382 case kMathSin: |
| 1383 Abort("MathSin LUnaryMathOperation not implemented"); |
| 1384 return NULL; |
| 1357 default: | 1385 default: |
| 1358 UNREACHABLE(); | 1386 UNREACHABLE(); |
| 1359 return NULL; | 1387 return NULL; |
| 1360 } | 1388 } |
| 1361 } | 1389 } |
| 1362 | 1390 |
| 1363 | 1391 |
| 1364 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1392 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
| 1365 ASSERT(instr->key()->representation().IsTagged()); | 1393 ASSERT(instr->key()->representation().IsTagged()); |
| 1366 argument_count_ -= instr->argument_count(); | 1394 argument_count_ -= instr->argument_count(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 | 1618 |
| 1591 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { | 1619 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
| 1592 ASSERT(instr->value()->representation().IsTagged()); | 1620 ASSERT(instr->value()->representation().IsTagged()); |
| 1593 LOperand* value = UseRegisterAtStart(instr->value()); | 1621 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1594 | 1622 |
| 1595 return DefineAsRegister(new LIsNull(value, | 1623 return DefineAsRegister(new LIsNull(value, |
| 1596 instr->is_strict())); | 1624 instr->is_strict())); |
| 1597 } | 1625 } |
| 1598 | 1626 |
| 1599 | 1627 |
| 1628 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { |
| 1629 ASSERT(instr->value()->representation().IsTagged()); |
| 1630 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1631 |
| 1632 return DefineAsRegister(new LIsObject(value, TempRegister())); |
| 1633 } |
| 1634 |
| 1635 |
| 1600 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { | 1636 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { |
| 1601 ASSERT(instr->value()->representation().IsTagged()); | 1637 ASSERT(instr->value()->representation().IsTagged()); |
| 1602 LOperand* value = UseAtStart(instr->value()); | 1638 LOperand* value = UseAtStart(instr->value()); |
| 1603 | 1639 |
| 1604 return DefineAsRegister(new LIsSmi(value)); | 1640 return DefineAsRegister(new LIsSmi(value)); |
| 1605 } | 1641 } |
| 1606 | 1642 |
| 1607 | 1643 |
| 1608 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { | 1644 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { |
| 1609 ASSERT(instr->value()->representation().IsTagged()); | 1645 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 { | 2113 void LPointerMap::PrintTo(StringStream* stream) const { |
| 2078 stream->Add("{"); | 2114 stream->Add("{"); |
| 2079 for (int i = 0; i < pointer_operands_.length(); ++i) { | 2115 for (int i = 0; i < pointer_operands_.length(); ++i) { |
| 2080 if (i != 0) stream->Add(";"); | 2116 if (i != 0) stream->Add(";"); |
| 2081 pointer_operands_[i]->PrintTo(stream); | 2117 pointer_operands_[i]->PrintTo(stream); |
| 2082 } | 2118 } |
| 2083 stream->Add("} @%d", position()); | 2119 stream->Add("} @%d", position()); |
| 2084 } | 2120 } |
| 2085 | 2121 |
| 2086 } } // namespace v8::internal | 2122 } } // namespace v8::internal |
| OLD | NEW |