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

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

Issue 16951016: MIPS: Optimise Math.floor(x/y) to use integer division for MIPS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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/mips/lithium-codegen-mips.h » ('j') | src/mips/lithium-codegen-mips.cc » ('J')
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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 1533
1534 HValue* HUnaryMathOperation::Canonicalize() { 1534 HValue* HUnaryMathOperation::Canonicalize() {
1535 if (op() == kMathFloor) { 1535 if (op() == kMathFloor) {
1536 HValue* val = value(); 1536 HValue* val = value();
1537 if (val->IsChange()) val = HChange::cast(val)->value(); 1537 if (val->IsChange()) val = HChange::cast(val)->value();
1538 1538
1539 // If the input is integer32 then we replace the floor instruction 1539 // If the input is integer32 then we replace the floor instruction
1540 // with its input. 1540 // with its input.
1541 if (val->representation().IsInteger32()) return val; 1541 if (val->representation().IsInteger32()) return val;
1542 1542
1543 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_IA32) || \
1544 defined(V8_TARGET_ARCH_X64)
1545 if (val->IsDiv() && (val->UseCount() == 1)) { 1543 if (val->IsDiv() && (val->UseCount() == 1)) {
1546 HDiv* hdiv = HDiv::cast(val); 1544 HDiv* hdiv = HDiv::cast(val);
1547 HValue* left = hdiv->left(); 1545 HValue* left = hdiv->left();
1548 HValue* right = hdiv->right(); 1546 HValue* right = hdiv->right();
1549 // Try to simplify left and right values of the division. 1547 // Try to simplify left and right values of the division.
1550 HValue* new_left = SimplifiedDividendForMathFloorOfDiv( 1548 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(
1551 left, hdiv->observed_input_representation(1)); 1549 left, hdiv->observed_input_representation(1));
1552 HValue* new_right = 1550 HValue* new_right =
1553 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); 1551 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right);
1554 if (new_right == NULL && 1552 if (new_right == NULL &&
(...skipping 25 matching lines...) Expand all
1580 // more. 1578 // more.
1581 hdiv->DeleteAndReplaceWith(NULL); 1579 hdiv->DeleteAndReplaceWith(NULL);
1582 ASSERT(left->IsChange() || left->IsConstant()); 1580 ASSERT(left->IsChange() || left->IsConstant());
1583 ASSERT(right->IsChange() || right->IsConstant()); 1581 ASSERT(right->IsChange() || right->IsConstant());
1584 if (left->HasNoUses()) left->DeleteAndReplaceWith(NULL); 1582 if (left->HasNoUses()) left->DeleteAndReplaceWith(NULL);
1585 if (right->HasNoUses()) right->DeleteAndReplaceWith(NULL); 1583 if (right->HasNoUses()) right->DeleteAndReplaceWith(NULL);
1586 1584
1587 // Return NULL to remove this instruction from the graph. 1585 // Return NULL to remove this instruction from the graph.
1588 return NULL; 1586 return NULL;
1589 } 1587 }
1590 #endif // V8_TARGET_ARCH_ARM
1591 } 1588 }
1592 return this; 1589 return this;
1593 } 1590 }
1594 1591
1595 1592
1596 HValue* HCheckInstanceType::Canonicalize() { 1593 HValue* HCheckInstanceType::Canonicalize() {
1597 if (check_ == IS_STRING && 1594 if (check_ == IS_STRING &&
1598 !value()->type().IsUninitialized() && 1595 !value()->type().IsUninitialized() &&
1599 value()->type().IsString()) { 1596 value()->type().IsString()) {
1600 return NULL; 1597 return NULL;
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3871 case kBackingStore: 3868 case kBackingStore:
3872 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3869 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3873 stream->Add("[backing-store]"); 3870 stream->Add("[backing-store]");
3874 break; 3871 break;
3875 } 3872 }
3876 3873
3877 stream->Add("@%d", offset()); 3874 stream->Add("@%d", offset());
3878 } 3875 }
3879 3876
3880 } } // namespace v8::internal 3877 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-codegen-mips.h » ('j') | src/mips/lithium-codegen-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698