| OLD | NEW |
| 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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 val, representation(), false, false); | 1434 val, representation(), false, false); |
| 1435 result->InsertBefore(this); | 1435 result->InsertBefore(this); |
| 1436 return result; | 1436 return result; |
| 1437 } | 1437 } |
| 1438 return val; | 1438 return val; |
| 1439 } | 1439 } |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 if (op() == kMathFloor) { | 1442 if (op() == kMathFloor) { |
| 1443 HValue* val = value(); | 1443 HValue* val = value(); |
| 1444 if (val->IsChange()) val = HChange::cast(val)->value(); | |
| 1445 if (val->IsDiv() && (val->UseCount() == 1)) { | 1444 if (val->IsDiv() && (val->UseCount() == 1)) { |
| 1446 HDiv* hdiv = HDiv::cast(val); | 1445 HDiv* hdiv = HDiv::cast(val); |
| 1447 HValue* left = hdiv->left(); | 1446 HValue* left = hdiv->left(); |
| 1448 HValue* right = hdiv->right(); | 1447 HValue* right = hdiv->right(); |
| 1449 // Try to simplify left and right values of the division. | 1448 // Try to simplify left and right values of the division. |
| 1450 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1449 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
| 1451 if (new_left == NULL && | 1450 if (new_left == NULL && |
| 1452 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1451 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
| 1453 new_left = new(block()->zone()) HChange( | 1452 new_left = new(block()->zone()) HChange( |
| 1454 left, Representation::Integer32(), false, false); | 1453 left, Representation::Integer32(), false, false); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1473 if (new_left->IsInstruction() && | 1472 if (new_left->IsInstruction() && |
| 1474 !HInstruction::cast(new_left)->IsLinked()) { | 1473 !HInstruction::cast(new_left)->IsLinked()) { |
| 1475 HInstruction::cast(new_left)->InsertBefore(this); | 1474 HInstruction::cast(new_left)->InsertBefore(this); |
| 1476 } | 1475 } |
| 1477 if (new_right->IsInstruction() && | 1476 if (new_right->IsInstruction() && |
| 1478 !HInstruction::cast(new_right)->IsLinked()) { | 1477 !HInstruction::cast(new_right)->IsLinked()) { |
| 1479 HInstruction::cast(new_right)->InsertBefore(this); | 1478 HInstruction::cast(new_right)->InsertBefore(this); |
| 1480 } | 1479 } |
| 1481 HMathFloorOfDiv* instr = | 1480 HMathFloorOfDiv* instr = |
| 1482 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); | 1481 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); |
| 1483 // Replace this HMathFloor instruction by the new HMathFloorOfDiv. | |
| 1484 instr->InsertBefore(this); | 1482 instr->InsertBefore(this); |
| 1485 ReplaceAllUsesWith(instr); | 1483 return instr; |
| 1486 Kill(); | |
| 1487 // We know the division had no other uses than this HMathFloor. Delete it. | |
| 1488 // Dead code elimination will deal with |left| and |right| if | |
| 1489 // appropriate. | |
| 1490 hdiv->DeleteAndReplaceWith(NULL); | |
| 1491 | |
| 1492 // Return NULL to remove this instruction from the graph. | |
| 1493 return NULL; | |
| 1494 } | 1484 } |
| 1495 } | 1485 } |
| 1496 return this; | 1486 return this; |
| 1497 } | 1487 } |
| 1498 | 1488 |
| 1499 | 1489 |
| 1500 HValue* HCheckInstanceType::Canonicalize() { | 1490 HValue* HCheckInstanceType::Canonicalize() { |
| 1501 if (check_ == IS_STRING && value()->type().IsString()) { | 1491 if (check_ == IS_STRING && value()->type().IsString()) { |
| 1502 return value(); | 1492 return value(); |
| 1503 } | 1493 } |
| (...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4411 break; | 4401 break; |
| 4412 case kExternalMemory: | 4402 case kExternalMemory: |
| 4413 stream->Add("[external-memory]"); | 4403 stream->Add("[external-memory]"); |
| 4414 break; | 4404 break; |
| 4415 } | 4405 } |
| 4416 | 4406 |
| 4417 stream->Add("@%d", offset()); | 4407 stream->Add("@%d", offset()); |
| 4418 } | 4408 } |
| 4419 | 4409 |
| 4420 } } // namespace v8::internal | 4410 } } // namespace v8::internal |
| OLD | NEW |