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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 HIsNull* compare = HIsNull::cast(v); | 967 HIsNull* compare = HIsNull::cast(v); |
968 ASSERT(compare->value()->representation().IsTagged()); | 968 ASSERT(compare->value()->representation().IsTagged()); |
969 | 969 |
970 // We only need a temp register for non-strict compare. | 970 // We only need a temp register for non-strict compare. |
971 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); | 971 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); |
972 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), | 972 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), |
973 temp); | 973 temp); |
974 } else if (v->IsIsObject()) { | 974 } else if (v->IsIsObject()) { |
975 HIsObject* compare = HIsObject::cast(v); | 975 HIsObject* compare = HIsObject::cast(v); |
976 ASSERT(compare->value()->representation().IsTagged()); | 976 ASSERT(compare->value()->representation().IsTagged()); |
977 | 977 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value())); |
978 LOperand* temp1 = TempRegister(); | |
979 LOperand* temp2 = TempRegister(); | |
980 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), | |
981 temp1, | |
982 temp2); | |
983 } else if (v->IsCompareJSObjectEq()) { | 978 } else if (v->IsCompareJSObjectEq()) { |
984 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 979 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
985 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 980 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
986 UseRegisterAtStart(compare->right())); | 981 UseRegisterAtStart(compare->right())); |
987 } else if (v->IsInstanceOf()) { | 982 } else if (v->IsInstanceOf()) { |
988 HInstanceOf* instance_of = HInstanceOf::cast(v); | 983 HInstanceOf* instance_of = HInstanceOf::cast(v); |
989 LInstanceOfAndBranch* result = | 984 LInstanceOfAndBranch* result = |
990 new LInstanceOfAndBranch( | 985 new LInstanceOfAndBranch( |
991 UseFixed(instance_of->left(), InstanceofStub::left()), | 986 UseFixed(instance_of->left(), InstanceofStub::left()), |
992 UseFixed(instance_of->right(), InstanceofStub::right())); | 987 UseFixed(instance_of->right(), InstanceofStub::right())); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx); | 1231 LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx); |
1237 LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax); | 1232 LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax); |
1238 LCmpT* result = new LCmpT(left, right); | 1233 LCmpT* result = new LCmpT(left, right); |
1239 return MarkAsCall(DefineFixed(result, rax), instr); | 1234 return MarkAsCall(DefineFixed(result, rax), instr); |
1240 } | 1235 } |
1241 } | 1236 } |
1242 | 1237 |
1243 | 1238 |
1244 LInstruction* LChunkBuilder::DoCompareJSObjectEq( | 1239 LInstruction* LChunkBuilder::DoCompareJSObjectEq( |
1245 HCompareJSObjectEq* instr) { | 1240 HCompareJSObjectEq* instr) { |
1246 Abort("Unimplemented: %s", "DoCompareJSObjectEq"); | 1241 LOperand* left = UseRegisterAtStart(instr->left()); |
1247 return NULL; | 1242 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1243 LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); |
| 1244 return DefineAsRegister(result); |
1248 } | 1245 } |
1249 | 1246 |
1250 | 1247 |
1251 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { | 1248 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
1252 Abort("Unimplemented: %s", "DoIsNull"); | 1249 ASSERT(instr->value()->representation().IsTagged()); |
1253 return NULL; | 1250 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1251 |
| 1252 return DefineAsRegister(new LIsNull(value)); |
1254 } | 1253 } |
1255 | 1254 |
1256 | 1255 |
1257 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { | 1256 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { |
1258 Abort("Unimplemented: %s", "DoIsObject"); | 1257 ASSERT(instr->value()->representation().IsTagged()); |
1259 return NULL; | 1258 LOperand* value = UseRegister(instr->value()); |
| 1259 |
| 1260 return DefineAsRegister(new LIsObject(value)); |
1260 } | 1261 } |
1261 | 1262 |
1262 | 1263 |
1263 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { | 1264 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { |
1264 Abort("Unimplemented: %s", "DoIsSmi"); | 1265 ASSERT(instr->value()->representation().IsTagged()); |
1265 return NULL; | 1266 LOperand* value = UseAtStart(instr->value()); |
| 1267 |
| 1268 return DefineAsRegister(new LIsSmi(value)); |
1266 } | 1269 } |
1267 | 1270 |
1268 | 1271 |
1269 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { | 1272 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { |
1270 Abort("Unimplemented: %s", "DoHasInstanceType"); | 1273 Abort("Unimplemented: %s", "DoHasInstanceType"); |
1271 return NULL; | 1274 return NULL; |
1272 } | 1275 } |
1273 | 1276 |
1274 | 1277 |
1275 LInstruction* LChunkBuilder::DoHasCachedArrayIndex( | 1278 LInstruction* LChunkBuilder::DoHasCachedArrayIndex( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 } | 1312 } |
1310 | 1313 |
1311 | 1314 |
1312 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1315 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
1313 Abort("Unimplemented: %s", "DoThrow"); | 1316 Abort("Unimplemented: %s", "DoThrow"); |
1314 return NULL; | 1317 return NULL; |
1315 } | 1318 } |
1316 | 1319 |
1317 | 1320 |
1318 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1321 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
1319 Abort("Unimplemented: %s", "DoChange"); | 1322 Representation from = instr->from(); |
| 1323 Representation to = instr->to(); |
| 1324 if (from.IsTagged()) { |
| 1325 if (to.IsDouble()) { |
| 1326 LOperand* value = UseRegister(instr->value()); |
| 1327 LNumberUntagD* res = new LNumberUntagD(value); |
| 1328 return AssignEnvironment(DefineAsRegister(res)); |
| 1329 } else { |
| 1330 ASSERT(to.IsInteger32()); |
| 1331 LOperand* value = UseRegister(instr->value()); |
| 1332 bool needs_check = !instr->value()->type().IsSmi(); |
| 1333 if (needs_check) { |
| 1334 LOperand* xmm_temp = |
| 1335 (instr->CanTruncateToInt32() && CpuFeatures::IsSupported(SSE3)) |
| 1336 ? NULL |
| 1337 : FixedTemp(xmm1); |
| 1338 LTaggedToI* res = new LTaggedToI(value, xmm_temp); |
| 1339 return AssignEnvironment(DefineSameAsFirst(res)); |
| 1340 } else { |
| 1341 return DefineSameAsFirst(new LSmiUntag(value, needs_check)); |
| 1342 } |
| 1343 } |
| 1344 } else if (from.IsDouble()) { |
| 1345 if (to.IsTagged()) { |
| 1346 LOperand* value = UseRegister(instr->value()); |
| 1347 LOperand* temp = TempRegister(); |
| 1348 |
| 1349 // Make sure that temp and result_temp are different registers. |
| 1350 LUnallocated* result_temp = TempRegister(); |
| 1351 LNumberTagD* result = new LNumberTagD(value, temp); |
| 1352 return AssignPointerMap(Define(result, result_temp)); |
| 1353 } else { |
| 1354 ASSERT(to.IsInteger32()); |
| 1355 bool needs_temp = instr->CanTruncateToInt32() && |
| 1356 !CpuFeatures::IsSupported(SSE3); |
| 1357 LOperand* value = needs_temp ? |
| 1358 UseTempRegister(instr->value()) : UseRegister(instr->value()); |
| 1359 LOperand* temp = needs_temp ? TempRegister() : NULL; |
| 1360 return AssignEnvironment(DefineAsRegister(new LDoubleToI(value, temp))); |
| 1361 } |
| 1362 } else if (from.IsInteger32()) { |
| 1363 if (to.IsTagged()) { |
| 1364 HValue* val = instr->value(); |
| 1365 LOperand* value = UseRegister(val); |
| 1366 if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 1367 return DefineSameAsFirst(new LSmiTag(value)); |
| 1368 } else { |
| 1369 LNumberTagI* result = new LNumberTagI(value); |
| 1370 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1371 } |
| 1372 } else { |
| 1373 ASSERT(to.IsDouble()); |
| 1374 return DefineAsRegister(new LInteger32ToDouble(Use(instr->value()))); |
| 1375 } |
| 1376 } |
| 1377 UNREACHABLE(); |
1320 return NULL; | 1378 return NULL; |
1321 } | 1379 } |
1322 | 1380 |
1323 | 1381 |
1324 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { | 1382 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { |
1325 Abort("Unimplemented: %s", "DoCheckNonSmi"); | 1383 Abort("Unimplemented: %s", "DoCheckNonSmi"); |
1326 return NULL; | 1384 return NULL; |
1327 } | 1385 } |
1328 | 1386 |
1329 | 1387 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 | 1652 |
1595 | 1653 |
1596 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1654 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
1597 Abort("Unimplemented: %s", "DoLeaveInlined"); | 1655 Abort("Unimplemented: %s", "DoLeaveInlined"); |
1598 return NULL; | 1656 return NULL; |
1599 } | 1657 } |
1600 | 1658 |
1601 } } // namespace v8::internal | 1659 } } // namespace v8::internal |
1602 | 1660 |
1603 #endif // V8_TARGET_ARCH_X64 | 1661 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |