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

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

Issue 7132002: Remove RESTORE_CONTEXT flag from ia32 crankshaft codegen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Completed - use HContext everywhere except for HChange to tagged allocation. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 1005
1006 virtual bool CanTruncateToInt32() const { 1006 virtual bool CanTruncateToInt32() const {
1007 return CheckFlag(kTruncatingToInt32); 1007 return CheckFlag(kTruncatingToInt32);
1008 } 1008 }
1009 1009
1010 HValue* value() { return OperandAt(0); } 1010 HValue* value() { return OperandAt(0); }
1011 virtual void PrintDataTo(StringStream* stream); 1011 virtual void PrintDataTo(StringStream* stream);
1012 }; 1012 };
1013 1013
1014 1014
1015 class HThrow: public HUnaryOperation { 1015 class HThrow: public HTemplateInstruction<2> {
1016 public: 1016 public:
1017 explicit HThrow(HValue* value) : HUnaryOperation(value) { 1017 HThrow(HValue* context, HValue* value) {
1018 SetOperandAt(0, context);
1019 SetOperandAt(1, value);
1018 SetAllSideEffects(); 1020 SetAllSideEffects();
1019 } 1021 }
1020 1022
1021 virtual Representation RequiredInputRepresentation(int index) const { 1023 virtual Representation RequiredInputRepresentation(int index) const {
1022 return Representation::Tagged(); 1024 return Representation::Tagged();
1023 } 1025 }
1024 1026
1027 HValue* context() { return OperandAt(0); }
1028 HValue* value() { return OperandAt(1); }
1029
1025 DECLARE_CONCRETE_INSTRUCTION(Throw) 1030 DECLARE_CONCRETE_INSTRUCTION(Throw)
1026 }; 1031 };
1027 1032
1028 1033
1029 class HUseConst: public HUnaryOperation { 1034 class HUseConst: public HUnaryOperation {
1030 public: 1035 public:
1031 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } 1036 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { }
1032 1037
1033 virtual Representation RequiredInputRepresentation(int index) const { 1038 virtual Representation RequiredInputRepresentation(int index) const {
1034 return Representation::None(); 1039 return Representation::None();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 } 1093 }
1089 1094
1090 virtual void PrintDataTo(StringStream* stream); 1095 virtual void PrintDataTo(StringStream* stream);
1091 1096
1092 DECLARE_CONCRETE_INSTRUCTION(Change) 1097 DECLARE_CONCRETE_INSTRUCTION(Change)
1093 1098
1094 protected: 1099 protected:
1095 virtual bool DataEquals(HValue* other) { 1100 virtual bool DataEquals(HValue* other) {
1096 if (!other->IsChange()) return false; 1101 if (!other->IsChange()) return false;
1097 HChange* change = HChange::cast(other); 1102 HChange* change = HChange::cast(other);
1098 return value() == change->value() 1103 return to().Equals(change->to())
1099 && to().Equals(change->to())
1100 && deoptimize_on_undefined() == change->deoptimize_on_undefined(); 1104 && deoptimize_on_undefined() == change->deoptimize_on_undefined();
1101 } 1105 }
1102 1106
1103 private: 1107 private:
1104 Representation from_; 1108 Representation from_;
1105 bool deoptimize_on_undefined_; 1109 bool deoptimize_on_undefined_;
1106 }; 1110 };
1107 1111
1108 1112
1109 class HClampToUint8: public HUnaryOperation { 1113 class HClampToUint8: public HUnaryOperation {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 // use lists are correctly updated. 1242 // use lists are correctly updated.
1239 SetOperandAt(values_.length() - 1, value); 1243 SetOperandAt(values_.length() - 1, value);
1240 } 1244 }
1241 int ast_id_; 1245 int ast_id_;
1242 int pop_count_; 1246 int pop_count_;
1243 ZoneList<HValue*> values_; 1247 ZoneList<HValue*> values_;
1244 ZoneList<int> assigned_indexes_; 1248 ZoneList<int> assigned_indexes_;
1245 }; 1249 };
1246 1250
1247 1251
1248 class HStackCheck: public HTemplateInstruction<0> { 1252 class HStackCheck: public HTemplateInstruction<1> {
1249 public: 1253 public:
1250 enum Type { 1254 enum Type {
1251 kFunctionEntry, 1255 kFunctionEntry,
1252 kBackwardsBranch 1256 kBackwardsBranch
1253 }; 1257 };
1254 1258
1255 explicit HStackCheck(Type type) : type_(type) { } 1259 explicit HStackCheck(HValue* context, Type type) : type_(type) {
1260 SetOperandAt(0, context);
1261 }
1262
1263 HValue* context() { return OperandAt(0); }
1256 1264
1257 virtual Representation RequiredInputRepresentation(int index) const { 1265 virtual Representation RequiredInputRepresentation(int index) const {
1258 return Representation::None(); 1266 return Representation::Tagged();
1259 } 1267 }
1260 1268
1261 void Eliminate() { 1269 void Eliminate() {
1262 // The stack check eliminator might try to eliminate the same stack 1270 // The stack check eliminator might try to eliminate the same stack
1263 // check instruction multiple times. 1271 // check instruction multiple times.
1264 if (IsLinked()) { 1272 if (IsLinked()) {
1265 DeleteFromGraph(); 1273 DeleteFromGraph();
1266 } 1274 }
1267 } 1275 }
1268 1276
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 return Representation::Tagged(); 1637 return Representation::Tagged();
1630 } 1638 }
1631 1639
1632 HValue* context() { return first(); } 1640 HValue* context() { return first(); }
1633 HValue* constructor() { return second(); } 1641 HValue* constructor() { return second(); }
1634 1642
1635 DECLARE_CONCRETE_INSTRUCTION(CallNew) 1643 DECLARE_CONCRETE_INSTRUCTION(CallNew)
1636 }; 1644 };
1637 1645
1638 1646
1639 class HCallRuntime: public HCall<0> { 1647 class HCallRuntime: public HCall<1> {
1640 public: 1648 public:
1641 HCallRuntime(Handle<String> name, 1649 HCallRuntime(HValue* context,
1650 Handle<String> name,
1642 const Runtime::Function* c_function, 1651 const Runtime::Function* c_function,
1643 int argument_count) 1652 int argument_count)
1644 : HCall<0>(argument_count), c_function_(c_function), name_(name) { } 1653 : HCall<1>(argument_count), c_function_(c_function), name_(name) {
1654 SetOperandAt(0, context);
1655 }
1656
1645 virtual void PrintDataTo(StringStream* stream); 1657 virtual void PrintDataTo(StringStream* stream);
1646 1658
1659 HValue* context() { return OperandAt(0); }
1647 const Runtime::Function* function() const { return c_function_; } 1660 const Runtime::Function* function() const { return c_function_; }
1648 Handle<String> name() const { return name_; } 1661 Handle<String> name() const { return name_; }
1649 1662
1650 virtual Representation RequiredInputRepresentation(int index) const { 1663 virtual Representation RequiredInputRepresentation(int index) const {
1651 return Representation::None(); 1664 return Representation::Tagged();
1652 } 1665 }
1653 1666
1654 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) 1667 DECLARE_CONCRETE_INSTRUCTION(CallRuntime)
1655 1668
1656 private: 1669 private:
1657 const Runtime::Function* c_function_; 1670 const Runtime::Function* c_function_;
1658 Handle<String> name_; 1671 Handle<String> name_;
1659 }; 1672 };
1660 1673
1661 1674
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 } 1767 }
1755 virtual HType CalculateInferredType(); 1768 virtual HType CalculateInferredType();
1756 1769
1757 DECLARE_CONCRETE_INSTRUCTION(BitNot) 1770 DECLARE_CONCRETE_INSTRUCTION(BitNot)
1758 1771
1759 protected: 1772 protected:
1760 virtual bool DataEquals(HValue* other) { return true; } 1773 virtual bool DataEquals(HValue* other) { return true; }
1761 }; 1774 };
1762 1775
1763 1776
1764 class HUnaryMathOperation: public HUnaryOperation { 1777 class HUnaryMathOperation: public HTemplateInstruction<2> {
1765 public: 1778 public:
1766 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) 1779 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op)
1767 : HUnaryOperation(value), op_(op) { 1780 : op_(op) {
1781 SetOperandAt(0, context);
1782 SetOperandAt(1, value);
1768 switch (op) { 1783 switch (op) {
1769 case kMathFloor: 1784 case kMathFloor:
1770 case kMathRound: 1785 case kMathRound:
1771 case kMathCeil: 1786 case kMathCeil:
1772 set_representation(Representation::Integer32()); 1787 set_representation(Representation::Integer32());
1773 break; 1788 break;
1774 case kMathAbs: 1789 case kMathAbs:
1775 set_representation(Representation::Tagged()); 1790 set_representation(Representation::Tagged());
1776 SetFlag(kFlexibleRepresentation); 1791 SetFlag(kFlexibleRepresentation);
1777 break; 1792 break;
1778 case kMathSqrt: 1793 case kMathSqrt:
1779 case kMathPowHalf: 1794 case kMathPowHalf:
1780 case kMathLog: 1795 case kMathLog:
1781 case kMathSin: 1796 case kMathSin:
1782 case kMathCos: 1797 case kMathCos:
1783 set_representation(Representation::Double()); 1798 set_representation(Representation::Double());
1784 break; 1799 break;
1785 default: 1800 default:
1786 UNREACHABLE(); 1801 UNREACHABLE();
1787 } 1802 }
1788 SetFlag(kUseGVN); 1803 SetFlag(kUseGVN);
1789 } 1804 }
1790 1805
1806 HValue* context() { return OperandAt(0); }
1807 HValue* value() { return OperandAt(1); }
1808
1791 virtual void PrintDataTo(StringStream* stream); 1809 virtual void PrintDataTo(StringStream* stream);
1792 1810
1793 virtual HType CalculateInferredType(); 1811 virtual HType CalculateInferredType();
1794 1812
1795 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 1813 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
1796 1814
1797 virtual Representation RequiredInputRepresentation(int index) const { 1815 virtual Representation RequiredInputRepresentation(int index) const {
1798 switch (op_) { 1816 if (index == 0) {
1799 case kMathFloor: 1817 return Representation::Tagged();
1800 case kMathRound: 1818 } else {
1801 case kMathCeil: 1819 switch (op_) {
1802 case kMathSqrt: 1820 case kMathFloor:
1803 case kMathPowHalf: 1821 case kMathRound:
1804 case kMathLog: 1822 case kMathCeil:
1805 case kMathSin: 1823 case kMathSqrt:
1806 case kMathCos: 1824 case kMathPowHalf:
1807 return Representation::Double(); 1825 case kMathLog:
1808 case kMathAbs: 1826 case kMathSin:
1809 return representation(); 1827 case kMathCos:
1810 default: 1828 return Representation::Double();
1811 UNREACHABLE(); 1829 case kMathAbs:
1812 return Representation::None(); 1830 return representation();
1831 default:
1832 UNREACHABLE();
1833 return Representation::None();
1834 }
1813 } 1835 }
1814 } 1836 }
1815 1837
1816 virtual HValue* Canonicalize() { 1838 virtual HValue* Canonicalize() {
1817 // If the input is integer32 then we replace the floor instruction 1839 // If the input is integer32 then we replace the floor instruction
1818 // with its inputs. This happens before the representation changes are 1840 // with its inputs. This happens before the representation changes are
1819 // introduced. 1841 // introduced.
1820 if (op() == kMathFloor) { 1842 if (op() == kMathFloor) {
1821 if (value()->representation().IsInteger32()) return value(); 1843 if (value()->representation().IsInteger32()) return value();
1822 } 1844 }
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 // The following two values represent the int32 and the double value of the 2327 // The following two values represent the int32 and the double value of the
2306 // given constant if there is a lossless conversion between the constant 2328 // given constant if there is a lossless conversion between the constant
2307 // and the specific representation. 2329 // and the specific representation.
2308 bool has_int32_value_ : 1; 2330 bool has_int32_value_ : 1;
2309 bool has_double_value_ : 1; 2331 bool has_double_value_ : 1;
2310 int32_t int32_value_; 2332 int32_t int32_value_;
2311 double double_value_; 2333 double double_value_;
2312 }; 2334 };
2313 2335
2314 2336
2315 class HBinaryOperation: public HTemplateInstruction<2> { 2337 class HBinaryOperation: public HTemplateInstruction<3> {
2316 public: 2338 public:
2317 HBinaryOperation(HValue* left, HValue* right) { 2339 HBinaryOperation(HValue* context, HValue* left, HValue* right) {
2318 ASSERT(left != NULL && right != NULL); 2340 ASSERT(left != NULL && right != NULL);
2319 SetOperandAt(0, left); 2341 SetOperandAt(0, context);
2320 SetOperandAt(1, right); 2342 SetOperandAt(1, left);
2343 SetOperandAt(2, right);
2321 } 2344 }
2322 2345
2323 HValue* left() { return OperandAt(0); } 2346 HValue* context() { return OperandAt(0); }
2324 HValue* right() { return OperandAt(1); } 2347 HValue* left() { return OperandAt(1); }
2348 HValue* right() { return OperandAt(2); }
2325 2349
2326 // TODO(kasperl): Move these helpers to the IA-32 Lithium 2350 // TODO(kasperl): Move these helpers to the IA-32 Lithium
2327 // instruction sequence builder. 2351 // instruction sequence builder.
2328 HValue* LeastConstantOperand() { 2352 HValue* LeastConstantOperand() {
2329 if (IsCommutative() && left()->IsConstant()) return right(); 2353 if (IsCommutative() && left()->IsConstant()) return right();
2330 return left(); 2354 return left();
2331 } 2355 }
2332 HValue* MostConstantOperand() { 2356 HValue* MostConstantOperand() {
2333 if (IsCommutative() && left()->IsConstant()) return left(); 2357 if (IsCommutative() && left()->IsConstant()) return left();
2334 return right(); 2358 return right();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 HValue* arguments() { return OperandAt(0); } 2454 HValue* arguments() { return OperandAt(0); }
2431 HValue* length() { return OperandAt(1); } 2455 HValue* length() { return OperandAt(1); }
2432 HValue* index() { return OperandAt(2); } 2456 HValue* index() { return OperandAt(2); }
2433 2457
2434 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 2458 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
2435 2459
2436 virtual bool DataEquals(HValue* other) { return true; } 2460 virtual bool DataEquals(HValue* other) { return true; }
2437 }; 2461 };
2438 2462
2439 2463
2440 class HBoundsCheck: public HBinaryOperation { 2464 class HBoundsCheck: public HTemplateInstruction<2> {
2441 public: 2465 public:
2442 HBoundsCheck(HValue* index, HValue* length) 2466 HBoundsCheck(HValue* index, HValue* length) {
2443 : HBinaryOperation(index, length) { 2467 SetOperandAt(0, index);
2468 SetOperandAt(1, length);
2444 set_representation(Representation::Integer32()); 2469 set_representation(Representation::Integer32());
2445 SetFlag(kUseGVN); 2470 SetFlag(kUseGVN);
2446 } 2471 }
2447 2472
2448 virtual Representation RequiredInputRepresentation(int index) const { 2473 virtual Representation RequiredInputRepresentation(int index) const {
2449 return Representation::Integer32(); 2474 return Representation::Integer32();
2450 } 2475 }
2451 2476
2452 #ifdef DEBUG 2477 #ifdef DEBUG
2453 virtual void Verify(); 2478 virtual void Verify();
2454 #endif 2479 #endif
2455 2480
2456 HValue* index() { return left(); } 2481 HValue* index() { return OperandAt(0); }
2457 HValue* length() { return right(); } 2482 HValue* length() { return OperandAt(1); }
2458 2483
2459 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 2484 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
2460 2485
2461 protected: 2486 protected:
2462 virtual bool DataEquals(HValue* other) { return true; } 2487 virtual bool DataEquals(HValue* other) { return true; }
2463 }; 2488 };
2464 2489
2465 2490
2466 class HBitwiseBinaryOperation: public HBinaryOperation { 2491 class HBitwiseBinaryOperation: public HBinaryOperation {
2467 public: 2492 public:
2468 HBitwiseBinaryOperation(HValue* left, HValue* right) 2493 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right)
2469 : HBinaryOperation(left, right) { 2494 : HBinaryOperation(context, left, right) {
2470 set_representation(Representation::Tagged()); 2495 set_representation(Representation::Tagged());
2471 SetFlag(kFlexibleRepresentation); 2496 SetFlag(kFlexibleRepresentation);
2472 SetAllSideEffects(); 2497 SetAllSideEffects();
2473 } 2498 }
2474 2499
2475 virtual Representation RequiredInputRepresentation(int index) const { 2500 virtual Representation RequiredInputRepresentation(int index) const {
2476 return representation(); 2501 if (index == 0) {
Kevin Millikin (Chromium) 2011/06/29 08:36:20 I sort of prefer return (index == 0) ? Representa
William Hesse 2011/06/29 10:30:21 All changed to return cond ? value1 : valu
2502 return Representation::Tagged();
2503 } else {
2504 return representation();
2505 }
2477 } 2506 }
2478 2507
2479 virtual void RepresentationChanged(Representation to) { 2508 virtual void RepresentationChanged(Representation to) {
2480 if (!to.IsTagged()) { 2509 if (!to.IsTagged()) {
2481 ASSERT(to.IsInteger32()); 2510 ASSERT(to.IsInteger32());
2482 ClearAllSideEffects(); 2511 ClearAllSideEffects();
2483 SetFlag(kTruncatingToInt32); 2512 SetFlag(kTruncatingToInt32);
2484 SetFlag(kUseGVN); 2513 SetFlag(kUseGVN);
2485 } 2514 }
2486 } 2515 }
2487 2516
2488 virtual HType CalculateInferredType(); 2517 virtual HType CalculateInferredType();
2489 2518
2490 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 2519 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
2491 }; 2520 };
2492 2521
2493 2522
2494 class HArithmeticBinaryOperation: public HBinaryOperation { 2523 class HArithmeticBinaryOperation: public HBinaryOperation {
2495 public: 2524 public:
2496 HArithmeticBinaryOperation(HValue* left, HValue* right) 2525 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
2497 : HBinaryOperation(left, right) { 2526 : HBinaryOperation(context, left, right) {
2498 set_representation(Representation::Tagged()); 2527 set_representation(Representation::Tagged());
2499 SetFlag(kFlexibleRepresentation); 2528 SetFlag(kFlexibleRepresentation);
2500 SetAllSideEffects(); 2529 SetAllSideEffects();
2501 } 2530 }
2502 2531
2503 virtual void RepresentationChanged(Representation to) { 2532 virtual void RepresentationChanged(Representation to) {
2504 if (!to.IsTagged()) { 2533 if (!to.IsTagged()) {
2505 ClearAllSideEffects(); 2534 ClearAllSideEffects();
2506 SetFlag(kUseGVN); 2535 SetFlag(kUseGVN);
2507 } 2536 }
2508 } 2537 }
2509 2538
2510 virtual HType CalculateInferredType(); 2539 virtual HType CalculateInferredType();
2511 virtual Representation RequiredInputRepresentation(int index) const { 2540 virtual Representation RequiredInputRepresentation(int index) const {
2512 return representation(); 2541 if (index == 0) {
2542 return Representation::Tagged();
2543 } else {
2544 return representation();
2545 }
2513 } 2546 }
2514 virtual Representation InferredRepresentation() { 2547 virtual Representation InferredRepresentation() {
2515 if (left()->representation().Equals(right()->representation())) { 2548 if (left()->representation().Equals(right()->representation())) {
2516 return left()->representation(); 2549 return left()->representation();
2517 } 2550 }
2518 return HValue::InferredRepresentation(); 2551 return HValue::InferredRepresentation();
2519 } 2552 }
2520 }; 2553 };
2521 2554
2522 2555
2523 class HCompare: public HBinaryOperation { 2556 class HCompare: public HBinaryOperation {
2524 public: 2557 public:
2525 HCompare(HValue* left, HValue* right, Token::Value token) 2558 HCompare(HValue* context, HValue* left, HValue* right, Token::Value token)
2526 : HBinaryOperation(left, right), token_(token) { 2559 : HBinaryOperation(context, left, right), token_(token) {
2527 ASSERT(Token::IsCompareOp(token)); 2560 ASSERT(Token::IsCompareOp(token));
2528 set_representation(Representation::Tagged()); 2561 set_representation(Representation::Tagged());
2529 SetAllSideEffects(); 2562 SetAllSideEffects();
2530 } 2563 }
2531 2564
2532 void SetInputRepresentation(Representation r); 2565 void SetInputRepresentation(Representation r);
2533 2566
2534 virtual bool EmitAtUses() { 2567 virtual bool EmitAtUses() {
2535 return !HasSideEffects() && !HasMultipleUses(); 2568 return !HasSideEffects() && !HasMultipleUses();
2536 } 2569 }
2537 2570
2538 virtual Representation RequiredInputRepresentation(int index) const { 2571 virtual Representation RequiredInputRepresentation(int index) const {
2539 return input_representation_; 2572 if (index == 0) {
2573 return Representation::Tagged();
2574 } else {
2575 return input_representation_;
2576 }
2540 } 2577 }
2541 Representation GetInputRepresentation() const { 2578 Representation GetInputRepresentation() const {
2542 return input_representation_; 2579 return input_representation_;
2543 } 2580 }
2544 Token::Value token() const { return token_; } 2581 Token::Value token() const { return token_; }
2545 virtual void PrintDataTo(StringStream* stream); 2582 virtual void PrintDataTo(StringStream* stream);
2546 2583
2547 virtual HType CalculateInferredType(); 2584 virtual HType CalculateInferredType();
2548 2585
2549 virtual intptr_t Hashcode() { 2586 virtual intptr_t Hashcode() {
2550 return HValue::Hashcode() * 7 + token_; 2587 return HValue::Hashcode() * 7 + token_;
2551 } 2588 }
2552 2589
2553 DECLARE_CONCRETE_INSTRUCTION(Compare) 2590 DECLARE_CONCRETE_INSTRUCTION(Compare)
2554 2591
2555 protected: 2592 protected:
2556 virtual bool DataEquals(HValue* other) { 2593 virtual bool DataEquals(HValue* other) {
2557 HCompare* comp = HCompare::cast(other); 2594 HCompare* comp = HCompare::cast(other);
2558 return token_ == comp->token(); 2595 return token_ == comp->token();
2559 } 2596 }
2560 2597
2561 private: 2598 private:
2562 Representation input_representation_; 2599 Representation input_representation_;
2563 Token::Value token_; 2600 Token::Value token_;
2564 }; 2601 };
2565 2602
2566 2603
2567 class HCompareObjectEq: public HBinaryOperation { 2604 class HCompareObjectEq: public HTemplateInstruction<2> {
2568 public: 2605 public:
2569 HCompareObjectEq(HValue* left, HValue* right) 2606 HCompareObjectEq(HValue* left, HValue* right) {
2570 : HBinaryOperation(left, right) { 2607 SetOperandAt(0, left);
2608 SetOperandAt(1, right);
2571 set_representation(Representation::Tagged()); 2609 set_representation(Representation::Tagged());
2572 SetFlag(kUseGVN); 2610 SetFlag(kUseGVN);
2573 SetFlag(kDependsOnMaps); 2611 SetFlag(kDependsOnMaps);
2574 } 2612 }
2575 2613
2614 HValue* left() { return OperandAt(0); }
2615 HValue* right() { return OperandAt(1); }
2616
2576 virtual bool EmitAtUses() { 2617 virtual bool EmitAtUses() {
2577 return !HasSideEffects() && !HasMultipleUses(); 2618 return !HasSideEffects() && !HasMultipleUses();
2578 } 2619 }
2579 2620
2580 virtual Representation RequiredInputRepresentation(int index) const { 2621 virtual Representation RequiredInputRepresentation(int index) const {
2581 return Representation::Tagged(); 2622 return Representation::Tagged();
2582 } 2623 }
2583 virtual HType CalculateInferredType(); 2624 virtual HType CalculateInferredType();
2584 2625
2585 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEq) 2626 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEq)
2586 2627
2587 protected: 2628 protected:
2588 virtual bool DataEquals(HValue* other) { return true; } 2629 virtual bool DataEquals(HValue* other) { return true; }
2589 }; 2630 };
2590 2631
2591 2632
2592 class HCompareConstantEq: public HUnaryOperation { 2633 class HCompareConstantEq: public HUnaryOperation {
2593 public: 2634 public:
2594 HCompareConstantEq(HValue* left, int right, Token::Value op) 2635 HCompareConstantEq(HValue* left, int right, Token::Value op)
2595 : HUnaryOperation(left), op_(op), right_(right) { 2636 : HUnaryOperation(left), op_(op), right_(right) {
2596 ASSERT(op == Token::EQ_STRICT); 2637 ASSERT(op == Token::EQ_STRICT);
2597 set_representation(Representation::Tagged()); 2638 set_representation(Representation::Tagged());
2598 SetFlag(kUseGVN); 2639 SetFlag(kUseGVN);
2599 } 2640 }
2600 2641
2601 Token::Value op() const { return op_; } 2642 Token::Value op() const { return op_; }
2602 int right() const { return right_; } 2643 int right() const { return right_; }
2644 HValue* left() { return value(); }
Kevin Millikin (Chromium) 2011/06/29 08:36:20 It might make sense to define left() before right(
William Hesse 2011/06/29 10:30:21 Done.
2603 2645
2604 virtual bool EmitAtUses() { 2646 virtual bool EmitAtUses() {
2605 return !HasSideEffects() && !HasMultipleUses(); 2647 return !HasSideEffects() && !HasMultipleUses();
2606 } 2648 }
2607 2649
2608 virtual Representation RequiredInputRepresentation(int index) const { 2650 virtual Representation RequiredInputRepresentation(int index) const {
2609 return Representation::Integer32(); 2651 return Representation::Integer32();
2610 } 2652 }
2611 2653
2612 virtual HType CalculateInferredType() { return HType::Boolean(); } 2654 virtual HType CalculateInferredType() { return HType::Boolean(); }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2816 virtual bool DataEquals(HValue* other) { 2858 virtual bool DataEquals(HValue* other) {
2817 HTypeofIs* b = HTypeofIs::cast(other); 2859 HTypeofIs* b = HTypeofIs::cast(other);
2818 return type_literal_.is_identical_to(b->type_literal_); 2860 return type_literal_.is_identical_to(b->type_literal_);
2819 } 2861 }
2820 2862
2821 private: 2863 private:
2822 Handle<String> type_literal_; 2864 Handle<String> type_literal_;
2823 }; 2865 };
2824 2866
2825 2867
2826 class HInstanceOf: public HTemplateInstruction<3> { 2868 class HInstanceOf: public HBinaryOperation {
2827 public: 2869 public:
2828 HInstanceOf(HValue* context, HValue* left, HValue* right) { 2870 HInstanceOf(HValue* context, HValue* left, HValue* right)
2829 SetOperandAt(0, context); 2871 : HBinaryOperation(context, left, right) {
2830 SetOperandAt(1, left);
2831 SetOperandAt(2, right);
2832 set_representation(Representation::Tagged()); 2872 set_representation(Representation::Tagged());
2833 SetAllSideEffects(); 2873 SetAllSideEffects();
2834 } 2874 }
2835 2875
2836 HValue* context() { return OperandAt(0); }
2837 HValue* left() { return OperandAt(1); }
2838 HValue* right() { return OperandAt(2); }
2839
2840 virtual Representation RequiredInputRepresentation(int index) const { 2876 virtual Representation RequiredInputRepresentation(int index) const {
2841 return Representation::Tagged(); 2877 return Representation::Tagged();
2842 } 2878 }
2843 2879
2844 virtual HType CalculateInferredType(); 2880 virtual HType CalculateInferredType();
2845 2881
2846 virtual void PrintDataTo(StringStream* stream); 2882 virtual void PrintDataTo(StringStream* stream);
2847 2883
2848 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 2884 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
2849 }; 2885 };
2850 2886
2851 2887
2852 class HInstanceOfKnownGlobal: public HUnaryOperation { 2888 class HInstanceOfKnownGlobal: public HTemplateInstruction<2> {
2853 public: 2889 public:
2854 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) 2890 HInstanceOfKnownGlobal(HValue* context,
2855 : HUnaryOperation(left), function_(right) { 2891 HValue* left,
2892 Handle<JSFunction> right)
2893 : function_(right) {
2894 SetOperandAt(0, context);
2895 SetOperandAt(1, left);
2856 set_representation(Representation::Tagged()); 2896 set_representation(Representation::Tagged());
2857 SetAllSideEffects(); 2897 SetAllSideEffects();
2858 } 2898 }
2859 2899
2900 HValue* context() { return OperandAt(0); }
2901 HValue* left() { return OperandAt(1); }
2860 Handle<JSFunction> function() { return function_; } 2902 Handle<JSFunction> function() { return function_; }
2861 2903
2862 virtual Representation RequiredInputRepresentation(int index) const { 2904 virtual Representation RequiredInputRepresentation(int index) const {
2863 return Representation::Tagged(); 2905 return Representation::Tagged();
2864 } 2906 }
2865 2907
2866 virtual HType CalculateInferredType(); 2908 virtual HType CalculateInferredType();
2867 2909
2868 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) 2910 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
2869 2911
2870 private: 2912 private:
2871 Handle<JSFunction> function_; 2913 Handle<JSFunction> function_;
2872 }; 2914 };
2873 2915
2874 2916
2875 class HPower: public HBinaryOperation { 2917 class HPower: public HTemplateInstruction<2> {
2876 public: 2918 public:
2877 HPower(HValue* left, HValue* right) 2919 HPower(HValue* left, HValue* right) {
2878 : HBinaryOperation(left, right) { 2920 SetOperandAt(0, left);
2921 SetOperandAt(1, right);
2879 set_representation(Representation::Double()); 2922 set_representation(Representation::Double());
2880 SetFlag(kUseGVN); 2923 SetFlag(kUseGVN);
2881 } 2924 }
2882 2925
2926 HValue* left() { return OperandAt(0); }
2927 HValue* right() { return OperandAt(1); }
2928
2883 virtual Representation RequiredInputRepresentation(int index) const { 2929 virtual Representation RequiredInputRepresentation(int index) const {
2884 return (index == 1) ? Representation::None() : Representation::Double(); 2930 if (index == 0) {
2931 return Representation::Double();
2932 } else {
2933 return Representation::None();
2934 }
2885 } 2935 }
2886 2936
2887 DECLARE_CONCRETE_INSTRUCTION(Power) 2937 DECLARE_CONCRETE_INSTRUCTION(Power)
2888 2938
2889 protected: 2939 protected:
2890 virtual bool DataEquals(HValue* other) { return true; } 2940 virtual bool DataEquals(HValue* other) { return true; }
2891 }; 2941 };
2892 2942
2893 2943
2894 class HAdd: public HArithmeticBinaryOperation { 2944 class HAdd: public HArithmeticBinaryOperation {
2895 public: 2945 public:
2896 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2946 HAdd(HValue* context, HValue* left, HValue* right)
2947 : HArithmeticBinaryOperation(context, left, right) {
2897 SetFlag(kCanOverflow); 2948 SetFlag(kCanOverflow);
2898 } 2949 }
2899 2950
2900 // Add is only commutative if two integer values are added and not if two 2951 // Add is only commutative if two integer values are added and not if two
2901 // tagged values are added (because it might be a String concatenation). 2952 // tagged values are added (because it might be a String concatenation).
2902 virtual bool IsCommutative() const { 2953 virtual bool IsCommutative() const {
2903 return !representation().IsTagged(); 2954 return !representation().IsTagged();
2904 } 2955 }
2905 2956
2906 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2957 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2907 2958
2908 virtual HType CalculateInferredType(); 2959 virtual HType CalculateInferredType();
2909 2960
2910 DECLARE_CONCRETE_INSTRUCTION(Add) 2961 DECLARE_CONCRETE_INSTRUCTION(Add)
2911 2962
2912 protected: 2963 protected:
2913 virtual bool DataEquals(HValue* other) { return true; } 2964 virtual bool DataEquals(HValue* other) { return true; }
2914 2965
2915 virtual Range* InferRange(); 2966 virtual Range* InferRange();
2916 }; 2967 };
2917 2968
2918 2969
2919 class HSub: public HArithmeticBinaryOperation { 2970 class HSub: public HArithmeticBinaryOperation {
2920 public: 2971 public:
2921 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2972 HSub(HValue* context, HValue* left, HValue* right)
2973 : HArithmeticBinaryOperation(context, left, right) {
2922 SetFlag(kCanOverflow); 2974 SetFlag(kCanOverflow);
2923 } 2975 }
2924 2976
2925 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2977 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2926 2978
2927 DECLARE_CONCRETE_INSTRUCTION(Sub) 2979 DECLARE_CONCRETE_INSTRUCTION(Sub)
2928 2980
2929 protected: 2981 protected:
2930 virtual bool DataEquals(HValue* other) { return true; } 2982 virtual bool DataEquals(HValue* other) { return true; }
2931 2983
2932 virtual Range* InferRange(); 2984 virtual Range* InferRange();
2933 }; 2985 };
2934 2986
2935 2987
2936 class HMul: public HArithmeticBinaryOperation { 2988 class HMul: public HArithmeticBinaryOperation {
2937 public: 2989 public:
2938 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2990 HMul(HValue* context, HValue* left, HValue* right)
2991 : HArithmeticBinaryOperation(context, left, right) {
2939 SetFlag(kCanOverflow); 2992 SetFlag(kCanOverflow);
2940 } 2993 }
2941 2994
2942 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2995 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2943 2996
2944 // Only commutative if it is certain that not two objects are multiplicated. 2997 // Only commutative if it is certain that not two objects are multiplicated.
2945 virtual bool IsCommutative() const { 2998 virtual bool IsCommutative() const {
2946 return !representation().IsTagged(); 2999 return !representation().IsTagged();
2947 } 3000 }
2948 3001
2949 DECLARE_CONCRETE_INSTRUCTION(Mul) 3002 DECLARE_CONCRETE_INSTRUCTION(Mul)
2950 3003
2951 protected: 3004 protected:
2952 virtual bool DataEquals(HValue* other) { return true; } 3005 virtual bool DataEquals(HValue* other) { return true; }
2953 3006
2954 virtual Range* InferRange(); 3007 virtual Range* InferRange();
2955 }; 3008 };
2956 3009
2957 3010
2958 class HMod: public HArithmeticBinaryOperation { 3011 class HMod: public HArithmeticBinaryOperation {
2959 public: 3012 public:
2960 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 3013 HMod(HValue* context, HValue* left, HValue* right)
3014 : HArithmeticBinaryOperation(context, left, right) {
2961 SetFlag(kCanBeDivByZero); 3015 SetFlag(kCanBeDivByZero);
2962 } 3016 }
2963 3017
2964 bool HasPowerOf2Divisor() { 3018 bool HasPowerOf2Divisor() {
2965 if (right()->IsConstant() && 3019 if (right()->IsConstant() &&
2966 HConstant::cast(right())->HasInteger32Value()) { 3020 HConstant::cast(right())->HasInteger32Value()) {
2967 int32_t value = HConstant::cast(right())->Integer32Value(); 3021 int32_t value = HConstant::cast(right())->Integer32Value();
2968 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value)); 3022 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
2969 } 3023 }
2970 3024
2971 return false; 3025 return false;
2972 } 3026 }
2973 3027
2974 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 3028 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2975 3029
2976 DECLARE_CONCRETE_INSTRUCTION(Mod) 3030 DECLARE_CONCRETE_INSTRUCTION(Mod)
2977 3031
2978 protected: 3032 protected:
2979 virtual bool DataEquals(HValue* other) { return true; } 3033 virtual bool DataEquals(HValue* other) { return true; }
2980 3034
2981 virtual Range* InferRange(); 3035 virtual Range* InferRange();
2982 }; 3036 };
2983 3037
2984 3038
2985 class HDiv: public HArithmeticBinaryOperation { 3039 class HDiv: public HArithmeticBinaryOperation {
2986 public: 3040 public:
2987 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 3041 HDiv(HValue* context, HValue* left, HValue* right)
3042 : HArithmeticBinaryOperation(context, left, right) {
2988 SetFlag(kCanBeDivByZero); 3043 SetFlag(kCanBeDivByZero);
2989 SetFlag(kCanOverflow); 3044 SetFlag(kCanOverflow);
2990 } 3045 }
2991 3046
2992 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 3047 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2993 3048
2994 DECLARE_CONCRETE_INSTRUCTION(Div) 3049 DECLARE_CONCRETE_INSTRUCTION(Div)
2995 3050
2996 protected: 3051 protected:
2997 virtual bool DataEquals(HValue* other) { return true; } 3052 virtual bool DataEquals(HValue* other) { return true; }
2998 3053
2999 virtual Range* InferRange(); 3054 virtual Range* InferRange();
3000 }; 3055 };
3001 3056
3002 3057
3003 class HBitAnd: public HBitwiseBinaryOperation { 3058 class HBitAnd: public HBitwiseBinaryOperation {
3004 public: 3059 public:
3005 HBitAnd(HValue* left, HValue* right) 3060 HBitAnd(HValue* context, HValue* left, HValue* right)
3006 : HBitwiseBinaryOperation(left, right) { } 3061 : HBitwiseBinaryOperation(context, left, right) { }
3007 3062
3008 virtual bool IsCommutative() const { return true; } 3063 virtual bool IsCommutative() const { return true; }
3009 virtual HType CalculateInferredType(); 3064 virtual HType CalculateInferredType();
3010 3065
3011 DECLARE_CONCRETE_INSTRUCTION(BitAnd) 3066 DECLARE_CONCRETE_INSTRUCTION(BitAnd)
3012 3067
3013 protected: 3068 protected:
3014 virtual bool DataEquals(HValue* other) { return true; } 3069 virtual bool DataEquals(HValue* other) { return true; }
3015 3070
3016 virtual Range* InferRange(); 3071 virtual Range* InferRange();
3017 }; 3072 };
3018 3073
3019 3074
3020 class HBitXor: public HBitwiseBinaryOperation { 3075 class HBitXor: public HBitwiseBinaryOperation {
3021 public: 3076 public:
3022 HBitXor(HValue* left, HValue* right) 3077 HBitXor(HValue* context, HValue* left, HValue* right)
3023 : HBitwiseBinaryOperation(left, right) { } 3078 : HBitwiseBinaryOperation(context, left, right) { }
3024 3079
3025 virtual bool IsCommutative() const { return true; } 3080 virtual bool IsCommutative() const { return true; }
3026 virtual HType CalculateInferredType(); 3081 virtual HType CalculateInferredType();
3027 3082
3028 DECLARE_CONCRETE_INSTRUCTION(BitXor) 3083 DECLARE_CONCRETE_INSTRUCTION(BitXor)
3029 3084
3030 protected: 3085 protected:
3031 virtual bool DataEquals(HValue* other) { return true; } 3086 virtual bool DataEquals(HValue* other) { return true; }
3032 }; 3087 };
3033 3088
3034 3089
3035 class HBitOr: public HBitwiseBinaryOperation { 3090 class HBitOr: public HBitwiseBinaryOperation {
3036 public: 3091 public:
3037 HBitOr(HValue* left, HValue* right) 3092 HBitOr(HValue* context, HValue* left, HValue* right)
3038 : HBitwiseBinaryOperation(left, right) { } 3093 : HBitwiseBinaryOperation(context, left, right) { }
3039 3094
3040 virtual bool IsCommutative() const { return true; } 3095 virtual bool IsCommutative() const { return true; }
3041 virtual HType CalculateInferredType(); 3096 virtual HType CalculateInferredType();
3042 3097
3043 DECLARE_CONCRETE_INSTRUCTION(BitOr) 3098 DECLARE_CONCRETE_INSTRUCTION(BitOr)
3044 3099
3045 protected: 3100 protected:
3046 virtual bool DataEquals(HValue* other) { return true; } 3101 virtual bool DataEquals(HValue* other) { return true; }
3047 3102
3048 virtual Range* InferRange(); 3103 virtual Range* InferRange();
3049 }; 3104 };
3050 3105
3051 3106
3052 class HShl: public HBitwiseBinaryOperation { 3107 class HShl: public HBitwiseBinaryOperation {
3053 public: 3108 public:
3054 HShl(HValue* left, HValue* right) 3109 HShl(HValue* context, HValue* left, HValue* right)
3055 : HBitwiseBinaryOperation(left, right) { } 3110 : HBitwiseBinaryOperation(context, left, right) { }
3056 3111
3057 virtual Range* InferRange(); 3112 virtual Range* InferRange();
3058 virtual HType CalculateInferredType(); 3113 virtual HType CalculateInferredType();
3059 3114
3060 DECLARE_CONCRETE_INSTRUCTION(Shl) 3115 DECLARE_CONCRETE_INSTRUCTION(Shl)
3061 3116
3062 protected: 3117 protected:
3063 virtual bool DataEquals(HValue* other) { return true; } 3118 virtual bool DataEquals(HValue* other) { return true; }
3064 }; 3119 };
3065 3120
3066 3121
3067 class HShr: public HBitwiseBinaryOperation { 3122 class HShr: public HBitwiseBinaryOperation {
3068 public: 3123 public:
3069 HShr(HValue* left, HValue* right) 3124 HShr(HValue* context, HValue* left, HValue* right)
3070 : HBitwiseBinaryOperation(left, right) { } 3125 : HBitwiseBinaryOperation(context, left, right) { }
3071 3126
3072 virtual HType CalculateInferredType(); 3127 virtual HType CalculateInferredType();
3073 3128
3074 DECLARE_CONCRETE_INSTRUCTION(Shr) 3129 DECLARE_CONCRETE_INSTRUCTION(Shr)
3075 3130
3076 protected: 3131 protected:
3077 virtual bool DataEquals(HValue* other) { return true; } 3132 virtual bool DataEquals(HValue* other) { return true; }
3078 }; 3133 };
3079 3134
3080 3135
3081 class HSar: public HBitwiseBinaryOperation { 3136 class HSar: public HBitwiseBinaryOperation {
3082 public: 3137 public:
3083 HSar(HValue* left, HValue* right) 3138 HSar(HValue* context, HValue* left, HValue* right)
3084 : HBitwiseBinaryOperation(left, right) { } 3139 : HBitwiseBinaryOperation(context, left, right) { }
3085 3140
3086 virtual Range* InferRange(); 3141 virtual Range* InferRange();
3087 virtual HType CalculateInferredType(); 3142 virtual HType CalculateInferredType();
3088 3143
3089 DECLARE_CONCRETE_INSTRUCTION(Sar) 3144 DECLARE_CONCRETE_INSTRUCTION(Sar)
3090 3145
3091 protected: 3146 protected:
3092 virtual bool DataEquals(HValue* other) { return true; } 3147 virtual bool DataEquals(HValue* other) { return true; }
3093 }; 3148 };
3094 3149
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3208 HLoadGlobalCell* b = HLoadGlobalCell::cast(other); 3263 HLoadGlobalCell* b = HLoadGlobalCell::cast(other);
3209 return cell_.is_identical_to(b->cell()); 3264 return cell_.is_identical_to(b->cell());
3210 } 3265 }
3211 3266
3212 private: 3267 private:
3213 Handle<JSGlobalPropertyCell> cell_; 3268 Handle<JSGlobalPropertyCell> cell_;
3214 bool check_hole_value_; 3269 bool check_hole_value_;
3215 }; 3270 };
3216 3271
3217 3272
3218 class HLoadGlobalGeneric: public HBinaryOperation { 3273 class HLoadGlobalGeneric: public HTemplateInstruction<2> {
3219 public: 3274 public:
3220 HLoadGlobalGeneric(HValue* context, 3275 HLoadGlobalGeneric(HValue* context,
3221 HValue* global_object, 3276 HValue* global_object,
3222 Handle<Object> name, 3277 Handle<Object> name,
3223 bool for_typeof) 3278 bool for_typeof)
3224 : HBinaryOperation(context, global_object), 3279 : name_(name),
3225 name_(name),
3226 for_typeof_(for_typeof) { 3280 for_typeof_(for_typeof) {
3281 SetOperandAt(0, context);
3282 SetOperandAt(1, global_object);
3227 set_representation(Representation::Tagged()); 3283 set_representation(Representation::Tagged());
3228 SetAllSideEffects(); 3284 SetAllSideEffects();
3229 } 3285 }
3230 3286
3231 HValue* context() { return OperandAt(0); } 3287 HValue* context() { return OperandAt(0); }
3232 HValue* global_object() { return OperandAt(1); } 3288 HValue* global_object() { return OperandAt(1); }
3233 Handle<Object> name() const { return name_; } 3289 Handle<Object> name() const { return name_; }
3234 bool for_typeof() const { return for_typeof_; } 3290 bool for_typeof() const { return for_typeof_; }
3235 3291
3236 virtual void PrintDataTo(StringStream* stream); 3292 virtual void PrintDataTo(StringStream* stream);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 int slot_index_; 3395 int slot_index_;
3340 }; 3396 };
3341 3397
3342 3398
3343 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { 3399 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
3344 return !value->type().IsSmi() && 3400 return !value->type().IsSmi() &&
3345 !(value->IsConstant() && HConstant::cast(value)->InOldSpace()); 3401 !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
3346 } 3402 }
3347 3403
3348 3404
3349 class HStoreContextSlot: public HBinaryOperation { 3405 class HStoreContextSlot: public HTemplateInstruction<2> {
3350 public: 3406 public:
3351 HStoreContextSlot(HValue* context, int slot_index, HValue* value) 3407 HStoreContextSlot(HValue* context, int slot_index, HValue* value)
3352 : HBinaryOperation(context, value), slot_index_(slot_index) { 3408 : slot_index_(slot_index) {
3409 SetOperandAt(0, context);
3410 SetOperandAt(1, value);
3353 SetFlag(kChangesContextSlots); 3411 SetFlag(kChangesContextSlots);
3354 } 3412 }
3355 3413
3356 HValue* context() { return OperandAt(0); } 3414 HValue* context() { return OperandAt(0); }
3357 HValue* value() { return OperandAt(1); } 3415 HValue* value() { return OperandAt(1); }
3358 int slot_index() const { return slot_index_; } 3416 int slot_index() const { return slot_index_; }
3359 3417
3360 bool NeedsWriteBarrier() { 3418 bool NeedsWriteBarrier() {
3361 return StoringValueNeedsWriteBarrier(value()); 3419 return StoringValueNeedsWriteBarrier(value());
3362 } 3420 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 HLoadNamedField* b = HLoadNamedField::cast(other); 3464 HLoadNamedField* b = HLoadNamedField::cast(other);
3407 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; 3465 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_;
3408 } 3466 }
3409 3467
3410 private: 3468 private:
3411 bool is_in_object_; 3469 bool is_in_object_;
3412 int offset_; 3470 int offset_;
3413 }; 3471 };
3414 3472
3415 3473
3416 class HLoadNamedFieldPolymorphic: public HUnaryOperation { 3474 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> {
3417 public: 3475 public:
3418 HLoadNamedFieldPolymorphic(HValue* object, 3476 HLoadNamedFieldPolymorphic(HValue* context,
3477 HValue* object,
3419 ZoneMapList* types, 3478 ZoneMapList* types,
3420 Handle<String> name); 3479 Handle<String> name);
3421 3480
3422 HValue* object() { return OperandAt(0); } 3481 HValue* context() { return OperandAt(0); }
3482 HValue* object() { return OperandAt(1); }
3423 ZoneMapList* types() { return &types_; } 3483 ZoneMapList* types() { return &types_; }
3424 Handle<String> name() { return name_; } 3484 Handle<String> name() { return name_; }
3425 bool need_generic() { return need_generic_; } 3485 bool need_generic() { return need_generic_; }
3426 3486
3427 virtual Representation RequiredInputRepresentation(int index) const { 3487 virtual Representation RequiredInputRepresentation(int index) const {
3428 return Representation::Tagged(); 3488 return Representation::Tagged();
3429 } 3489 }
3430 3490
3431 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic) 3491 DECLARE_CONCRETE_INSTRUCTION(LoadNamedFieldPolymorphic)
3432 3492
3433 static const int kMaxLoadPolymorphism = 4; 3493 static const int kMaxLoadPolymorphism = 4;
3434 3494
3435 protected: 3495 protected:
3436 virtual bool DataEquals(HValue* value); 3496 virtual bool DataEquals(HValue* value);
3437 3497
3438 private: 3498 private:
3439 ZoneMapList types_; 3499 ZoneMapList types_;
3440 Handle<String> name_; 3500 Handle<String> name_;
3441 bool need_generic_; 3501 bool need_generic_;
3442 }; 3502 };
3443 3503
3444 3504
3445 3505
3446 class HLoadNamedGeneric: public HBinaryOperation { 3506 class HLoadNamedGeneric: public HTemplateInstruction<2> {
3447 public: 3507 public:
3448 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) 3508 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
3449 : HBinaryOperation(context, object), name_(name) { 3509 : name_(name) {
3510 SetOperandAt(0, context);
3511 SetOperandAt(1, object);
3450 set_representation(Representation::Tagged()); 3512 set_representation(Representation::Tagged());
3451 SetAllSideEffects(); 3513 SetAllSideEffects();
3452 } 3514 }
3453 3515
3454 HValue* context() { return OperandAt(0); } 3516 HValue* context() { return OperandAt(0); }
3455 HValue* object() { return OperandAt(1); } 3517 HValue* object() { return OperandAt(1); }
3456 Handle<Object> name() const { return name_; } 3518 Handle<Object> name() const { return name_; }
3457 3519
3458 virtual Representation RequiredInputRepresentation(int index) const { 3520 virtual Representation RequiredInputRepresentation(int index) const {
3459 return Representation::Tagged(); 3521 return Representation::Tagged();
(...skipping 21 matching lines...) Expand all
3481 return Representation::Tagged(); 3543 return Representation::Tagged();
3482 } 3544 }
3483 3545
3484 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 3546 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
3485 3547
3486 protected: 3548 protected:
3487 virtual bool DataEquals(HValue* other) { return true; } 3549 virtual bool DataEquals(HValue* other) { return true; }
3488 }; 3550 };
3489 3551
3490 3552
3491 class HLoadKeyedFastElement: public HBinaryOperation { 3553 class HLoadKeyedFastElement: public HTemplateInstruction<2> {
3492 public: 3554 public:
3493 HLoadKeyedFastElement(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { 3555 HLoadKeyedFastElement(HValue* obj, HValue* key) {
3556 SetOperandAt(0, obj);
3557 SetOperandAt(1, key);
3494 set_representation(Representation::Tagged()); 3558 set_representation(Representation::Tagged());
3495 SetFlag(kDependsOnArrayElements); 3559 SetFlag(kDependsOnArrayElements);
3496 SetFlag(kUseGVN); 3560 SetFlag(kUseGVN);
3497 } 3561 }
3498 3562
3499 HValue* object() { return OperandAt(0); } 3563 HValue* object() { return OperandAt(0); }
3500 HValue* key() { return OperandAt(1); } 3564 HValue* key() { return OperandAt(1); }
3501 3565
3502 virtual Representation RequiredInputRepresentation(int index) const { 3566 virtual Representation RequiredInputRepresentation(int index) const {
3503 // The key is supposed to be Integer32. 3567 // The key is supposed to be Integer32.
3504 return (index == 1) ? Representation::Integer32() 3568 return (index == 1) ? Representation::Integer32()
3505 : Representation::Tagged(); 3569 : Representation::Tagged();
3506 } 3570 }
3507 3571
3508 virtual void PrintDataTo(StringStream* stream); 3572 virtual void PrintDataTo(StringStream* stream);
3509 3573
3510 bool RequiresHoleCheck() const; 3574 bool RequiresHoleCheck() const;
3511 3575
3512 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) 3576 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement)
3513 3577
3514 protected: 3578 protected:
3515 virtual bool DataEquals(HValue* other) { return true; } 3579 virtual bool DataEquals(HValue* other) { return true; }
3516 }; 3580 };
3517 3581
3518 3582
3519 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { 3583 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> {
3520 public: 3584 public:
3521 HLoadKeyedSpecializedArrayElement(HValue* external_elements, 3585 HLoadKeyedSpecializedArrayElement(HValue* external_elements,
3522 HValue* key, 3586 HValue* key,
3523 JSObject::ElementsKind elements_kind) 3587 JSObject::ElementsKind elements_kind)
3524 : HBinaryOperation(external_elements, key), 3588 : elements_kind_(elements_kind) {
3525 elements_kind_(elements_kind) { 3589 SetOperandAt(0, external_elements);
3590 SetOperandAt(1, key);
3526 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || 3591 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS ||
3527 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3592 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) {
3528 set_representation(Representation::Double()); 3593 set_representation(Representation::Double());
3529 } else { 3594 } else {
3530 set_representation(Representation::Integer32()); 3595 set_representation(Representation::Integer32());
3531 } 3596 }
3532 SetFlag(kDependsOnSpecializedArrayElements); 3597 SetFlag(kDependsOnSpecializedArrayElements);
3533 // Native code could change the specialized array. 3598 // Native code could change the specialized array.
3534 SetFlag(kDependsOnCalls); 3599 SetFlag(kDependsOnCalls);
3535 SetFlag(kUseGVN); 3600 SetFlag(kUseGVN);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 virtual void PrintDataTo(StringStream* stream); 3645 virtual void PrintDataTo(StringStream* stream);
3581 3646
3582 virtual Representation RequiredInputRepresentation(int index) const { 3647 virtual Representation RequiredInputRepresentation(int index) const {
3583 return Representation::Tagged(); 3648 return Representation::Tagged();
3584 } 3649 }
3585 3650
3586 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 3651 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
3587 }; 3652 };
3588 3653
3589 3654
3590 class HStoreNamedField: public HBinaryOperation { 3655 class HStoreNamedField: public HTemplateInstruction<2> {
3591 public: 3656 public:
3592 HStoreNamedField(HValue* obj, 3657 HStoreNamedField(HValue* obj,
3593 Handle<String> name, 3658 Handle<String> name,
3594 HValue* val, 3659 HValue* val,
3595 bool in_object, 3660 bool in_object,
3596 int offset) 3661 int offset)
3597 : HBinaryOperation(obj, val), 3662 : name_(name),
3598 name_(name),
3599 is_in_object_(in_object), 3663 is_in_object_(in_object),
3600 offset_(offset) { 3664 offset_(offset) {
3665 SetOperandAt(0, obj);
3666 SetOperandAt(1, val);
3601 if (is_in_object_) { 3667 if (is_in_object_) {
3602 SetFlag(kChangesInobjectFields); 3668 SetFlag(kChangesInobjectFields);
3603 } else { 3669 } else {
3604 SetFlag(kChangesBackingStoreFields); 3670 SetFlag(kChangesBackingStoreFields);
3605 } 3671 }
3606 } 3672 }
3607 3673
3608 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 3674 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
3609 3675
3610 virtual Representation RequiredInputRepresentation(int index) const { 3676 virtual Representation RequiredInputRepresentation(int index) const {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
3768 3834
3769 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 3835 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
3770 3836
3771 private: 3837 private:
3772 bool strict_mode_; 3838 bool strict_mode_;
3773 }; 3839 };
3774 3840
3775 3841
3776 class HStringAdd: public HBinaryOperation { 3842 class HStringAdd: public HBinaryOperation {
3777 public: 3843 public:
3778 HStringAdd(HValue* left, HValue* right) : HBinaryOperation(left, right) { 3844 HStringAdd(HValue* context, HValue* left, HValue* right)
3845 : HBinaryOperation(context, left, right) {
3779 set_representation(Representation::Tagged()); 3846 set_representation(Representation::Tagged());
3780 SetFlag(kUseGVN); 3847 SetFlag(kUseGVN);
3781 SetFlag(kDependsOnMaps); 3848 SetFlag(kDependsOnMaps);
3782 } 3849 }
3783 3850
3784 virtual Representation RequiredInputRepresentation(int index) const { 3851 virtual Representation RequiredInputRepresentation(int index) const {
3785 return Representation::Tagged(); 3852 return Representation::Tagged();
3786 } 3853 }
3787 3854
3788 virtual HType CalculateInferredType() { 3855 virtual HType CalculateInferredType() {
3789 return HType::String(); 3856 return HType::String();
3790 } 3857 }
3791 3858
3792 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 3859 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
3793 3860
3794 protected: 3861 protected:
3795 virtual bool DataEquals(HValue* other) { return true; } 3862 virtual bool DataEquals(HValue* other) { return true; }
3796 }; 3863 };
3797 3864
3798 3865
3799 class HStringCharCodeAt: public HBinaryOperation { 3866 class HStringCharCodeAt: public HTemplateInstruction<3> {
3800 public: 3867 public:
3801 HStringCharCodeAt(HValue* string, HValue* index) 3868 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
3802 : HBinaryOperation(string, index) { 3869 SetOperandAt(0, context);
3870 SetOperandAt(1, string);
3871 SetOperandAt(2, index);
3803 set_representation(Representation::Integer32()); 3872 set_representation(Representation::Integer32());
3804 SetFlag(kUseGVN); 3873 SetFlag(kUseGVN);
3805 SetFlag(kDependsOnMaps); 3874 SetFlag(kDependsOnMaps);
3806 } 3875 }
3807 3876
3808 virtual Representation RequiredInputRepresentation(int index) const { 3877 virtual Representation RequiredInputRepresentation(int index) const {
3809 // The index is supposed to be Integer32. 3878 // The index is supposed to be Integer32.
3810 return (index == 1) ? Representation::Integer32() 3879 return (index == 2) ? Representation::Integer32()
3811 : Representation::Tagged(); 3880 : Representation::Tagged();
3812 } 3881 }
3813 3882
3814 HValue* string() { return OperandAt(0); } 3883 HValue* context() { return OperandAt(0); }
3815 HValue* index() { return OperandAt(1); } 3884 HValue* string() { return OperandAt(1); }
3885 HValue* index() { return OperandAt(2); }
3816 3886
3817 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) 3887 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt)
3818 3888
3819 protected: 3889 protected:
3820 virtual bool DataEquals(HValue* other) { return true; } 3890 virtual bool DataEquals(HValue* other) { return true; }
3821 3891
3822 virtual Range* InferRange() { 3892 virtual Range* InferRange() {
3823 return new Range(0, String::kMaxUC16CharCode); 3893 return new Range(0, String::kMaxUC16CharCode);
3824 } 3894 }
3825 }; 3895 };
3826 3896
3827 3897
3828 class HStringCharFromCode: public HUnaryOperation { 3898 class HStringCharFromCode: public HTemplateInstruction<2> {
3829 public: 3899 public:
3830 explicit HStringCharFromCode(HValue* char_code) : HUnaryOperation(char_code) { 3900 explicit HStringCharFromCode(HValue* context, HValue* char_code) {
3831 set_representation(Representation::Tagged()); 3901 SetOperandAt(0, context);
3902 SetOperandAt(1, char_code);
3903 set_representation(Representation::Tagged());
3832 SetFlag(kUseGVN); 3904 SetFlag(kUseGVN);
3833 } 3905 }
3834 3906
3835 virtual Representation RequiredInputRepresentation(int index) const { 3907 virtual Representation RequiredInputRepresentation(int index) const {
3836 return Representation::Integer32(); 3908 return Representation::Integer32();
Kevin Millikin (Chromium) 2011/06/29 08:36:20 Context should be tagged.
3837 } 3909 }
3838 3910
3911 HValue* context() { return OperandAt(0); }
3912 HValue* value() { return OperandAt(1); }
3913
3839 virtual bool DataEquals(HValue* other) { return true; } 3914 virtual bool DataEquals(HValue* other) { return true; }
3840 3915
3841 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 3916 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
3842 }; 3917 };
3843 3918
3844 3919
3845 class HStringLength: public HUnaryOperation { 3920 class HStringLength: public HUnaryOperation {
3846 public: 3921 public:
3847 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 3922 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
3848 set_representation(Representation::Tagged()); 3923 set_representation(Representation::Tagged());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 3955
3881 int literal_index() const { return literal_index_; } 3956 int literal_index() const { return literal_index_; }
3882 int depth() const { return depth_; } 3957 int depth() const { return depth_; }
3883 3958
3884 private: 3959 private:
3885 int literal_index_; 3960 int literal_index_;
3886 int depth_; 3961 int depth_;
3887 }; 3962 };
3888 3963
3889 3964
3890 class HArrayLiteral: public HMaterializedLiteral<0> { 3965 class HArrayLiteral: public HMaterializedLiteral<1> {
3891 public: 3966 public:
3892 HArrayLiteral(Handle<FixedArray> constant_elements, 3967 HArrayLiteral(HValue* context,
3968 Handle<FixedArray> constant_elements,
3893 int length, 3969 int length,
3894 int literal_index, 3970 int literal_index,
3895 int depth) 3971 int depth)
3896 : HMaterializedLiteral<0>(literal_index, depth), 3972 : HMaterializedLiteral<1>(literal_index, depth),
3897 length_(length), 3973 length_(length),
3898 constant_elements_(constant_elements) {} 3974 constant_elements_(constant_elements) {
3975 SetOperandAt(0, context);
3976 }
3899 3977
3978 HValue* context() { return OperandAt(0); }
3900 Handle<FixedArray> constant_elements() const { return constant_elements_; } 3979 Handle<FixedArray> constant_elements() const { return constant_elements_; }
3901 int length() const { return length_; } 3980 int length() const { return length_; }
3902 3981
3903 bool IsCopyOnWrite() const; 3982 bool IsCopyOnWrite() const;
3904 3983
3905 virtual Representation RequiredInputRepresentation(int index) const { 3984 virtual Representation RequiredInputRepresentation(int index) const {
3906 return Representation::None(); 3985 return Representation::Tagged();
3907 } 3986 }
3908 3987
3909 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) 3988 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral)
3910 3989
3911 private: 3990 private:
3912 int length_; 3991 int length_;
3913 Handle<FixedArray> constant_elements_; 3992 Handle<FixedArray> constant_elements_;
3914 }; 3993 };
3915 3994
3916 3995
(...skipping 25 matching lines...) Expand all
3942 4021
3943 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral) 4022 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral)
3944 4023
3945 private: 4024 private:
3946 Handle<FixedArray> constant_properties_; 4025 Handle<FixedArray> constant_properties_;
3947 bool fast_elements_; 4026 bool fast_elements_;
3948 bool has_function_; 4027 bool has_function_;
3949 }; 4028 };
3950 4029
3951 4030
3952 class HRegExpLiteral: public HMaterializedLiteral<0> { 4031 class HRegExpLiteral: public HMaterializedLiteral<1> {
3953 public: 4032 public:
3954 HRegExpLiteral(Handle<String> pattern, 4033 HRegExpLiteral(HValue* context,
4034 Handle<String> pattern,
3955 Handle<String> flags, 4035 Handle<String> flags,
3956 int literal_index) 4036 int literal_index)
3957 : HMaterializedLiteral<0>(literal_index, 0), 4037 : HMaterializedLiteral<1>(literal_index, 0),
3958 pattern_(pattern), 4038 pattern_(pattern),
3959 flags_(flags) { } 4039 flags_(flags) {
4040 SetOperandAt(0, context);
4041 }
3960 4042
4043 HValue* context() { return OperandAt(0); }
3961 Handle<String> pattern() { return pattern_; } 4044 Handle<String> pattern() { return pattern_; }
3962 Handle<String> flags() { return flags_; } 4045 Handle<String> flags() { return flags_; }
3963 4046
3964 virtual Representation RequiredInputRepresentation(int index) const { 4047 virtual Representation RequiredInputRepresentation(int index) const {
3965 return Representation::None(); 4048 return Representation::Tagged();
3966 } 4049 }
3967 4050
3968 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) 4051 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
3969 4052
3970 private: 4053 private:
3971 Handle<String> pattern_; 4054 Handle<String> pattern_;
3972 Handle<String> flags_; 4055 Handle<String> flags_;
3973 }; 4056 };
3974 4057
3975 4058
3976 class HFunctionLiteral: public HTemplateInstruction<0> { 4059 class HFunctionLiteral: public HTemplateInstruction<1> {
3977 public: 4060 public:
3978 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) 4061 HFunctionLiteral(HValue* context,
4062 Handle<SharedFunctionInfo> shared,
4063 bool pretenure)
3979 : shared_info_(shared), pretenure_(pretenure) { 4064 : shared_info_(shared), pretenure_(pretenure) {
4065 SetOperandAt(0, context);
3980 set_representation(Representation::Tagged()); 4066 set_representation(Representation::Tagged());
3981 } 4067 }
3982 4068
4069 HValue* context() { return OperandAt(0); }
4070
3983 virtual Representation RequiredInputRepresentation(int index) const { 4071 virtual Representation RequiredInputRepresentation(int index) const {
3984 return Representation::None(); 4072 return Representation::Tagged();
3985 } 4073 }
3986 4074
3987 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 4075 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
3988 4076
3989 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 4077 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
3990 bool pretenure() const { return pretenure_; } 4078 bool pretenure() const { return pretenure_; }
3991 4079
3992 private: 4080 private:
3993 Handle<SharedFunctionInfo> shared_info_; 4081 Handle<SharedFunctionInfo> shared_info_;
3994 bool pretenure_; 4082 bool pretenure_;
3995 }; 4083 };
3996 4084
3997 4085
3998 class HTypeof: public HUnaryOperation { 4086 class HTypeof: public HTemplateInstruction<2> {
3999 public: 4087 public:
4000 explicit HTypeof(HValue* value) : HUnaryOperation(value) { 4088 explicit HTypeof(HValue* context, HValue* value) {
4089 SetOperandAt(0, context);
4090 SetOperandAt(1, value);
4001 set_representation(Representation::Tagged()); 4091 set_representation(Representation::Tagged());
4002 } 4092 }
4003 4093
4094 HValue* context() { return OperandAt(0); }
4095 HValue* value() { return OperandAt(1); }
4096
4004 virtual Representation RequiredInputRepresentation(int index) const { 4097 virtual Representation RequiredInputRepresentation(int index) const {
4005 return Representation::Tagged(); 4098 return Representation::Tagged();
4006 } 4099 }
4007 4100
4008 DECLARE_CONCRETE_INSTRUCTION(Typeof) 4101 DECLARE_CONCRETE_INSTRUCTION(Typeof)
4009 }; 4102 };
4010 4103
4011 4104
4012 class HToFastProperties: public HUnaryOperation { 4105 class HToFastProperties: public HUnaryOperation {
4013 public: 4106 public:
(...skipping 22 matching lines...) Expand all
4036 virtual Representation RequiredInputRepresentation(int index) const { 4129 virtual Representation RequiredInputRepresentation(int index) const {
4037 return Representation::Tagged(); 4130 return Representation::Tagged();
4038 } 4131 }
4039 4132
4040 DECLARE_CONCRETE_INSTRUCTION(ValueOf) 4133 DECLARE_CONCRETE_INSTRUCTION(ValueOf)
4041 }; 4134 };
4042 4135
4043 4136
4044 class HDeleteProperty: public HBinaryOperation { 4137 class HDeleteProperty: public HBinaryOperation {
4045 public: 4138 public:
4046 HDeleteProperty(HValue* obj, HValue* key) 4139 HDeleteProperty(HValue* context, HValue* obj, HValue* key)
4047 : HBinaryOperation(obj, key) { 4140 : HBinaryOperation(context, obj, key) {
4048 set_representation(Representation::Tagged()); 4141 set_representation(Representation::Tagged());
4049 SetAllSideEffects(); 4142 SetAllSideEffects();
4050 } 4143 }
4051 4144
4052 virtual Representation RequiredInputRepresentation(int index) const { 4145 virtual Representation RequiredInputRepresentation(int index) const {
4053 return Representation::Tagged(); 4146 return Representation::Tagged();
4054 } 4147 }
4055 4148
4056 virtual HType CalculateInferredType(); 4149 virtual HType CalculateInferredType();
4057 4150
(...skipping 28 matching lines...) Expand all
4086 4179
4087 DECLARE_CONCRETE_INSTRUCTION(In) 4180 DECLARE_CONCRETE_INSTRUCTION(In)
4088 }; 4181 };
4089 4182
4090 #undef DECLARE_INSTRUCTION 4183 #undef DECLARE_INSTRUCTION
4091 #undef DECLARE_CONCRETE_INSTRUCTION 4184 #undef DECLARE_CONCRETE_INSTRUCTION
4092 4185
4093 } } // namespace v8::internal 4186 } } // namespace v8::internal
4094 4187
4095 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4188 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | src/ia32/lithium-codegen-ia32.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698