| 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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 val, representation(), false, false); | 1364 val, representation(), false, false); |
| 1365 result->InsertBefore(this); | 1365 result->InsertBefore(this); |
| 1366 return result; | 1366 return result; |
| 1367 } | 1367 } |
| 1368 return val; | 1368 return val; |
| 1369 } | 1369 } |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 if (op() == kMathFloor) { | 1372 if (op() == kMathFloor) { |
| 1373 HValue* val = value(); | 1373 HValue* val = value(); |
| 1374 if (val->IsChange()) val = HChange::cast(val)->value(); | |
| 1375 if (val->IsDiv() && (val->UseCount() == 1)) { | 1374 if (val->IsDiv() && (val->UseCount() == 1)) { |
| 1376 HDiv* hdiv = HDiv::cast(val); | 1375 HDiv* hdiv = HDiv::cast(val); |
| 1377 HValue* left = hdiv->left(); | 1376 HValue* left = hdiv->left(); |
| 1378 HValue* right = hdiv->right(); | 1377 HValue* right = hdiv->right(); |
| 1379 // Try to simplify left and right values of the division. | 1378 // Try to simplify left and right values of the division. |
| 1380 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); | 1379 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); |
| 1381 if (new_left == NULL && | 1380 if (new_left == NULL && |
| 1382 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { | 1381 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { |
| 1383 new_left = new(block()->zone()) HChange( | 1382 new_left = new(block()->zone()) HChange( |
| 1384 left, Representation::Integer32(), false, false); | 1383 left, Representation::Integer32(), false, false); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1403 if (new_left->IsInstruction() && | 1402 if (new_left->IsInstruction() && |
| 1404 !HInstruction::cast(new_left)->IsLinked()) { | 1403 !HInstruction::cast(new_left)->IsLinked()) { |
| 1405 HInstruction::cast(new_left)->InsertBefore(this); | 1404 HInstruction::cast(new_left)->InsertBefore(this); |
| 1406 } | 1405 } |
| 1407 if (new_right->IsInstruction() && | 1406 if (new_right->IsInstruction() && |
| 1408 !HInstruction::cast(new_right)->IsLinked()) { | 1407 !HInstruction::cast(new_right)->IsLinked()) { |
| 1409 HInstruction::cast(new_right)->InsertBefore(this); | 1408 HInstruction::cast(new_right)->InsertBefore(this); |
| 1410 } | 1409 } |
| 1411 HMathFloorOfDiv* instr = | 1410 HMathFloorOfDiv* instr = |
| 1412 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); | 1411 HMathFloorOfDiv::New(block()->zone(), context(), new_left, new_right); |
| 1413 // Replace this HMathFloor instruction by the new HMathFloorOfDiv. | |
| 1414 instr->InsertBefore(this); | 1412 instr->InsertBefore(this); |
| 1415 ReplaceAllUsesWith(instr); | 1413 return instr; |
| 1416 Kill(); | |
| 1417 // We know the division had no other uses than this HMathFloor. Delete it. | |
| 1418 // Dead code elimination will deal with |left| and |right| if | |
| 1419 // appropriate. | |
| 1420 hdiv->DeleteAndReplaceWith(NULL); | |
| 1421 | |
| 1422 // Return NULL to remove this instruction from the graph. | |
| 1423 return NULL; | |
| 1424 } | 1414 } |
| 1425 } | 1415 } |
| 1426 return this; | 1416 return this; |
| 1427 } | 1417 } |
| 1428 | 1418 |
| 1429 | 1419 |
| 1430 HValue* HCheckInstanceType::Canonicalize() { | 1420 HValue* HCheckInstanceType::Canonicalize() { |
| 1431 if (check_ == IS_STRING && value()->type().IsString()) { | 1421 if (check_ == IS_STRING && value()->type().IsString()) { |
| 1432 return value(); | 1422 return value(); |
| 1433 } | 1423 } |
| (...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4298 break; | 4288 break; |
| 4299 case kExternalMemory: | 4289 case kExternalMemory: |
| 4300 stream->Add("[external-memory]"); | 4290 stream->Add("[external-memory]"); |
| 4301 break; | 4291 break; |
| 4302 } | 4292 } |
| 4303 | 4293 |
| 4304 stream->Add("@%d", offset()); | 4294 stream->Add("@%d", offset()); |
| 4305 } | 4295 } |
| 4306 | 4296 |
| 4307 } } // namespace v8::internal | 4297 } } // namespace v8::internal |
| OLD | NEW |