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

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

Issue 1254623002: Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 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
« 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 // 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 6230 matching lines...) Expand 10 before | Expand all | Expand 10 after
6241 static HObjectAccess ForJSArrayBufferBitField() { 6241 static HObjectAccess ForJSArrayBufferBitField() {
6242 return HObjectAccess::ForObservableJSObjectOffset( 6242 return HObjectAccess::ForObservableJSObjectOffset(
6243 JSArrayBuffer::kBitFieldOffset, Representation::Integer32()); 6243 JSArrayBuffer::kBitFieldOffset, Representation::Integer32());
6244 } 6244 }
6245 6245
6246 static HObjectAccess ForJSArrayBufferBitFieldSlot() { 6246 static HObjectAccess ForJSArrayBufferBitFieldSlot() {
6247 return HObjectAccess::ForObservableJSObjectOffset( 6247 return HObjectAccess::ForObservableJSObjectOffset(
6248 JSArrayBuffer::kBitFieldSlot, Representation::Smi()); 6248 JSArrayBuffer::kBitFieldSlot, Representation::Smi());
6249 } 6249 }
6250 6250
6251 static HObjectAccess ForExternalArrayExternalPointer() {
6252 return HObjectAccess::ForObservableJSObjectOffset(
6253 ExternalArray::kExternalPointerOffset, Representation::External());
6254 }
6255
6256 static HObjectAccess ForJSArrayBufferViewBuffer() { 6251 static HObjectAccess ForJSArrayBufferViewBuffer() {
6257 return HObjectAccess::ForObservableJSObjectOffset( 6252 return HObjectAccess::ForObservableJSObjectOffset(
6258 JSArrayBufferView::kBufferOffset); 6253 JSArrayBufferView::kBufferOffset);
6259 } 6254 }
6260 6255
6261 static HObjectAccess ForJSArrayBufferViewByteOffset() { 6256 static HObjectAccess ForJSArrayBufferViewByteOffset() {
6262 return HObjectAccess::ForObservableJSObjectOffset( 6257 return HObjectAccess::ForObservableJSObjectOffset(
6263 JSArrayBufferView::kByteOffsetOffset); 6258 JSArrayBufferView::kByteOffsetOffset);
6264 } 6259 }
6265 6260
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
6615 class HLoadKeyed final : public HTemplateInstruction<3>, 6610 class HLoadKeyed final : public HTemplateInstruction<3>,
6616 public ArrayInstructionInterface { 6611 public ArrayInstructionInterface {
6617 public: 6612 public:
6618 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, 6613 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*,
6619 ElementsKind); 6614 ElementsKind);
6620 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, 6615 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*,
6621 ElementsKind, LoadKeyedHoleMode); 6616 ElementsKind, LoadKeyedHoleMode);
6622 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, 6617 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*,
6623 ElementsKind, LoadKeyedHoleMode, int); 6618 ElementsKind, LoadKeyedHoleMode, int);
6624 6619
6625 bool is_external() const {
6626 return IsExternalArrayElementsKind(elements_kind());
6627 }
6628 bool is_fixed_typed_array() const { 6620 bool is_fixed_typed_array() const {
6629 return IsFixedTypedArrayElementsKind(elements_kind()); 6621 return IsFixedTypedArrayElementsKind(elements_kind());
6630 } 6622 }
6631 bool is_typed_elements() const {
6632 return is_external() || is_fixed_typed_array();
6633 }
6634 HValue* elements() const { return OperandAt(0); } 6623 HValue* elements() const { return OperandAt(0); }
6635 HValue* key() const { return OperandAt(1); } 6624 HValue* key() const { return OperandAt(1); }
6636 HValue* dependency() const { 6625 HValue* dependency() const {
6637 DCHECK(HasDependency()); 6626 DCHECK(HasDependency());
6638 return OperandAt(2); 6627 return OperandAt(2);
6639 } 6628 }
6640 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } 6629 bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
6641 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } 6630 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); }
6642 bool TryIncreaseBaseOffset(uint32_t increase_by_value) override; 6631 bool TryIncreaseBaseOffset(uint32_t increase_by_value) override;
6643 HValue* GetKey() override { return key(); } 6632 HValue* GetKey() override { return key(); }
(...skipping 10 matching lines...) Expand all
6654 LoadKeyedHoleMode hole_mode() const { 6643 LoadKeyedHoleMode hole_mode() const {
6655 return HoleModeField::decode(bit_field_); 6644 return HoleModeField::decode(bit_field_);
6656 } 6645 }
6657 6646
6658 Representation RequiredInputRepresentation(int index) override { 6647 Representation RequiredInputRepresentation(int index) override {
6659 // kind_fast: tagged[int32] (none) 6648 // kind_fast: tagged[int32] (none)
6660 // kind_double: tagged[int32] (none) 6649 // kind_double: tagged[int32] (none)
6661 // kind_fixed_typed_array: external[int32] (none) 6650 // kind_fixed_typed_array: external[int32] (none)
6662 // kind_external: external[int32] (none) 6651 // kind_external: external[int32] (none)
6663 if (index == 0) { 6652 if (index == 0) {
6664 return is_typed_elements() ? Representation::External() 6653 return is_fixed_typed_array() ? Representation::External()
6665 : Representation::Tagged(); 6654 : Representation::Tagged();
6666 } 6655 }
6667 if (index == 1) { 6656 if (index == 1) {
6668 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6657 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
6669 OperandAt(1)->representation()); 6658 OperandAt(1)->representation());
6670 } 6659 }
6671 return Representation::None(); 6660 return Representation::None();
6672 } 6661 }
6673 6662
6674 Representation observed_input_representation(int index) override { 6663 Representation observed_input_representation(int index) override {
6675 return RequiredInputRepresentation(index); 6664 return RequiredInputRepresentation(index);
(...skipping 28 matching lines...) Expand all
6704 ? GetDefaultHeaderSizeForElementsKind(elements_kind) 6693 ? GetDefaultHeaderSizeForElementsKind(elements_kind)
6705 : offset; 6694 : offset;
6706 bit_field_ = ElementsKindField::encode(elements_kind) | 6695 bit_field_ = ElementsKindField::encode(elements_kind) |
6707 HoleModeField::encode(mode) | 6696 HoleModeField::encode(mode) |
6708 BaseOffsetField::encode(offset); 6697 BaseOffsetField::encode(offset);
6709 6698
6710 SetOperandAt(0, obj); 6699 SetOperandAt(0, obj);
6711 SetOperandAt(1, key); 6700 SetOperandAt(1, key);
6712 SetOperandAt(2, dependency != NULL ? dependency : obj); 6701 SetOperandAt(2, dependency != NULL ? dependency : obj);
6713 6702
6714 if (!is_typed_elements()) { 6703 if (!is_fixed_typed_array()) {
6715 // I can detect the case between storing double (holey and fast) and 6704 // I can detect the case between storing double (holey and fast) and
6716 // smi/object by looking at elements_kind_. 6705 // smi/object by looking at elements_kind_.
6717 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind) || 6706 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind) ||
6718 IsFastDoubleElementsKind(elements_kind)); 6707 IsFastDoubleElementsKind(elements_kind));
6719 6708
6720 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 6709 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
6721 if (IsFastSmiElementsKind(elements_kind) && 6710 if (IsFastSmiElementsKind(elements_kind) &&
6722 (!IsHoleyElementsKind(elements_kind) || 6711 (!IsHoleyElementsKind(elements_kind) ||
6723 mode == NEVER_RETURN_HOLE)) { 6712 mode == NEVER_RETURN_HOLE)) {
6724 set_type(HType::Smi()); 6713 set_type(HType::Smi());
6725 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { 6714 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) {
6726 set_representation(Representation::Integer32()); 6715 set_representation(Representation::Integer32());
6727 } else { 6716 } else {
6728 set_representation(Representation::Smi()); 6717 set_representation(Representation::Smi());
6729 } 6718 }
6730 } else { 6719 } else {
6731 set_representation(Representation::Tagged()); 6720 set_representation(Representation::Tagged());
6732 } 6721 }
6733 6722
6734 SetDependsOnFlag(kArrayElements); 6723 SetDependsOnFlag(kArrayElements);
6735 } else { 6724 } else {
6736 set_representation(Representation::Double()); 6725 set_representation(Representation::Double());
6737 SetDependsOnFlag(kDoubleArrayElements); 6726 SetDependsOnFlag(kDoubleArrayElements);
6738 } 6727 }
6739 } else { 6728 } else {
6740 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 6729 if (elements_kind == FLOAT32_ELEMENTS ||
6741 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
6742 elements_kind == FLOAT32_ELEMENTS ||
6743 elements_kind == FLOAT64_ELEMENTS) { 6730 elements_kind == FLOAT64_ELEMENTS) {
6744 set_representation(Representation::Double()); 6731 set_representation(Representation::Double());
6745 } else { 6732 } else {
6746 set_representation(Representation::Integer32()); 6733 set_representation(Representation::Integer32());
6747 } 6734 }
6748 6735
6749 if (is_external()) { 6736 if (is_fixed_typed_array()) {
6750 SetDependsOnFlag(kExternalMemory); 6737 SetDependsOnFlag(kExternalMemory);
6751 } else if (is_fixed_typed_array()) {
6752 SetDependsOnFlag(kTypedArrayElements); 6738 SetDependsOnFlag(kTypedArrayElements);
6753 } else { 6739 } else {
6754 UNREACHABLE(); 6740 UNREACHABLE();
6755 } 6741 }
6756 // Native code could change the specialized array. 6742 // Native code could change the specialized array.
6757 SetDependsOnFlag(kCalls); 6743 SetDependsOnFlag(kCalls);
6758 } 6744 }
6759 6745
6760 SetFlag(kUseGVN); 6746 SetFlag(kUseGVN);
6761 } 6747 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
7116 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, 7102 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*,
7117 ElementsKind, StoreFieldOrKeyedMode, int); 7103 ElementsKind, StoreFieldOrKeyedMode, int);
7118 7104
7119 Representation RequiredInputRepresentation(int index) override { 7105 Representation RequiredInputRepresentation(int index) override {
7120 // kind_fast: tagged[int32] = tagged 7106 // kind_fast: tagged[int32] = tagged
7121 // kind_double: tagged[int32] = double 7107 // kind_double: tagged[int32] = double
7122 // kind_smi : tagged[int32] = smi 7108 // kind_smi : tagged[int32] = smi
7123 // kind_fixed_typed_array: tagged[int32] = (double | int32) 7109 // kind_fixed_typed_array: tagged[int32] = (double | int32)
7124 // kind_external: external[int32] = (double | int32) 7110 // kind_external: external[int32] = (double | int32)
7125 if (index == 0) { 7111 if (index == 0) {
7126 return is_typed_elements() ? Representation::External() 7112 return is_fixed_typed_array() ? Representation::External()
7127 : Representation::Tagged(); 7113 : Representation::Tagged();
7128 } else if (index == 1) { 7114 } else if (index == 1) {
7129 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 7115 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
7130 OperandAt(1)->representation()); 7116 OperandAt(1)->representation());
7131 } 7117 }
7132 7118
7133 DCHECK_EQ(index, 2); 7119 DCHECK_EQ(index, 2);
7134 return RequiredValueRepresentation(elements_kind(), store_mode()); 7120 return RequiredValueRepresentation(elements_kind(), store_mode());
7135 } 7121 }
7136 7122
7137 static Representation RequiredValueRepresentation( 7123 static Representation RequiredValueRepresentation(
7138 ElementsKind kind, StoreFieldOrKeyedMode mode) { 7124 ElementsKind kind, StoreFieldOrKeyedMode mode) {
7139 if (IsDoubleOrFloatElementsKind(kind)) { 7125 if (IsDoubleOrFloatElementsKind(kind)) {
7140 return Representation::Double(); 7126 return Representation::Double();
7141 } 7127 }
7142 7128
7143 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() && 7129 if (kind == FAST_SMI_ELEMENTS && SmiValuesAre32Bits() &&
7144 mode == STORE_TO_INITIALIZED_ENTRY) { 7130 mode == STORE_TO_INITIALIZED_ENTRY) {
7145 return Representation::Integer32(); 7131 return Representation::Integer32();
7146 } 7132 }
7147 7133
7148 if (IsFastSmiElementsKind(kind)) { 7134 if (IsFastSmiElementsKind(kind)) {
7149 return Representation::Smi(); 7135 return Representation::Smi();
7150 } 7136 }
7151 7137
7152 return IsExternalArrayElementsKind(kind) || 7138 if (IsFixedTypedArrayElementsKind(kind)) {
7153 IsFixedTypedArrayElementsKind(kind) 7139 return Representation::Integer32();
7154 ? Representation::Integer32() 7140 }
7155 : Representation::Tagged(); 7141 return Representation::Tagged();
7156 }
7157
7158 bool is_external() const {
7159 return IsExternalArrayElementsKind(elements_kind());
7160 } 7142 }
7161 7143
7162 bool is_fixed_typed_array() const { 7144 bool is_fixed_typed_array() const {
7163 return IsFixedTypedArrayElementsKind(elements_kind()); 7145 return IsFixedTypedArrayElementsKind(elements_kind());
7164 } 7146 }
7165 7147
7166 bool is_typed_elements() const {
7167 return is_external() || is_fixed_typed_array();
7168 }
7169
7170 Representation observed_input_representation(int index) override { 7148 Representation observed_input_representation(int index) override {
7171 if (index < 2) return RequiredInputRepresentation(index); 7149 if (index < 2) return RequiredInputRepresentation(index);
7172 if (IsUninitialized()) { 7150 if (IsUninitialized()) {
7173 return Representation::None(); 7151 return Representation::None();
7174 } 7152 }
7175 Representation r = 7153 Representation r =
7176 RequiredValueRepresentation(elements_kind(), store_mode()); 7154 RequiredValueRepresentation(elements_kind(), store_mode());
7177 // For fast object elements kinds, don't assume anything. 7155 // For fast object elements kinds, don't assume anything.
7178 if (r.IsTagged()) return Representation::None(); 7156 if (r.IsTagged()) return Representation::None();
7179 return r; 7157 return r;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
7249 ElementsKindField::encode(elements_kind)), 7227 ElementsKindField::encode(elements_kind)),
7250 dominator_(NULL) { 7228 dominator_(NULL) {
7251 SetOperandAt(0, obj); 7229 SetOperandAt(0, obj);
7252 SetOperandAt(1, key); 7230 SetOperandAt(1, key);
7253 SetOperandAt(2, val); 7231 SetOperandAt(2, val);
7254 7232
7255 if (IsFastObjectElementsKind(elements_kind)) { 7233 if (IsFastObjectElementsKind(elements_kind)) {
7256 SetFlag(kTrackSideEffectDominators); 7234 SetFlag(kTrackSideEffectDominators);
7257 SetDependsOnFlag(kNewSpacePromotion); 7235 SetDependsOnFlag(kNewSpacePromotion);
7258 } 7236 }
7259 if (is_external()) { 7237 if (IsFastDoubleElementsKind(elements_kind)) {
7260 SetChangesFlag(kExternalMemory);
7261 SetFlag(kAllowUndefinedAsNaN);
7262 } else if (IsFastDoubleElementsKind(elements_kind)) {
7263 SetChangesFlag(kDoubleArrayElements); 7238 SetChangesFlag(kDoubleArrayElements);
7264 } else if (IsFastSmiElementsKind(elements_kind)) { 7239 } else if (IsFastSmiElementsKind(elements_kind)) {
7265 SetChangesFlag(kArrayElements); 7240 SetChangesFlag(kArrayElements);
7266 } else if (is_fixed_typed_array()) { 7241 } else if (is_fixed_typed_array()) {
7267 SetChangesFlag(kTypedArrayElements); 7242 SetChangesFlag(kTypedArrayElements);
7243 SetChangesFlag(kExternalMemory);
7268 SetFlag(kAllowUndefinedAsNaN); 7244 SetFlag(kAllowUndefinedAsNaN);
7269 } else { 7245 } else {
7270 SetChangesFlag(kArrayElements); 7246 SetChangesFlag(kArrayElements);
7271 } 7247 }
7272 7248
7273 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. 7249 // {UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
7274 if ((elements_kind >= EXTERNAL_INT8_ELEMENTS && 7250 if (elements_kind >= UINT8_ELEMENTS && elements_kind <= INT32_ELEMENTS) {
7275 elements_kind <= EXTERNAL_UINT32_ELEMENTS) ||
7276 (elements_kind >= UINT8_ELEMENTS &&
7277 elements_kind <= INT32_ELEMENTS)) {
7278 SetFlag(kTruncatingToInt32); 7251 SetFlag(kTruncatingToInt32);
7279 } 7252 }
7280 } 7253 }
7281 7254
7282 class IsDehoistedField : public BitField<bool, 0, 1> {}; 7255 class IsDehoistedField : public BitField<bool, 0, 1> {};
7283 class IsUninitializedField : public BitField<bool, 1, 1> {}; 7256 class IsUninitializedField : public BitField<bool, 1, 1> {};
7284 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 2, 1> {}; 7257 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 2, 1> {};
7285 class ElementsKindField : public BitField<ElementsKind, 3, 5> {}; 7258 class ElementsKindField : public BitField<ElementsKind, 3, 5> {};
7286 7259
7287 uint32_t base_offset_; 7260 uint32_t base_offset_;
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
8095 }; 8068 };
8096 8069
8097 8070
8098 8071
8099 #undef DECLARE_INSTRUCTION 8072 #undef DECLARE_INSTRUCTION
8100 #undef DECLARE_CONCRETE_INSTRUCTION 8073 #undef DECLARE_CONCRETE_INSTRUCTION
8101 8074
8102 } } // namespace v8::internal 8075 } } // namespace v8::internal
8103 8076
8104 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 8077 #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