Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: src/arm/lithium-arm.cc

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, 607 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
608 HInstruction* hinstr, 608 HInstruction* hinstr,
609 CanDeoptimize can_deoptimize) { 609 CanDeoptimize can_deoptimize) {
610 info()->MarkAsNonDeferredCalling(); 610 info()->MarkAsNonDeferredCalling();
611 #ifdef DEBUG 611 #ifdef DEBUG
612 instr->VerifyCall(); 612 instr->VerifyCall();
613 #endif 613 #endif
614 instr->MarkAsCall(); 614 instr->MarkAsCall();
615 instr = AssignPointerMap(instr); 615 instr = AssignPointerMap(instr);
616 616
617 if (hinstr->HasObservableSideEffects()) {
618 ASSERT(hinstr->next()->IsSimulate());
619 HSimulate* sim = HSimulate::cast(hinstr->next());
620 ASSERT(instruction_pending_deoptimization_environment_ == NULL);
621 ASSERT(pending_deoptimization_ast_id_.IsNone());
622 instruction_pending_deoptimization_environment_ = instr;
623 pending_deoptimization_ast_id_ = sim->ast_id();
624 }
625
626 // If instruction does not have side-effects lazy deoptimization 617 // If instruction does not have side-effects lazy deoptimization
627 // after the call will try to deoptimize to the point before the call. 618 // after the call will try to deoptimize to the point before the call.
628 // Thus we still need to attach environment to this call even if 619 // Thus we still need to attach environment to this call even if
629 // call sequence can not deoptimize eagerly. 620 // call sequence can not deoptimize eagerly.
630 bool needs_environment = 621 bool needs_environment =
631 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || 622 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) ||
632 !hinstr->HasObservableSideEffects(); 623 !hinstr->HasObservableSideEffects();
633 if (needs_environment && !instr->HasEnvironment()) { 624 if (needs_environment && !instr->HasEnvironment()) {
634 instr = AssignEnvironment(instr); 625 instr = AssignEnvironment(instr);
635 } 626 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } 889 }
899 #endif 890 #endif
900 891
901 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { 892 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) {
902 instr = AssignPointerMap(instr); 893 instr = AssignPointerMap(instr);
903 } 894 }
904 if (FLAG_stress_environments && !instr->HasEnvironment()) { 895 if (FLAG_stress_environments && !instr->HasEnvironment()) {
905 instr = AssignEnvironment(instr); 896 instr = AssignEnvironment(instr);
906 } 897 }
907 chunk_->AddInstruction(instr, current_block_); 898 chunk_->AddInstruction(instr, current_block_);
899
900 if (instr->IsCall()) {
901 HValue* hydrogen_value_for_lazy_bailout = current;
902 LInstruction* instruction_needing_environment = NULL;
903 if (current->HasObservableSideEffects()) {
904 HSimulate* sim = HSimulate::cast(current->next());
905 instruction_needing_environment = instr;
906 sim->ReplayEnvironment(current_block_->last_environment());
907 hydrogen_value_for_lazy_bailout = sim;
908 }
909 LInstruction* bailout = AssignEnvironment(new(zone()) LLazyBailout());
910 bailout->set_hydrogen_value(hydrogen_value_for_lazy_bailout);
911 chunk_->AddInstruction(bailout, current_block_);
912 if (instruction_needing_environment != NULL) {
913 // Store the lazy deopt environment with the instruction if needed.
914 // Right now it is only used for LInstanceOfKnownGlobal.
915 instruction_needing_environment->
916 SetDeferredLazyDeoptimizationEnvironment(bailout->environment());
917 }
918 }
908 } 919 }
909 current_instruction_ = old_current; 920 current_instruction_ = old_current;
910 } 921 }
911 922
912 923
913 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 924 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
914 return new(zone()) LGoto(instr->FirstSuccessor()); 925 return new(zone()) LGoto(instr->FirstSuccessor());
915 } 926 }
916 927
917 928
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1242
1232 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1243 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1233 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); 1244 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1234 return DefineAsRegister(new(zone()) LBitI(left, right)); 1245 return DefineAsRegister(new(zone()) LBitI(left, right));
1235 } else { 1246 } else {
1236 return DoArithmeticT(instr->op(), instr); 1247 return DoArithmeticT(instr->op(), instr);
1237 } 1248 }
1238 } 1249 }
1239 1250
1240 1251
1252 LInstruction* LChunkBuilder::DoDivByPowerOf2I(HDiv* instr) {
1253 ASSERT(instr->representation().IsSmiOrInteger32());
1254 ASSERT(instr->left()->representation().Equals(instr->representation()));
1255 ASSERT(instr->right()->representation().Equals(instr->representation()));
1256 LOperand* dividend = UseRegister(instr->left());
1257 int32_t divisor = instr->right()->GetInteger32Constant();
1258 LInstruction* result = DefineAsRegister(new(zone()) LDivByPowerOf2I(
1259 dividend, divisor));
1260 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1261 (instr->CheckFlag(HValue::kCanOverflow) && divisor == -1) ||
1262 (!instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) &&
1263 divisor != 1 && divisor != -1)) {
1264 result = AssignEnvironment(result);
1265 }
1266 return result;
1267 }
1268
1269
1270 LInstruction* LChunkBuilder::DoDivByConstI(HDiv* instr) {
1271 ASSERT(instr->representation().IsInteger32());
1272 ASSERT(instr->left()->representation().Equals(instr->representation()));
1273 ASSERT(instr->right()->representation().Equals(instr->representation()));
1274 LOperand* dividend = UseRegister(instr->left());
1275 int32_t divisor = instr->right()->GetInteger32Constant();
1276 LInstruction* result = DefineAsRegister(new(zone()) LDivByConstI(
1277 dividend, divisor));
1278 if (divisor == 0 ||
1279 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1280 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1281 result = AssignEnvironment(result);
1282 }
1283 return result;
1284 }
1285
1286
1287 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) {
1288 ASSERT(instr->representation().IsSmiOrInteger32());
1289 ASSERT(instr->left()->representation().Equals(instr->representation()));
1290 ASSERT(instr->right()->representation().Equals(instr->representation()));
1291 LOperand* dividend = UseRegister(instr->left());
1292 LOperand* divisor = UseRegister(instr->right());
1293 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4);
1294 LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
1295 return AssignEnvironment(DefineAsRegister(div));
1296 }
1297
1298
1241 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1299 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1242 if (instr->representation().IsSmiOrInteger32()) { 1300 if (instr->representation().IsSmiOrInteger32()) {
1243 ASSERT(instr->left()->representation().Equals(instr->representation()));
1244 ASSERT(instr->right()->representation().Equals(instr->representation()));
1245 if (instr->RightIsPowerOf2()) { 1301 if (instr->RightIsPowerOf2()) {
1246 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); 1302 return DoDivByPowerOf2I(instr);
1247 LOperand* value = UseRegister(instr->left()); 1303 } else if (instr->right()->IsConstant()) {
1248 LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL); 1304 return DoDivByConstI(instr);
1249 return AssignEnvironment(DefineAsRegister(div)); 1305 } else {
1306 return DoDivI(instr);
1250 } 1307 }
1251 LOperand* dividend = UseRegister(instr->left());
1252 LOperand* divisor = UseRegister(instr->right());
1253 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4);
1254 LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
1255 return AssignEnvironment(DefineAsRegister(div));
1256 } else if (instr->representation().IsDouble()) { 1308 } else if (instr->representation().IsDouble()) {
1257 return DoArithmeticD(Token::DIV, instr); 1309 return DoArithmeticD(Token::DIV, instr);
1258 } else { 1310 } else {
1259 return DoArithmeticT(Token::DIV, instr); 1311 return DoArithmeticT(Token::DIV, instr);
1260 } 1312 }
1261 } 1313 }
1262 1314
1263 1315
1264 bool LChunkBuilder::HasMagicNumberForDivisor(int32_t divisor) { 1316 LInstruction* LChunkBuilder::DoFlooringDivByPowerOf2I(HMathFloorOfDiv* instr) {
1265 uint32_t divisor_abs = abs(divisor); 1317 LOperand* dividend = UseRegisterAtStart(instr->left());
1266 // Dividing by 0, 1, and powers of 2 is easy. 1318 int32_t divisor = instr->right()->GetInteger32Constant();
1267 // Note that IsPowerOf2(0) returns true; 1319 LInstruction* result = DefineAsRegister(new(zone()) LFlooringDivByPowerOf2I(
1268 ASSERT(IsPowerOf2(0) == true); 1320 dividend, divisor));
1269 if (IsPowerOf2(divisor_abs)) return true; 1321 if ((instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1322 (instr->CheckFlag(HValue::kLeftCanBeMinInt) && divisor == -1)) {
1323 result = AssignEnvironment(result);
1324 }
1325 return result;
1326 }
1270 1327
1271 // We have magic numbers for a few specific divisors.
1272 // Details and proofs can be found in:
1273 // - Hacker's Delight, Henry S. Warren, Jr.
1274 // - The PowerPC Compiler Writer’s Guide
1275 // and probably many others.
1276 //
1277 // We handle
1278 // <divisor with magic numbers> * <power of 2>
1279 // but not
1280 // <divisor with magic numbers> * <other divisor with magic numbers>
1281 int32_t power_of_2_factor =
1282 CompilerIntrinsics::CountTrailingZeros(divisor_abs);
1283 DivMagicNumbers magic_numbers =
1284 DivMagicNumberFor(divisor_abs >> power_of_2_factor);
1285 if (magic_numbers.M != InvalidDivMagicNumber.M) return true;
1286 1328
1287 return false; 1329 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) {
1330 ASSERT(instr->representation().IsInteger32());
1331 ASSERT(instr->left()->representation().Equals(instr->representation()));
1332 ASSERT(instr->right()->representation().Equals(instr->representation()));
1333 LOperand* dividend = UseRegister(instr->left());
1334 int32_t divisor = instr->right()->GetInteger32Constant();
1335 LInstruction* result =
1336 DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor));
1337 bool can_deopt =
1338 divisor == 0 ||
1339 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0);
1340 return can_deopt ? AssignEnvironment(result) : result;
1288 } 1341 }
1289 1342
1290 1343
1291 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1344 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1292 // LMathFloorOfDiv can only handle a subset of divisors, so fall 1345 if (instr->RightIsPowerOf2()) {
1293 // back to a flooring division in all other cases. 1346 return DoFlooringDivByPowerOf2I(instr);
1294 HValue* right = instr->right(); 1347 } else if (false && instr->right()->IsConstant()) {
1295 if (!right->IsInteger32Constant() || 1348 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable.
1296 (!CpuFeatures::IsSupported(SUDIV) && 1349 } else {
1297 !HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value()))) { 1350 return DoDivI(instr);
1298 LOperand* dividend = UseRegister(instr->left());
1299 LOperand* divisor = UseRegister(right);
1300 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4);
1301 LDivI* div = new(zone()) LDivI(dividend, divisor, temp);
1302 return AssignEnvironment(DefineAsRegister(div));
1303 } 1351 }
1352 }
1304 1353
1354
1355 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1356 ASSERT(instr->representation().IsSmiOrInteger32());
1357 ASSERT(instr->left()->representation().Equals(instr->representation()));
1358 ASSERT(instr->right()->representation().Equals(instr->representation()));
1359 LOperand* dividend = UseRegisterAtStart(instr->left());
1360 int32_t divisor = instr->right()->GetInteger32Constant();
1361 LInstruction* result = DefineSameAsFirst(new(zone()) LModByPowerOf2I(
1362 dividend, divisor));
1363 if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1364 result = AssignEnvironment(result);
1365 }
1366 return result;
1367 }
1368
1369
1370 LInstruction* LChunkBuilder::DoModByConstI(HMod* instr) {
1371 ASSERT(instr->representation().IsSmiOrInteger32());
1372 ASSERT(instr->left()->representation().Equals(instr->representation()));
1373 ASSERT(instr->right()->representation().Equals(instr->representation()));
1305 LOperand* dividend = UseRegister(instr->left()); 1374 LOperand* dividend = UseRegister(instr->left());
1306 LOperand* divisor = CpuFeatures::IsSupported(SUDIV) 1375 int32_t divisor = instr->right()->GetInteger32Constant();
1307 ? UseRegister(right) 1376 LInstruction* result = DefineAsRegister(new(zone()) LModByConstI(
1308 : UseOrConstant(right); 1377 dividend, divisor));
1309 LOperand* remainder = TempRegister(); 1378 if (divisor == 0 || instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1310 return AssignEnvironment(DefineAsRegister( 1379 result = AssignEnvironment(result);
1311 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder))); 1380 }
1381 return result;
1382 }
1383
1384
1385 LInstruction* LChunkBuilder::DoModI(HMod* instr) {
1386 ASSERT(instr->representation().IsSmiOrInteger32());
1387 ASSERT(instr->left()->representation().Equals(instr->representation()));
1388 ASSERT(instr->right()->representation().Equals(instr->representation()));
1389 LOperand* dividend = UseRegister(instr->left());
1390 LOperand* divisor = UseRegister(instr->right());
1391 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d10);
1392 LOperand* temp2 = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d11);
1393 LInstruction* result = DefineAsRegister(new(zone()) LModI(
1394 dividend, divisor, temp, temp2));
1395 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1396 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1397 result = AssignEnvironment(result);
1398 }
1399 return result;
1312 } 1400 }
1313 1401
1314 1402
1315 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1403 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1316 HValue* left = instr->left();
1317 HValue* right = instr->right();
1318 if (instr->representation().IsSmiOrInteger32()) { 1404 if (instr->representation().IsSmiOrInteger32()) {
1319 ASSERT(instr->left()->representation().Equals(instr->representation()));
1320 ASSERT(instr->right()->representation().Equals(instr->representation()));
1321 if (instr->RightIsPowerOf2()) { 1405 if (instr->RightIsPowerOf2()) {
1322 ASSERT(!right->CanBeZero()); 1406 return DoModByPowerOf2I(instr);
1323 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), 1407 } else if (instr->right()->IsConstant()) {
1324 UseConstant(right)); 1408 return DoModByConstI(instr);
1325 LInstruction* result = DefineAsRegister(mod);
1326 return (left->CanBeNegative() &&
1327 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1328 ? AssignEnvironment(result)
1329 : result;
1330 } else if (CpuFeatures::IsSupported(SUDIV)) {
1331 LModI* mod = new(zone()) LModI(UseRegister(left),
1332 UseRegister(right));
1333 LInstruction* result = DefineAsRegister(mod);
1334 return (right->CanBeZero() ||
1335 (left->RangeCanInclude(kMinInt) &&
1336 right->RangeCanInclude(-1) &&
1337 instr->CheckFlag(HValue::kBailoutOnMinusZero)) ||
1338 (left->CanBeNegative() &&
1339 instr->CanBeZero() &&
1340 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1341 ? AssignEnvironment(result)
1342 : result;
1343 } else { 1409 } else {
1344 LModI* mod = new(zone()) LModI(UseRegister(left), 1410 return DoModI(instr);
1345 UseRegister(right),
1346 FixedTemp(d10),
1347 FixedTemp(d11));
1348 LInstruction* result = DefineAsRegister(mod);
1349 return (right->CanBeZero() ||
1350 (left->CanBeNegative() &&
1351 instr->CanBeZero() &&
1352 instr->CheckFlag(HValue::kBailoutOnMinusZero)))
1353 ? AssignEnvironment(result)
1354 : result;
1355 } 1411 }
1356 } else if (instr->representation().IsDouble()) { 1412 } else if (instr->representation().IsDouble()) {
1357 return DoArithmeticD(Token::MOD, instr); 1413 return DoArithmeticD(Token::MOD, instr);
1358 } else { 1414 } else {
1359 return DoArithmeticT(Token::MOD, instr); 1415 return DoArithmeticT(Token::MOD, instr);
1360 } 1416 }
1361 } 1417 }
1362 1418
1363 1419
1364 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1420 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 ASSERT(to.IsInteger32()); 1891 ASSERT(to.IsInteger32());
1836 LOperand* value = UseRegister(instr->value()); 1892 LOperand* value = UseRegister(instr->value());
1837 LDoubleToI* res = new(zone()) LDoubleToI(value); 1893 LDoubleToI* res = new(zone()) LDoubleToI(value);
1838 return AssignEnvironment(DefineAsRegister(res)); 1894 return AssignEnvironment(DefineAsRegister(res));
1839 } 1895 }
1840 } else if (from.IsInteger32()) { 1896 } else if (from.IsInteger32()) {
1841 info()->MarkAsDeferredCalling(); 1897 info()->MarkAsDeferredCalling();
1842 if (to.IsTagged()) { 1898 if (to.IsTagged()) {
1843 HValue* val = instr->value(); 1899 HValue* val = instr->value();
1844 LOperand* value = UseRegisterAtStart(val); 1900 LOperand* value = UseRegisterAtStart(val);
1845 if (val->CheckFlag(HInstruction::kUint32)) { 1901 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1846 LNumberTagU* result = new(zone()) LNumberTagU(value); 1902 return DefineAsRegister(new(zone()) LSmiTag(value));
1903 } else if (val->CheckFlag(HInstruction::kUint32)) {
1904 LOperand* temp1 = TempRegister();
1905 LOperand* temp2 = TempRegister();
1906 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1847 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1907 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1848 } else if (val->HasRange() && val->range()->IsInSmiRange()) {
1849 return DefineAsRegister(new(zone()) LSmiTag(value));
1850 } else { 1908 } else {
1851 LNumberTagI* result = new(zone()) LNumberTagI(value); 1909 LOperand* temp1 = TempRegister();
1910 LOperand* temp2 = TempRegister();
1911 LNumberTagI* result = new(zone()) LNumberTagI(value, temp1, temp2);
1852 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 1912 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
1853 } 1913 }
1854 } else if (to.IsSmi()) { 1914 } else if (to.IsSmi()) {
1855 HValue* val = instr->value(); 1915 HValue* val = instr->value();
1856 LOperand* value = UseRegister(val); 1916 LOperand* value = UseRegister(val);
1857 LInstruction* result = val->CheckFlag(HInstruction::kUint32) 1917 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value));
1858 ? DefineAsRegister(new(zone()) LUint32ToSmi(value)) 1918 if (instr->CheckFlag(HValue::kCanOverflow)) {
1859 : DefineAsRegister(new(zone()) LInteger32ToSmi(value)); 1919 result = AssignEnvironment(result);
1860 if (val->HasRange() && val->range()->IsInSmiRange()) {
1861 return result;
1862 } 1920 }
1863 return AssignEnvironment(result); 1921 return result;
1864 } else { 1922 } else {
1865 ASSERT(to.IsDouble()); 1923 ASSERT(to.IsDouble());
1866 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 1924 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
1867 return DefineAsRegister( 1925 return DefineAsRegister(
1868 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); 1926 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
1869 } else { 1927 } else {
1870 return DefineAsRegister( 1928 return DefineAsRegister(
1871 new(zone()) LInteger32ToDouble(Use(instr->value()))); 1929 new(zone()) LInteger32ToDouble(Use(instr->value())));
1872 } 1930 }
1873 } 1931 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 } else { 1986 } else {
1929 ASSERT(input_rep.IsSmiOrTagged()); 1987 ASSERT(input_rep.IsSmiOrTagged());
1930 // Register allocator doesn't (yet) support allocation of double 1988 // Register allocator doesn't (yet) support allocation of double
1931 // temps. Reserve d1 explicitly. 1989 // temps. Reserve d1 explicitly.
1932 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(d11)); 1990 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, FixedTemp(d11));
1933 return AssignEnvironment(DefineAsRegister(result)); 1991 return AssignEnvironment(DefineAsRegister(result));
1934 } 1992 }
1935 } 1993 }
1936 1994
1937 1995
1996 LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
1997 HValue* value = instr->value();
1998 ASSERT(value->representation().IsDouble());
1999 return DefineAsRegister(new(zone()) LDoubleBits(UseRegister(value)));
2000 }
2001
2002
2003 LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
2004 LOperand* lo = UseRegister(instr->lo());
2005 LOperand* hi = UseRegister(instr->hi());
2006 return DefineAsRegister(new(zone()) LConstructDouble(hi, lo));
2007 }
2008
2009
1938 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 2010 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1939 LOperand* context = info()->IsStub() 2011 LOperand* context = info()->IsStub()
1940 ? UseFixed(instr->context(), cp) 2012 ? UseFixed(instr->context(), cp)
1941 : NULL; 2013 : NULL;
1942 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); 2014 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1943 return new(zone()) LReturn(UseFixed(instr->value(), r0), context, 2015 return new(zone()) LReturn(UseFixed(instr->value(), r0), context,
1944 parameter_count); 2016 parameter_count);
1945 } 2017 }
1946 2018
1947 2019
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 obj = is_in_object 2256 obj = is_in_object
2185 ? UseRegister(instr->object()) 2257 ? UseRegister(instr->object())
2186 : UseTempRegister(instr->object()); 2258 : UseTempRegister(instr->object());
2187 } else { 2259 } else {
2188 obj = needs_write_barrier_for_map 2260 obj = needs_write_barrier_for_map
2189 ? UseRegister(instr->object()) 2261 ? UseRegister(instr->object())
2190 : UseRegisterAtStart(instr->object()); 2262 : UseRegisterAtStart(instr->object());
2191 } 2263 }
2192 2264
2193 LOperand* val; 2265 LOperand* val;
2194 if (needs_write_barrier || 2266 if (needs_write_barrier || instr->field_representation().IsSmi()) {
2195 (FLAG_track_fields && instr->field_representation().IsSmi())) {
2196 val = UseTempRegister(instr->value()); 2267 val = UseTempRegister(instr->value());
2197 } else if (FLAG_track_double_fields && 2268 } else if (instr->field_representation().IsDouble()) {
2198 instr->field_representation().IsDouble()) {
2199 val = UseRegisterAtStart(instr->value()); 2269 val = UseRegisterAtStart(instr->value());
2200 } else { 2270 } else {
2201 val = UseRegister(instr->value()); 2271 val = UseRegister(instr->value());
2202 } 2272 }
2203 2273
2204 // We need a temporary register for write barrier of the map field. 2274 // We need a temporary register for write barrier of the map field.
2205 LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL; 2275 LOperand* temp = needs_write_barrier_for_map ? TempRegister() : NULL;
2206 2276
2207 LStoreNamedField* result = new(zone()) LStoreNamedField(obj, val, temp); 2277 LStoreNamedField* result = new(zone()) LStoreNamedField(obj, val, temp);
2208 if (FLAG_track_heap_object_fields && 2278 if (instr->field_representation().IsHeapObject()) {
2209 instr->field_representation().IsHeapObject()) {
2210 if (!instr->value()->type().IsHeapObject()) { 2279 if (!instr->value()->type().IsHeapObject()) {
2211 return AssignEnvironment(result); 2280 return AssignEnvironment(result);
2212 } 2281 }
2213 } 2282 }
2214 return result; 2283 return result;
2215 } 2284 }
2216 2285
2217 2286
2218 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2287 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2219 LOperand* context = UseFixed(instr->context(), cp); 2288 LOperand* context = UseFixed(instr->context(), cp);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 2447
2379 2448
2380 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2449 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
2381 HIsConstructCallAndBranch* instr) { 2450 HIsConstructCallAndBranch* instr) {
2382 return new(zone()) LIsConstructCallAndBranch(TempRegister()); 2451 return new(zone()) LIsConstructCallAndBranch(TempRegister());
2383 } 2452 }
2384 2453
2385 2454
2386 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { 2455 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
2387 instr->ReplayEnvironment(current_block_->last_environment()); 2456 instr->ReplayEnvironment(current_block_->last_environment());
2388
2389 // If there is an instruction pending deoptimization environment create a
2390 // lazy bailout instruction to capture the environment.
2391 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
2392 LInstruction* result = new(zone()) LLazyBailout;
2393 result = AssignEnvironment(result);
2394 // Store the lazy deopt environment with the instruction if needed. Right
2395 // now it is only used for LInstanceOfKnownGlobal.
2396 instruction_pending_deoptimization_environment_->
2397 SetDeferredLazyDeoptimizationEnvironment(result->environment());
2398 instruction_pending_deoptimization_environment_ = NULL;
2399 pending_deoptimization_ast_id_ = BailoutId::None();
2400 return result;
2401 }
2402
2403 return NULL; 2457 return NULL;
2404 } 2458 }
2405 2459
2406 2460
2407 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2461 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2408 if (instr->is_function_entry()) { 2462 if (instr->is_function_entry()) {
2409 LOperand* context = UseFixed(instr->context(), cp); 2463 LOperand* context = UseFixed(instr->context(), cp);
2410 return MarkAsCall(new(zone()) LStackCheck(context), instr); 2464 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2411 } else { 2465 } else {
2412 ASSERT(instr->is_backwards_branch()); 2466 ASSERT(instr->is_backwards_branch());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 } 2530 }
2477 2531
2478 2532
2479 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2480 LOperand* object = UseRegister(instr->object()); 2534 LOperand* object = UseRegister(instr->object());
2481 LOperand* index = UseRegister(instr->index()); 2535 LOperand* index = UseRegister(instr->index());
2482 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2536 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2483 } 2537 }
2484 2538
2485 } } // namespace v8::internal 2539 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698