OLD | NEW |
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 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 #include <iosfwd> | 9 #include <iosfwd> |
10 | 10 |
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3263 HValue* additional_upper_limit_; | 3263 HValue* additional_upper_limit_; |
3264 bool additional_upper_limit_is_included_; | 3264 bool additional_upper_limit_is_included_; |
3265 HValue* additional_lower_limit_; | 3265 HValue* additional_lower_limit_; |
3266 bool additional_lower_limit_is_included_; | 3266 bool additional_lower_limit_is_included_; |
3267 }; | 3267 }; |
3268 | 3268 |
3269 | 3269 |
3270 class HPhi final : public HValue { | 3270 class HPhi final : public HValue { |
3271 public: | 3271 public: |
3272 HPhi(int merged_index, Zone* zone) | 3272 HPhi(int merged_index, Zone* zone) |
3273 : inputs_(2, zone), | 3273 : inputs_(2, zone), merged_index_(merged_index) { |
3274 merged_index_(merged_index), | |
3275 phi_id_(-1), | |
3276 induction_variable_data_(NULL) { | |
3277 for (int i = 0; i < Representation::kNumRepresentations; i++) { | |
3278 non_phi_uses_[i] = 0; | |
3279 indirect_uses_[i] = 0; | |
3280 } | |
3281 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3274 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
3282 SetFlag(kFlexibleRepresentation); | 3275 SetFlag(kFlexibleRepresentation); |
3283 SetFlag(kAllowUndefinedAsNaN); | 3276 SetFlag(kAllowUndefinedAsNaN); |
3284 } | 3277 } |
3285 | 3278 |
3286 Representation RepresentationFromInputs() override; | 3279 Representation RepresentationFromInputs() override; |
3287 | 3280 |
3288 Range* InferRange(Zone* zone) override; | 3281 Range* InferRange(Zone* zone) override; |
3289 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; | 3282 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
3290 Representation RequiredInputRepresentation(int index) override { | 3283 Representation RequiredInputRepresentation(int index) override { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 } | 3316 } |
3324 | 3317 |
3325 std::ostream& PrintTo(std::ostream& os) const override; // NOLINT | 3318 std::ostream& PrintTo(std::ostream& os) const override; // NOLINT |
3326 | 3319 |
3327 #ifdef DEBUG | 3320 #ifdef DEBUG |
3328 void Verify() override; | 3321 void Verify() override; |
3329 #endif | 3322 #endif |
3330 | 3323 |
3331 void InitRealUses(int id); | 3324 void InitRealUses(int id); |
3332 void AddNonPhiUsesFrom(HPhi* other); | 3325 void AddNonPhiUsesFrom(HPhi* other); |
3333 void AddIndirectUsesTo(int* use_count); | |
3334 | 3326 |
3335 int tagged_non_phi_uses() const { | 3327 Representation representation_from_indirect_uses() const { |
3336 return non_phi_uses_[Representation::kTagged]; | 3328 return representation_from_indirect_uses_; |
3337 } | 3329 } |
3338 int smi_non_phi_uses() const { | 3330 |
3339 return non_phi_uses_[Representation::kSmi]; | 3331 bool has_type_feedback_from_uses() const { |
| 3332 return has_type_feedback_from_uses_; |
3340 } | 3333 } |
3341 int int32_non_phi_uses() const { | 3334 |
3342 return non_phi_uses_[Representation::kInteger32]; | |
3343 } | |
3344 int double_non_phi_uses() const { | |
3345 return non_phi_uses_[Representation::kDouble]; | |
3346 } | |
3347 int tagged_indirect_uses() const { | |
3348 return indirect_uses_[Representation::kTagged]; | |
3349 } | |
3350 int smi_indirect_uses() const { | |
3351 return indirect_uses_[Representation::kSmi]; | |
3352 } | |
3353 int int32_indirect_uses() const { | |
3354 return indirect_uses_[Representation::kInteger32]; | |
3355 } | |
3356 int double_indirect_uses() const { | |
3357 return indirect_uses_[Representation::kDouble]; | |
3358 } | |
3359 int phi_id() { return phi_id_; } | 3335 int phi_id() { return phi_id_; } |
3360 | 3336 |
3361 static HPhi* cast(HValue* value) { | 3337 static HPhi* cast(HValue* value) { |
3362 DCHECK(value->IsPhi()); | 3338 DCHECK(value->IsPhi()); |
3363 return reinterpret_cast<HPhi*>(value); | 3339 return reinterpret_cast<HPhi*>(value); |
3364 } | 3340 } |
3365 Opcode opcode() const override { return HValue::kPhi; } | 3341 Opcode opcode() const override { return HValue::kPhi; } |
3366 | 3342 |
3367 void SimplifyConstantInputs(); | 3343 void SimplifyConstantInputs(); |
3368 | 3344 |
3369 // Marker value representing an invalid merge index. | 3345 // Marker value representing an invalid merge index. |
3370 static const int kInvalidMergedIndex = -1; | 3346 static const int kInvalidMergedIndex = -1; |
3371 | 3347 |
3372 protected: | 3348 protected: |
3373 void DeleteFromGraph() override; | 3349 void DeleteFromGraph() override; |
3374 void InternalSetOperandAt(int index, HValue* value) override { | 3350 void InternalSetOperandAt(int index, HValue* value) override { |
3375 inputs_[index] = value; | 3351 inputs_[index] = value; |
3376 } | 3352 } |
3377 | 3353 |
3378 private: | 3354 private: |
| 3355 Representation representation_from_non_phi_uses() const { |
| 3356 return representation_from_non_phi_uses_; |
| 3357 } |
| 3358 |
3379 ZoneList<HValue*> inputs_; | 3359 ZoneList<HValue*> inputs_; |
3380 int merged_index_; | 3360 int merged_index_ = 0; |
3381 | 3361 |
3382 int non_phi_uses_[Representation::kNumRepresentations]; | 3362 int phi_id_ = -1; |
3383 int indirect_uses_[Representation::kNumRepresentations]; | 3363 InductionVariableData* induction_variable_data_ = nullptr; |
3384 int phi_id_; | 3364 |
3385 InductionVariableData* induction_variable_data_; | 3365 Representation representation_from_indirect_uses_ = Representation::None(); |
| 3366 Representation representation_from_non_phi_uses_ = Representation::None(); |
| 3367 bool has_type_feedback_from_uses_ = false; |
3386 | 3368 |
3387 // TODO(titzer): we can't eliminate the receiver for generating backtraces | 3369 // TODO(titzer): we can't eliminate the receiver for generating backtraces |
3388 bool IsDeletable() const override { return !IsReceiver(); } | 3370 bool IsDeletable() const override { return !IsReceiver(); } |
3389 }; | 3371 }; |
3390 | 3372 |
3391 | 3373 |
3392 // Common base class for HArgumentsObject and HCapturedObject. | 3374 // Common base class for HArgumentsObject and HCapturedObject. |
3393 class HDematerializedObject : public HInstruction { | 3375 class HDematerializedObject : public HInstruction { |
3394 public: | 3376 public: |
3395 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} | 3377 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} |
(...skipping 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8049 }; | 8031 }; |
8050 | 8032 |
8051 | 8033 |
8052 | 8034 |
8053 #undef DECLARE_INSTRUCTION | 8035 #undef DECLARE_INSTRUCTION |
8054 #undef DECLARE_CONCRETE_INSTRUCTION | 8036 #undef DECLARE_CONCRETE_INSTRUCTION |
8055 | 8037 |
8056 } } // namespace v8::internal | 8038 } } // namespace v8::internal |
8057 | 8039 |
8058 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 8040 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |