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

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

Issue 7849017: Mechanical refactor to move ElementsKind type out of JSObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: latest changes Created 9 years, 3 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 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 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after
3548 3548
3549 protected: 3549 protected:
3550 virtual bool DataEquals(HValue* other) { return true; } 3550 virtual bool DataEquals(HValue* other) { return true; }
3551 }; 3551 };
3552 3552
3553 3553
3554 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> { 3554 class HLoadKeyedSpecializedArrayElement: public HTemplateInstruction<2> {
3555 public: 3555 public:
3556 HLoadKeyedSpecializedArrayElement(HValue* external_elements, 3556 HLoadKeyedSpecializedArrayElement(HValue* external_elements,
3557 HValue* key, 3557 HValue* key,
3558 JSObject::ElementsKind elements_kind) 3558 ElementsKind elements_kind)
3559 : elements_kind_(elements_kind) { 3559 : elements_kind_(elements_kind) {
3560 SetOperandAt(0, external_elements); 3560 SetOperandAt(0, external_elements);
3561 SetOperandAt(1, key); 3561 SetOperandAt(1, key);
3562 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || 3562 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
3563 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { 3563 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3564 set_representation(Representation::Double()); 3564 set_representation(Representation::Double());
3565 } else { 3565 } else {
3566 set_representation(Representation::Integer32()); 3566 set_representation(Representation::Integer32());
3567 } 3567 }
3568 SetFlag(kDependsOnSpecializedArrayElements); 3568 SetFlag(kDependsOnSpecializedArrayElements);
3569 // Native code could change the specialized array. 3569 // Native code could change the specialized array.
3570 SetFlag(kDependsOnCalls); 3570 SetFlag(kDependsOnCalls);
3571 SetFlag(kUseGVN); 3571 SetFlag(kUseGVN);
3572 } 3572 }
3573 3573
3574 virtual void PrintDataTo(StringStream* stream); 3574 virtual void PrintDataTo(StringStream* stream);
3575 3575
3576 virtual Representation RequiredInputRepresentation(int index) const { 3576 virtual Representation RequiredInputRepresentation(int index) const {
3577 // The key is supposed to be Integer32, but the base pointer 3577 // The key is supposed to be Integer32, but the base pointer
3578 // for the element load is a naked pointer. 3578 // for the element load is a naked pointer.
3579 return index == 0 3579 return index == 0
3580 ? Representation::External() 3580 ? Representation::External()
3581 : Representation::Integer32(); 3581 : Representation::Integer32();
3582 } 3582 }
3583 3583
3584 HValue* external_pointer() { return OperandAt(0); } 3584 HValue* external_pointer() { return OperandAt(0); }
3585 HValue* key() { return OperandAt(1); } 3585 HValue* key() { return OperandAt(1); }
3586 JSObject::ElementsKind elements_kind() const { return elements_kind_; } 3586 ElementsKind elements_kind() const { return elements_kind_; }
3587 3587
3588 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) 3588 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement)
3589 3589
3590 protected: 3590 protected:
3591 virtual bool DataEquals(HValue* other) { 3591 virtual bool DataEquals(HValue* other) {
3592 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; 3592 if (!other->IsLoadKeyedSpecializedArrayElement()) return false;
3593 HLoadKeyedSpecializedArrayElement* cast_other = 3593 HLoadKeyedSpecializedArrayElement* cast_other =
3594 HLoadKeyedSpecializedArrayElement::cast(other); 3594 HLoadKeyedSpecializedArrayElement::cast(other);
3595 return elements_kind_ == cast_other->elements_kind(); 3595 return elements_kind_ == cast_other->elements_kind();
3596 } 3596 }
3597 3597
3598 private: 3598 private:
3599 JSObject::ElementsKind elements_kind_; 3599 ElementsKind elements_kind_;
3600 }; 3600 };
3601 3601
3602 3602
3603 class HLoadKeyedGeneric: public HTemplateInstruction<3> { 3603 class HLoadKeyedGeneric: public HTemplateInstruction<3> {
3604 public: 3604 public:
3605 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 3605 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
3606 set_representation(Representation::Tagged()); 3606 set_representation(Representation::Tagged());
3607 SetOperandAt(0, obj); 3607 SetOperandAt(0, obj);
3608 SetOperandAt(1, key); 3608 SetOperandAt(1, key);
3609 SetOperandAt(2, context); 3609 SetOperandAt(2, context);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 3769
3770 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement) 3770 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastDoubleElement)
3771 }; 3771 };
3772 3772
3773 3773
3774 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { 3774 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> {
3775 public: 3775 public:
3776 HStoreKeyedSpecializedArrayElement(HValue* external_elements, 3776 HStoreKeyedSpecializedArrayElement(HValue* external_elements,
3777 HValue* key, 3777 HValue* key,
3778 HValue* val, 3778 HValue* val,
3779 JSObject::ElementsKind elements_kind) 3779 ElementsKind elements_kind)
3780 : elements_kind_(elements_kind) { 3780 : elements_kind_(elements_kind) {
3781 SetFlag(kChangesSpecializedArrayElements); 3781 SetFlag(kChangesSpecializedArrayElements);
3782 SetOperandAt(0, external_elements); 3782 SetOperandAt(0, external_elements);
3783 SetOperandAt(1, key); 3783 SetOperandAt(1, key);
3784 SetOperandAt(2, val); 3784 SetOperandAt(2, val);
3785 } 3785 }
3786 3786
3787 virtual void PrintDataTo(StringStream* stream); 3787 virtual void PrintDataTo(StringStream* stream);
3788 3788
3789 virtual Representation RequiredInputRepresentation(int index) const { 3789 virtual Representation RequiredInputRepresentation(int index) const {
3790 if (index == 0) { 3790 if (index == 0) {
3791 return Representation::External(); 3791 return Representation::External();
3792 } else { 3792 } else {
3793 bool float_or_double_elements = 3793 bool float_or_double_elements =
3794 elements_kind() == JSObject::EXTERNAL_FLOAT_ELEMENTS || 3794 elements_kind() == EXTERNAL_FLOAT_ELEMENTS ||
3795 elements_kind() == JSObject::EXTERNAL_DOUBLE_ELEMENTS; 3795 elements_kind() == EXTERNAL_DOUBLE_ELEMENTS;
3796 if (index == 2 && float_or_double_elements) { 3796 if (index == 2 && float_or_double_elements) {
3797 return Representation::Double(); 3797 return Representation::Double();
3798 } else { 3798 } else {
3799 return Representation::Integer32(); 3799 return Representation::Integer32();
3800 } 3800 }
3801 } 3801 }
3802 } 3802 }
3803 3803
3804 HValue* external_pointer() { return OperandAt(0); } 3804 HValue* external_pointer() { return OperandAt(0); }
3805 HValue* key() { return OperandAt(1); } 3805 HValue* key() { return OperandAt(1); }
3806 HValue* value() { return OperandAt(2); } 3806 HValue* value() { return OperandAt(2); }
3807 JSObject::ElementsKind elements_kind() const { return elements_kind_; } 3807 ElementsKind elements_kind() const { return elements_kind_; }
3808 3808
3809 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement) 3809 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement)
3810 3810
3811 private: 3811 private:
3812 JSObject::ElementsKind elements_kind_; 3812 ElementsKind elements_kind_;
3813 }; 3813 };
3814 3814
3815 3815
3816 class HStoreKeyedGeneric: public HTemplateInstruction<4> { 3816 class HStoreKeyedGeneric: public HTemplateInstruction<4> {
3817 public: 3817 public:
3818 HStoreKeyedGeneric(HValue* context, 3818 HStoreKeyedGeneric(HValue* context,
3819 HValue* object, 3819 HValue* object,
3820 HValue* key, 3820 HValue* key,
3821 HValue* value, 3821 HValue* value,
3822 bool strict_mode) 3822 bool strict_mode)
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 4192
4193 DECLARE_CONCRETE_INSTRUCTION(In) 4193 DECLARE_CONCRETE_INSTRUCTION(In)
4194 }; 4194 };
4195 4195
4196 #undef DECLARE_INSTRUCTION 4196 #undef DECLARE_INSTRUCTION
4197 #undef DECLARE_CONCRETE_INSTRUCTION 4197 #undef DECLARE_CONCRETE_INSTRUCTION
4198 4198
4199 } } // namespace v8::internal 4199 } } // namespace v8::internal
4200 4200
4201 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4201 #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