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

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

Issue 1244693002: Add support for adding an external and a tagged pointer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 5 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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/double.h" 8 #include "src/double.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 } 1425 }
1426 // Optimize double negation, a common pattern used for ToInt32(x). 1426 // Optimize double negation, a common pattern used for ToInt32(x).
1427 HValue* arg; 1427 HValue* arg;
1428 if (MatchDoubleNegation(this, &arg) && !arg->CheckFlag(kUint32)) { 1428 if (MatchDoubleNegation(this, &arg) && !arg->CheckFlag(kUint32)) {
1429 return arg; 1429 return arg;
1430 } 1430 }
1431 return this; 1431 return this;
1432 } 1432 }
1433 1433
1434 1434
1435 // static
1436 HInstruction* HAdd::New(Isolate* isolate, Zone* zone, HValue* context,
1437 HValue* left, HValue* right, Strength strength,
1438 ExternalAddType external_add_type) {
1439 // For everything else, you should use the other factory method without
1440 // ExternalAddType.
1441 DCHECK_EQ(external_add_type, AddOfExternalAndTagged);
1442 return new (zone) HAdd(context, left, right, strength, external_add_type);
1443 }
1444
1445
1435 Representation HAdd::RepresentationFromInputs() { 1446 Representation HAdd::RepresentationFromInputs() {
1436 Representation left_rep = left()->representation(); 1447 Representation left_rep = left()->representation();
1437 if (left_rep.IsExternal()) { 1448 if (left_rep.IsExternal()) {
1438 return Representation::External(); 1449 return Representation::External();
1439 } 1450 }
1440 return HArithmeticBinaryOperation::RepresentationFromInputs(); 1451 return HArithmeticBinaryOperation::RepresentationFromInputs();
1441 } 1452 }
1442 1453
1443 1454
1444 Representation HAdd::RequiredInputRepresentation(int index) { 1455 Representation HAdd::RequiredInputRepresentation(int index) {
1445 if (index == 2) { 1456 if (index == 2) {
1446 Representation left_rep = left()->representation(); 1457 Representation left_rep = left()->representation();
1447 if (left_rep.IsExternal()) { 1458 if (left_rep.IsExternal()) {
1448 return Representation::Integer32(); 1459 if (external_add_type_ == AddOfExternalAndTagged) {
1460 return Representation::Tagged();
1461 } else {
1462 return Representation::Integer32();
1463 }
1449 } 1464 }
1450 } 1465 }
1451 return HArithmeticBinaryOperation::RequiredInputRepresentation(index); 1466 return HArithmeticBinaryOperation::RequiredInputRepresentation(index);
1452 } 1467 }
1453 1468
1454 1469
1455 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) { 1470 static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) {
1456 return arg1->representation().IsSpecialization() && 1471 return arg1->representation().IsSpecialization() &&
1457 arg2->EqualsInteger32Constant(identity); 1472 arg2->EqualsInteger32Constant(identity);
1458 } 1473 }
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4727 case HObjectAccess::kExternalMemory: 4742 case HObjectAccess::kExternalMemory:
4728 os << "[external-memory]"; 4743 os << "[external-memory]";
4729 break; 4744 break;
4730 } 4745 }
4731 4746
4732 return os << "@" << access.offset(); 4747 return os << "@" << access.offset();
4733 } 4748 }
4734 4749
4735 } // namespace internal 4750 } // namespace internal
4736 } // namespace v8 4751 } // namespace v8
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698