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

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

Issue 15763004: Replace tagged keys for fast access by smi, and use smi in boundscheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed comment Created 7 years, 7 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.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 V(CallNewArray) \ 86 V(CallNewArray) \
87 V(CallRuntime) \ 87 V(CallRuntime) \
88 V(CallStub) \ 88 V(CallStub) \
89 V(Change) \ 89 V(Change) \
90 V(CheckFunction) \ 90 V(CheckFunction) \
91 V(CheckInstanceType) \ 91 V(CheckInstanceType) \
92 V(CheckMaps) \ 92 V(CheckMaps) \
93 V(CheckNonSmi) \ 93 V(CheckNonSmi) \
94 V(CheckPrototypeMaps) \ 94 V(CheckPrototypeMaps) \
95 V(CheckSmi) \ 95 V(CheckSmi) \
96 V(CheckSmiOrInt32) \
97 V(ClampToUint8) \ 96 V(ClampToUint8) \
98 V(ClassOfTestAndBranch) \ 97 V(ClassOfTestAndBranch) \
99 V(CompareIDAndBranch) \ 98 V(CompareIDAndBranch) \
100 V(CompareGeneric) \ 99 V(CompareGeneric) \
101 V(CompareObjectEqAndBranch) \ 100 V(CompareObjectEqAndBranch) \
102 V(CompareMap) \ 101 V(CompareMap) \
103 V(CompareConstantEqAndBranch) \ 102 V(CompareConstantEqAndBranch) \
104 V(Constant) \ 103 V(Constant) \
105 V(Context) \ 104 V(Context) \
106 V(DebugBreak) \ 105 V(DebugBreak) \
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 Representation to, 1713 Representation to,
1715 bool is_truncating, 1714 bool is_truncating,
1716 bool deoptimize_on_undefined) 1715 bool deoptimize_on_undefined)
1717 : HUnaryOperation(value) { 1716 : HUnaryOperation(value) {
1718 ASSERT(!value->representation().IsNone() && !to.IsNone()); 1717 ASSERT(!value->representation().IsNone() && !to.IsNone());
1719 ASSERT(!value->representation().Equals(to)); 1718 ASSERT(!value->representation().Equals(to));
1720 set_representation(to); 1719 set_representation(to);
1721 SetFlag(kUseGVN); 1720 SetFlag(kUseGVN);
1722 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined); 1721 if (deoptimize_on_undefined) SetFlag(kDeoptimizeOnUndefined);
1723 if (is_truncating) SetFlag(kTruncatingToInt32); 1722 if (is_truncating) SetFlag(kTruncatingToInt32);
1724 if (value->type().IsSmi()) { 1723 if (value->representation().IsSmi() || value->type().IsSmi()) {
1725 set_type(HType::Smi()); 1724 set_type(HType::Smi());
1726 } else { 1725 } else {
1727 set_type(HType::TaggedNumber()); 1726 set_type(HType::TaggedNumber());
1728 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); 1727 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion);
1729 } 1728 }
1730 } 1729 }
1731 1730
1732 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 1731 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
1733 virtual HType CalculateInferredType(); 1732 virtual HType CalculateInferredType();
1734 virtual HValue* Canonicalize(); 1733 virtual HValue* Canonicalize();
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 virtual void Verify(); 2944 virtual void Verify();
2946 #endif 2945 #endif
2947 2946
2948 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) 2947 DECLARE_CONCRETE_INSTRUCTION(CheckSmi)
2949 2948
2950 protected: 2949 protected:
2951 virtual bool DataEquals(HValue* other) { return true; } 2950 virtual bool DataEquals(HValue* other) { return true; }
2952 }; 2951 };
2953 2952
2954 2953
2955 class HCheckSmiOrInt32: public HUnaryOperation {
2956 public:
2957 explicit HCheckSmiOrInt32(HValue* value) : HUnaryOperation(value) {
2958 SetFlag(kFlexibleRepresentation);
2959 SetFlag(kUseGVN);
2960 }
2961
2962 virtual int RedefinedOperandIndex() { return 0; }
2963 virtual Representation RequiredInputRepresentation(int index) {
2964 return representation();
2965 }
2966 virtual void InferRepresentation(HInferRepresentation* h_infer);
2967
2968 virtual Representation observed_input_representation(int index) {
2969 return Representation::Integer32();
2970 }
2971
2972 virtual HValue* Canonicalize() {
2973 if (representation().IsTagged() && !value()->type().IsSmi()) {
2974 return this;
2975 } else {
2976 return value();
2977 }
2978 }
2979
2980 DECLARE_CONCRETE_INSTRUCTION(CheckSmiOrInt32)
2981
2982 protected:
2983 virtual bool DataEquals(HValue* other) { return true; }
2984 };
2985
2986
2987 class HPhi: public HValue { 2954 class HPhi: public HValue {
2988 public: 2955 public:
2989 HPhi(int merged_index, Zone* zone) 2956 HPhi(int merged_index, Zone* zone)
2990 : inputs_(2, zone), 2957 : inputs_(2, zone),
2991 merged_index_(merged_index), 2958 merged_index_(merged_index),
2992 phi_id_(-1), 2959 phi_id_(-1),
2993 is_convertible_to_integer_(true) { 2960 is_convertible_to_integer_(true) {
2994 for (int i = 0; i < Representation::kNumRepresentations; i++) { 2961 for (int i = 0; i < Representation::kNumRepresentations; i++) {
2995 non_phi_uses_[i] = 0; 2962 non_phi_uses_[i] = 0;
2996 indirect_uses_[i] = 0; 2963 indirect_uses_[i] = 0;
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 ALLOW_SMI_KEY 3538 ALLOW_SMI_KEY
3572 }; 3539 };
3573 3540
3574 3541
3575 class HBoundsCheckBaseIndexInformation; 3542 class HBoundsCheckBaseIndexInformation;
3576 3543
3577 3544
3578 class HBoundsCheck: public HTemplateInstruction<2> { 3545 class HBoundsCheck: public HTemplateInstruction<2> {
3579 public: 3546 public:
3580 // Normally HBoundsCheck should be created using the 3547 // Normally HBoundsCheck should be created using the
3581 // HGraphBuilder::AddBoundsCheck() helper, which also guards the index with 3548 // HGraphBuilder::AddBoundsCheck() helper.
3582 // a HCheckSmiOrInt32 check.
3583 // However when building stubs, where we know that the arguments are Int32, 3549 // However when building stubs, where we know that the arguments are Int32,
3584 // it makes sense to invoke this constructor directly. 3550 // it makes sense to invoke this constructor directly.
3585 HBoundsCheck(HValue* index, 3551 HBoundsCheck(HValue* index,
3586 HValue* length, 3552 HValue* length,
3587 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, 3553 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY,
3588 Representation r = Representation::None()) 3554 Representation r = Representation::None())
3589 : key_mode_(key_mode), skip_check_(false), 3555 : key_mode_(key_mode), skip_check_(false),
3590 base_(NULL), offset_(0), scale_(0), 3556 base_(NULL), offset_(0), scale_(0),
3591 responsibility_direction_(DIRECTION_NONE) { 3557 responsibility_direction_(DIRECTION_NONE) {
3592 SetOperandAt(0, index); 3558 SetOperandAt(0, index);
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
5376 public: 5342 public:
5377 virtual HValue* GetKey() = 0; 5343 virtual HValue* GetKey() = 0;
5378 virtual void SetKey(HValue* key) = 0; 5344 virtual void SetKey(HValue* key) = 0;
5379 virtual void SetIndexOffset(uint32_t index_offset) = 0; 5345 virtual void SetIndexOffset(uint32_t index_offset) = 0;
5380 virtual bool IsDehoisted() = 0; 5346 virtual bool IsDehoisted() = 0;
5381 virtual void SetDehoisted(bool is_dehoisted) = 0; 5347 virtual void SetDehoisted(bool is_dehoisted) = 0;
5382 virtual ~ArrayInstructionInterface() { }; 5348 virtual ~ArrayInstructionInterface() { };
5383 5349
5384 static Representation KeyedAccessIndexRequirement(Representation r) { 5350 static Representation KeyedAccessIndexRequirement(Representation r) {
5385 return r.IsInteger32() ? Representation::Integer32() 5351 return r.IsInteger32() ? Representation::Integer32()
5386 : Representation::Tagged(); 5352 : Representation::Smi();
5387 } 5353 }
5388 }; 5354 };
5389 5355
5390 5356
5391 enum LoadKeyedHoleMode { 5357 enum LoadKeyedHoleMode {
5392 NEVER_RETURN_HOLE, 5358 NEVER_RETURN_HOLE,
5393 ALLOW_RETURN_HOLE 5359 ALLOW_RETURN_HOLE
5394 }; 5360 };
5395 5361
5396 5362
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
6479 virtual bool IsDeletable() const { return true; } 6445 virtual bool IsDeletable() const { return true; }
6480 }; 6446 };
6481 6447
6482 6448
6483 #undef DECLARE_INSTRUCTION 6449 #undef DECLARE_INSTRUCTION
6484 #undef DECLARE_CONCRETE_INSTRUCTION 6450 #undef DECLARE_CONCRETE_INSTRUCTION
6485 6451
6486 } } // namespace v8::internal 6452 } } // namespace v8::internal
6487 6453
6488 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6454 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698