OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 V(CallConstantFunction) \ | 80 V(CallConstantFunction) \ |
81 V(CallFunction) \ | 81 V(CallFunction) \ |
82 V(CallGlobal) \ | 82 V(CallGlobal) \ |
83 V(CallKeyed) \ | 83 V(CallKeyed) \ |
84 V(CallKnownGlobal) \ | 84 V(CallKnownGlobal) \ |
85 V(CallNamed) \ | 85 V(CallNamed) \ |
86 V(CallNew) \ | 86 V(CallNew) \ |
87 V(CallNewArray) \ | 87 V(CallNewArray) \ |
88 V(CallRuntime) \ | 88 V(CallRuntime) \ |
89 V(CallStub) \ | 89 V(CallStub) \ |
| 90 V(CapturedObject) \ |
90 V(Change) \ | 91 V(Change) \ |
91 V(CheckFunction) \ | 92 V(CheckFunction) \ |
92 V(CheckHeapObject) \ | 93 V(CheckHeapObject) \ |
93 V(CheckInstanceType) \ | 94 V(CheckInstanceType) \ |
94 V(CheckMaps) \ | 95 V(CheckMaps) \ |
95 V(CheckMapValue) \ | 96 V(CheckMapValue) \ |
96 V(CheckPrototypeMaps) \ | 97 V(CheckPrototypeMaps) \ |
97 V(CheckSmi) \ | 98 V(CheckSmi) \ |
98 V(ClampToUint8) \ | 99 V(ClampToUint8) \ |
99 V(ClassOfTestAndBranch) \ | 100 V(ClassOfTestAndBranch) \ |
(...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 | 2940 |
2940 | 2941 |
2941 class HCheckHeapObject: public HUnaryOperation { | 2942 class HCheckHeapObject: public HUnaryOperation { |
2942 public: | 2943 public: |
2943 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | 2944 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { |
2944 set_representation(Representation::Tagged()); | 2945 set_representation(Representation::Tagged()); |
2945 SetFlag(kUseGVN); | 2946 SetFlag(kUseGVN); |
2946 set_type(HType::NonPrimitive()); | 2947 set_type(HType::NonPrimitive()); |
2947 } | 2948 } |
2948 | 2949 |
| 2950 virtual bool HasEscapingOperandAt(int index) { return false; } |
2949 virtual Representation RequiredInputRepresentation(int index) { | 2951 virtual Representation RequiredInputRepresentation(int index) { |
2950 return Representation::Tagged(); | 2952 return Representation::Tagged(); |
2951 } | 2953 } |
2952 | 2954 |
2953 #ifdef DEBUG | 2955 #ifdef DEBUG |
2954 virtual void Verify(); | 2956 virtual void Verify(); |
2955 #endif | 2957 #endif |
2956 | 2958 |
2957 virtual HValue* Canonicalize() { | 2959 virtual HValue* Canonicalize() { |
2958 return value()->type().IsHeapObject() ? NULL : this; | 2960 return value()->type().IsHeapObject() ? NULL : this; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 | 3424 |
3423 // We need to store the phi both here and in the instruction operand because | 3425 // We need to store the phi both here and in the instruction operand because |
3424 // the operand can change if a new idef of the phi is added between the phi | 3426 // the operand can change if a new idef of the phi is added between the phi |
3425 // and this instruction (inserting an idef updates every use). | 3427 // and this instruction (inserting an idef updates every use). |
3426 HPhi* phi_; | 3428 HPhi* phi_; |
3427 NumericRelation relation_; | 3429 NumericRelation relation_; |
3428 int operand_index_; | 3430 int operand_index_; |
3429 }; | 3431 }; |
3430 | 3432 |
3431 | 3433 |
3432 class HArgumentsObject: public HTemplateInstruction<0> { | 3434 // Common base class for HArgumentsObject and HCapturedObject. |
| 3435 class HDematerializedObject: public HTemplateInstruction<0> { |
3433 public: | 3436 public: |
3434 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { | 3437 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} |
3435 set_representation(Representation::Tagged()); | |
3436 SetFlag(kIsArguments); | |
3437 } | |
3438 | |
3439 const ZoneList<HValue*>* arguments_values() const { return &values_; } | |
3440 int arguments_count() const { return values_.length(); } | |
3441 | |
3442 void AddArgument(HValue* argument, Zone* zone) { | |
3443 values_.Add(NULL, zone); // Resize list. | |
3444 SetOperandAt(values_.length() - 1, argument); | |
3445 } | |
3446 | 3438 |
3447 virtual int OperandCount() { return values_.length(); } | 3439 virtual int OperandCount() { return values_.length(); } |
3448 virtual HValue* OperandAt(int index) const { return values_[index]; } | 3440 virtual HValue* OperandAt(int index) const { return values_[index]; } |
3449 | 3441 |
3450 virtual bool HasEscapingOperandAt(int index) { return false; } | 3442 virtual bool HasEscapingOperandAt(int index) { return false; } |
3451 virtual Representation RequiredInputRepresentation(int index) { | 3443 virtual Representation RequiredInputRepresentation(int index) { |
3452 return Representation::None(); | 3444 return Representation::None(); |
3453 } | 3445 } |
3454 | 3446 |
3455 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | |
3456 | |
3457 protected: | 3447 protected: |
3458 virtual void InternalSetOperandAt(int index, HValue* value) { | 3448 virtual void InternalSetOperandAt(int index, HValue* value) { |
3459 values_[index] = value; | 3449 values_[index] = value; |
3460 } | 3450 } |
3461 | 3451 |
| 3452 // List of values tracked by this marker. |
| 3453 ZoneList<HValue*> values_; |
| 3454 |
3462 private: | 3455 private: |
3463 virtual bool IsDeletable() const { return true; } | 3456 virtual bool IsDeletable() const { return true; } |
3464 | |
3465 ZoneList<HValue*> values_; | |
3466 }; | 3457 }; |
3467 | 3458 |
3468 | 3459 |
| 3460 class HArgumentsObject: public HDematerializedObject { |
| 3461 public: |
| 3462 HArgumentsObject(int count, Zone* zone) |
| 3463 : HDematerializedObject(count, zone) { |
| 3464 set_representation(Representation::Tagged()); |
| 3465 SetFlag(kIsArguments); |
| 3466 } |
| 3467 |
| 3468 // The values contain a list of all elements in the arguments object |
| 3469 // including the receiver object, which is skipped when materializing. |
| 3470 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
| 3471 int arguments_count() const { return values_.length(); } |
| 3472 |
| 3473 void AddArgument(HValue* argument, Zone* zone) { |
| 3474 values_.Add(NULL, zone); // Resize list. |
| 3475 SetOperandAt(values_.length() - 1, argument); |
| 3476 } |
| 3477 |
| 3478 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
| 3479 }; |
| 3480 |
| 3481 |
| 3482 class HCapturedObject: public HDematerializedObject { |
| 3483 public: |
| 3484 HCapturedObject(int length, Zone* zone) |
| 3485 : HDematerializedObject(length, zone) { |
| 3486 set_representation(Representation::Tagged()); |
| 3487 values_.AddBlock(NULL, length, zone); // Resize list. |
| 3488 } |
| 3489 |
| 3490 // The values contain a list of all in-object properties inside the |
| 3491 // captured object and is index by field index. Properties in the |
| 3492 // properties or elements backing store are not tracked here. |
| 3493 const ZoneList<HValue*>* values() const { return &values_; } |
| 3494 int length() const { return values_.length(); } |
| 3495 |
| 3496 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
| 3497 }; |
| 3498 |
| 3499 |
3469 class HConstant: public HTemplateInstruction<0> { | 3500 class HConstant: public HTemplateInstruction<0> { |
3470 public: | 3501 public: |
3471 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3502 HConstant(Handle<Object> handle, Representation r = Representation::None()); |
3472 HConstant(int32_t value, | 3503 HConstant(int32_t value, |
3473 Representation r = Representation::None(), | 3504 Representation r = Representation::None(), |
3474 bool is_not_in_new_space = true, | 3505 bool is_not_in_new_space = true, |
3475 Handle<Object> optional_handle = Handle<Object>::null()); | 3506 Handle<Object> optional_handle = Handle<Object>::null()); |
3476 HConstant(double value, | 3507 HConstant(double value, |
3477 Representation r = Representation::None(), | 3508 Representation r = Representation::None(), |
3478 bool is_not_in_new_space = true, | 3509 bool is_not_in_new_space = true, |
(...skipping 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6279 SetGVNFlag(kChangesArrayElements); | 6310 SetGVNFlag(kChangesArrayElements); |
6280 } | 6311 } |
6281 | 6312 |
6282 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 6313 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
6283 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 6314 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
6284 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 6315 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
6285 SetFlag(kTruncatingToInt32); | 6316 SetFlag(kTruncatingToInt32); |
6286 } | 6317 } |
6287 } | 6318 } |
6288 | 6319 |
6289 virtual bool HasEscapingOperandAt(int index) { return index != 0; } | |
6290 virtual Representation RequiredInputRepresentation(int index) { | 6320 virtual Representation RequiredInputRepresentation(int index) { |
6291 // kind_fast: tagged[int32] = tagged | 6321 // kind_fast: tagged[int32] = tagged |
6292 // kind_double: tagged[int32] = double | 6322 // kind_double: tagged[int32] = double |
6293 // kind_smi : tagged[int32] = smi | 6323 // kind_smi : tagged[int32] = smi |
6294 // kind_external: external[int32] = (double | int32) | 6324 // kind_external: external[int32] = (double | int32) |
6295 if (index == 0) { | 6325 if (index == 0) { |
6296 return is_external() ? Representation::External() | 6326 return is_external() ? Representation::External() |
6297 : Representation::Tagged(); | 6327 : Representation::Tagged(); |
6298 } else if (index == 1) { | 6328 } else if (index == 1) { |
6299 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6329 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6993 virtual bool IsDeletable() const { return true; } | 7023 virtual bool IsDeletable() const { return true; } |
6994 }; | 7024 }; |
6995 | 7025 |
6996 | 7026 |
6997 #undef DECLARE_INSTRUCTION | 7027 #undef DECLARE_INSTRUCTION |
6998 #undef DECLARE_CONCRETE_INSTRUCTION | 7028 #undef DECLARE_CONCRETE_INSTRUCTION |
6999 | 7029 |
7000 } } // namespace v8::internal | 7030 } } // namespace v8::internal |
7001 | 7031 |
7002 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7032 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |