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

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

Issue 150663005: Optimize redundant HCompareMap instructions with known successors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 ToBooleanStub::Types expected_input_types_; 1522 ToBooleanStub::Types expected_input_types_;
1523 }; 1523 };
1524 1524
1525 1525
1526 class HCompareMap V8_FINAL : public HUnaryControlInstruction { 1526 class HCompareMap V8_FINAL : public HUnaryControlInstruction {
1527 public: 1527 public:
1528 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); 1528 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>);
1529 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, 1529 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>,
1530 HBasicBlock*, HBasicBlock*); 1530 HBasicBlock*, HBasicBlock*);
1531 1531
1532 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE {
1533 if (known_successor_index() != kNoKnownSuccessorIndex) {
1534 *block = SuccessorAt(known_successor_index());
1535 return true;
1536 }
1537 *block = NULL;
1538 return false;
1539 }
1540
1532 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1541 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1533 1542
1543 static const int kNoKnownSuccessorIndex = -1;
1544 int known_successor_index() const { return known_successor_index_; }
1545 void set_known_successor_index(int known_successor_index) {
1546 known_successor_index_ = known_successor_index;
1547 }
1548
1534 Unique<Map> map() const { return map_; } 1549 Unique<Map> map() const { return map_; }
1535 1550
1536 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1551 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1537 return Representation::Tagged(); 1552 return Representation::Tagged();
1538 } 1553 }
1539 1554
1540 DECLARE_CONCRETE_INSTRUCTION(CompareMap) 1555 DECLARE_CONCRETE_INSTRUCTION(CompareMap)
1541 1556
1542 protected: 1557 protected:
1543 virtual int RedefinedOperandIndex() { return 0; } 1558 virtual int RedefinedOperandIndex() { return 0; }
1544 1559
1545 private: 1560 private:
1546 HCompareMap(HValue* value, 1561 HCompareMap(HValue* value,
1547 Handle<Map> map, 1562 Handle<Map> map,
1548 HBasicBlock* true_target = NULL, 1563 HBasicBlock* true_target = NULL,
1549 HBasicBlock* false_target = NULL) 1564 HBasicBlock* false_target = NULL)
1550 : HUnaryControlInstruction(value, true_target, false_target), 1565 : HUnaryControlInstruction(value, true_target, false_target),
1551 map_(Unique<Map>(map)) { 1566 known_successor_index_(kNoKnownSuccessorIndex), map_(Unique<Map>(map)) {
1552 ASSERT(!map.is_null()); 1567 ASSERT(!map.is_null());
1553 } 1568 }
1554 1569
1570 int known_successor_index_;
1555 Unique<Map> map_; 1571 Unique<Map> map_;
1556 }; 1572 };
1557 1573
1558 1574
1559 class HContext V8_FINAL : public HTemplateInstruction<0> { 1575 class HContext V8_FINAL : public HTemplateInstruction<0> {
1560 public: 1576 public:
1561 static HContext* New(Zone* zone) { 1577 static HContext* New(Zone* zone) {
1562 return new(zone) HContext(); 1578 return new(zone) HContext();
1563 } 1579 }
1564 1580
(...skipping 5839 matching lines...) Expand 10 before | Expand all | Expand 10 after
7404 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7420 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7405 }; 7421 };
7406 7422
7407 7423
7408 #undef DECLARE_INSTRUCTION 7424 #undef DECLARE_INSTRUCTION
7409 #undef DECLARE_CONCRETE_INSTRUCTION 7425 #undef DECLARE_CONCRETE_INSTRUCTION
7410 7426
7411 } } // namespace v8::internal 7427 } } // namespace v8::internal
7412 7428
7413 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7429 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698