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

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

Issue 146723002: Merged r18737 into 3.22 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.22
Patch Set: Created 6 years, 11 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 | « no previous file | src/version.cc » ('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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698