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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 6461021: Add a genuine unary minus instruction to Crankshaft.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 673
674 void HChange::PrintDataTo(StringStream* stream) const { 674 void HChange::PrintDataTo(StringStream* stream) const {
675 HUnaryOperation::PrintDataTo(stream); 675 HUnaryOperation::PrintDataTo(stream);
676 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic()); 676 stream->Add(" %s to %s", from_.Mnemonic(), to_.Mnemonic());
677 677
678 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); 678 if (CanTruncateToInt32()) stream->Add(" truncating-int32");
679 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); 679 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
680 } 680 }
681 681
682 682
683 void HNeg::PrintDataTo(StringStream* stream) const {
684 HUnaryOperation::PrintDataTo(stream);
685 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
686 }
687
688
683 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction( 689 HCheckInstanceType* HCheckInstanceType::NewIsJSObjectOrJSFunction(
684 HValue* value) { 690 HValue* value) {
685 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE); 691 STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE);
686 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE); 692 return new HCheckInstanceType(value, FIRST_JS_OBJECT_TYPE, JS_FUNCTION_TYPE);
687 } 693 }
688 694
689 695
690 void HCheckMap::PrintDataTo(StringStream* stream) const { 696 void HCheckMap::PrintDataTo(StringStream* stream) const {
691 value()->PrintNameTo(stream); 697 value()->PrintNameTo(stream);
692 stream->Add(" %p", *map()); 698 stream->Add(" %p", *map());
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 if (!right()->range()->CanBeZero()) { 873 if (!right()->range()->CanBeZero()) {
868 ClearFlag(HValue::kCanBeDivByZero); 874 ClearFlag(HValue::kCanBeDivByZero);
869 } 875 }
870 return result; 876 return result;
871 } else { 877 } else {
872 return HArithmeticBinaryOperation::InferRange(); 878 return HArithmeticBinaryOperation::InferRange();
873 } 879 }
874 } 880 }
875 881
876 882
883 Range* HNeg::InferRange() {
884 if (representation().IsInteger32()) {
885 Range* input_range = value()->range();
886 Range* result = input_range->Copy();
887 Range neg_one(-1, -1);
888 if (!result->MulAndCheckOverflow(&neg_one)) {
889 ClearFlag(HValue::kCanOverflow);
890 }
891 result->set_can_be_minus_zero(input_range->CanBeZero());
892 return result;
893 } else {
894 return HValue::InferRange();
895 }
896 }
897
898
877 void HPhi::PrintTo(StringStream* stream) const { 899 void HPhi::PrintTo(StringStream* stream) const {
878 stream->Add("["); 900 stream->Add("[");
879 for (int i = 0; i < OperandCount(); ++i) { 901 for (int i = 0; i < OperandCount(); ++i) {
880 HValue* value = OperandAt(i); 902 HValue* value = OperandAt(i);
881 stream->Add(" "); 903 stream->Add(" ");
882 value->PrintNameTo(stream); 904 value->PrintNameTo(stream);
883 stream->Add(" "); 905 stream->Add(" ");
884 } 906 }
885 stream->Add(" uses%d_%di_%dd_%dt]", 907 stream->Add(" uses%d_%di_%dd_%dt]",
886 uses()->length(), 908 uses()->length(),
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 HType HBitOr::CalculateInferredType() const { 1303 HType HBitOr::CalculateInferredType() const {
1282 return HType::TaggedNumber(); 1304 return HType::TaggedNumber();
1283 } 1305 }
1284 1306
1285 1307
1286 HType HBitNot::CalculateInferredType() const { 1308 HType HBitNot::CalculateInferredType() const {
1287 return HType::TaggedNumber(); 1309 return HType::TaggedNumber();
1288 } 1310 }
1289 1311
1290 1312
1313 HType HNeg::CalculateInferredType() const {
1314 return HType::TaggedNumber();
1315 }
1316
1317
1291 HType HUnaryMathOperation::CalculateInferredType() const { 1318 HType HUnaryMathOperation::CalculateInferredType() const {
1292 return HType::TaggedNumber(); 1319 return HType::TaggedNumber();
1293 } 1320 }
1294 1321
1295 1322
1296 HType HShl::CalculateInferredType() const { 1323 HType HShl::CalculateInferredType() const {
1297 return HType::TaggedNumber(); 1324 return HType::TaggedNumber();
1298 } 1325 }
1299 1326
1300 1327
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1386
1360 HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) { 1387 HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1361 visited->Add(id()); 1388 visited->Add(id());
1362 if (range() == NULL || range()->CanBeMinusZero()) { 1389 if (range() == NULL || range()->CanBeMinusZero()) {
1363 SetFlag(kBailoutOnMinusZero); 1390 SetFlag(kBailoutOnMinusZero);
1364 } 1391 }
1365 return NULL; 1392 return NULL;
1366 } 1393 }
1367 1394
1368 1395
1396 HValue* HNeg::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1397 visited->Add(id());
1398 if (range() == NULL || range()->CanBeMinusZero()) {
1399 SetFlag(kBailoutOnMinusZero);
1400 }
1401 return NULL;
1402 }
1403
1404
1369 HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) { 1405 HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) {
1370 visited->Add(id()); 1406 visited->Add(id());
1371 // Propagate to the left argument. If the left argument cannot be -0, then 1407 // Propagate to the left argument. If the left argument cannot be -0, then
1372 // the result of the add operation cannot be either. 1408 // the result of the add operation cannot be either.
1373 if (range() == NULL || range()->CanBeMinusZero()) { 1409 if (range() == NULL || range()->CanBeMinusZero()) {
1374 return left(); 1410 return left();
1375 } 1411 }
1376 return NULL; 1412 return NULL;
1377 } 1413 }
1378 1414
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 1482
1447 1483
1448 void HCheckPrototypeMaps::Verify() { 1484 void HCheckPrototypeMaps::Verify() {
1449 HInstruction::Verify(); 1485 HInstruction::Verify();
1450 ASSERT(HasNoUses()); 1486 ASSERT(HasNoUses());
1451 } 1487 }
1452 1488
1453 #endif 1489 #endif
1454 1490
1455 } } // namespace v8::internal 1491 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698