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

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

Issue 132233012: Revert "Implement in-heap backing store for typed arrays." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/ia32/lithium-codegen-ia32.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 V(Calls) \ 200 V(Calls) \
201 V(ContextSlots) \ 201 V(ContextSlots) \
202 V(DoubleArrayElements) \ 202 V(DoubleArrayElements) \
203 V(DoubleFields) \ 203 V(DoubleFields) \
204 V(ElementsKind) \ 204 V(ElementsKind) \
205 V(ElementsPointer) \ 205 V(ElementsPointer) \
206 V(GlobalVars) \ 206 V(GlobalVars) \
207 V(InobjectFields) \ 207 V(InobjectFields) \
208 V(OsrEntries) \ 208 V(OsrEntries) \
209 V(ExternalMemory) \ 209 V(ExternalMemory) \
210 V(StringChars) \ 210 V(StringChars)
211 V(TypedArrayElements)
212 211
213 212
214 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ 213 #define DECLARE_ABSTRACT_INSTRUCTION(type) \
215 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \ 214 virtual bool Is##type() const V8_FINAL V8_OVERRIDE { return true; } \
216 static H##type* cast(HValue* value) { \ 215 static H##type* cast(HValue* value) { \
217 ASSERT(value->Is##type()); \ 216 ASSERT(value->Is##type()); \
218 return reinterpret_cast<H##type*>(value); \ 217 return reinterpret_cast<H##type*>(value); \
219 } 218 }
220 219
221 220
(...skipping 6138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6360 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6359 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6361 public: 6360 public:
6362 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, 6361 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*,
6363 ElementsKind); 6362 ElementsKind);
6364 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, 6363 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*,
6365 ElementsKind, LoadKeyedHoleMode); 6364 ElementsKind, LoadKeyedHoleMode);
6366 6365
6367 bool is_external() const { 6366 bool is_external() const {
6368 return IsExternalArrayElementsKind(elements_kind()); 6367 return IsExternalArrayElementsKind(elements_kind());
6369 } 6368 }
6370 bool is_fixed_typed_array() const {
6371 return IsFixedTypedArrayElementsKind(elements_kind());
6372 }
6373 bool is_typed_elements() const {
6374 return is_external() || is_fixed_typed_array();
6375 }
6376 HValue* elements() { return OperandAt(0); } 6369 HValue* elements() { return OperandAt(0); }
6377 HValue* key() { return OperandAt(1); } 6370 HValue* key() { return OperandAt(1); }
6378 HValue* dependency() { 6371 HValue* dependency() {
6379 ASSERT(HasDependency()); 6372 ASSERT(HasDependency());
6380 return OperandAt(2); 6373 return OperandAt(2);
6381 } 6374 }
6382 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } 6375 bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
6383 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); } 6376 uint32_t index_offset() { return IndexOffsetField::decode(bit_field_); }
6384 void SetIndexOffset(uint32_t index_offset) { 6377 void SetIndexOffset(uint32_t index_offset) {
6385 bit_field_ = IndexOffsetField::update(bit_field_, index_offset); 6378 bit_field_ = IndexOffsetField::update(bit_field_, index_offset);
6386 } 6379 }
6387 virtual int MaxIndexOffsetBits() { 6380 virtual int MaxIndexOffsetBits() {
6388 return kBitsForIndexOffset; 6381 return kBitsForIndexOffset;
6389 } 6382 }
6390 HValue* GetKey() { return key(); } 6383 HValue* GetKey() { return key(); }
6391 void SetKey(HValue* key) { SetOperandAt(1, key); } 6384 void SetKey(HValue* key) { SetOperandAt(1, key); }
6392 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } 6385 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); }
6393 void SetDehoisted(bool is_dehoisted) { 6386 void SetDehoisted(bool is_dehoisted) {
6394 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); 6387 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted);
6395 } 6388 }
6396 ElementsKind elements_kind() const { 6389 ElementsKind elements_kind() const {
6397 return ElementsKindField::decode(bit_field_); 6390 return ElementsKindField::decode(bit_field_);
6398 } 6391 }
6399 LoadKeyedHoleMode hole_mode() const { 6392 LoadKeyedHoleMode hole_mode() const {
6400 return HoleModeField::decode(bit_field_); 6393 return HoleModeField::decode(bit_field_);
6401 } 6394 }
6402 6395
6403 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6396 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6404 // kind_fast: tagged[int32] (none) 6397 // kind_fast: tagged[int32] (none)
6405 // kind_double: tagged[int32] (none) 6398 // kind_double: tagged[int32] (none)
6406 // kind_fixed_typed_array: tagged[int32] (none) 6399 // kind_external: external[int32] (none)
6407 // kind_external: external[int32] (none)
6408 if (index == 0) { 6400 if (index == 0) {
6409 return is_external() ? Representation::External() 6401 return is_external() ? Representation::External()
6410 : Representation::Tagged(); 6402 : Representation::Tagged();
6411 } 6403 }
6412 if (index == 1) { 6404 if (index == 1) {
6413 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6405 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
6414 OperandAt(1)->representation()); 6406 OperandAt(1)->representation());
6415 } 6407 }
6416 return Representation::None(); 6408 return Representation::None();
6417 } 6409 }
(...skipping 29 matching lines...) Expand all
6447 ElementsKind elements_kind, 6439 ElementsKind elements_kind,
6448 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) 6440 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE)
6449 : bit_field_(0) { 6441 : bit_field_(0) {
6450 bit_field_ = ElementsKindField::encode(elements_kind) | 6442 bit_field_ = ElementsKindField::encode(elements_kind) |
6451 HoleModeField::encode(mode); 6443 HoleModeField::encode(mode);
6452 6444
6453 SetOperandAt(0, obj); 6445 SetOperandAt(0, obj);
6454 SetOperandAt(1, key); 6446 SetOperandAt(1, key);
6455 SetOperandAt(2, dependency != NULL ? dependency : obj); 6447 SetOperandAt(2, dependency != NULL ? dependency : obj);
6456 6448
6457 if (!is_typed_elements()) { 6449 if (!is_external()) {
6458 // I can detect the case between storing double (holey and fast) and 6450 // I can detect the case between storing double (holey and fast) and
6459 // smi/object by looking at elements_kind_. 6451 // smi/object by looking at elements_kind_.
6460 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || 6452 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) ||
6461 IsFastDoubleElementsKind(elements_kind)); 6453 IsFastDoubleElementsKind(elements_kind));
6462 6454
6463 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 6455 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
6464 if (IsFastSmiElementsKind(elements_kind) && 6456 if (IsFastSmiElementsKind(elements_kind) &&
6465 (!IsHoleyElementsKind(elements_kind) || 6457 (!IsHoleyElementsKind(elements_kind) ||
6466 mode == NEVER_RETURN_HOLE)) { 6458 mode == NEVER_RETURN_HOLE)) {
6467 set_type(HType::Smi()); 6459 set_type(HType::Smi());
6468 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { 6460 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) {
6469 set_representation(Representation::Integer32()); 6461 set_representation(Representation::Integer32());
6470 } else { 6462 } else {
6471 set_representation(Representation::Smi()); 6463 set_representation(Representation::Smi());
6472 } 6464 }
6473 } else { 6465 } else {
6474 set_representation(Representation::Tagged()); 6466 set_representation(Representation::Tagged());
6475 } 6467 }
6476 6468
6477 SetGVNFlag(kDependsOnArrayElements); 6469 SetGVNFlag(kDependsOnArrayElements);
6478 } else { 6470 } else {
6479 set_representation(Representation::Double()); 6471 set_representation(Representation::Double());
6480 SetGVNFlag(kDependsOnDoubleArrayElements); 6472 SetGVNFlag(kDependsOnDoubleArrayElements);
6481 } 6473 }
6482 } else { 6474 } else {
6483 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 6475 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
6484 elements_kind == EXTERNAL_DOUBLE_ELEMENTS || 6476 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
6485 elements_kind == FLOAT32_ELEMENTS ||
6486 elements_kind == FLOAT64_ELEMENTS) {
6487 set_representation(Representation::Double()); 6477 set_representation(Representation::Double());
6488 } else { 6478 } else {
6489 set_representation(Representation::Integer32()); 6479 set_representation(Representation::Integer32());
6490 } 6480 }
6491 6481
6492 if (is_external()) { 6482 SetGVNFlag(kDependsOnExternalMemory);
6493 SetGVNFlag(kDependsOnExternalMemory);
6494 } else if (is_fixed_typed_array()) {
6495 SetGVNFlag(kDependsOnTypedArrayElements);
6496 } else {
6497 UNREACHABLE();
6498 }
6499 // Native code could change the specialized array. 6483 // Native code could change the specialized array.
6500 SetGVNFlag(kDependsOnCalls); 6484 SetGVNFlag(kDependsOnCalls);
6501 } 6485 }
6502 6486
6503 SetFlag(kUseGVN); 6487 SetFlag(kUseGVN);
6504 } 6488 }
6505 6489
6506 virtual bool IsDeletable() const V8_OVERRIDE { 6490 virtual bool IsDeletable() const V8_OVERRIDE {
6507 return !RequiresHoleCheck(); 6491 return !RequiresHoleCheck();
6508 } 6492 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
6747 6731
6748 class HStoreKeyed V8_FINAL 6732 class HStoreKeyed V8_FINAL
6749 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6733 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6750 public: 6734 public:
6751 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6735 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6752 ElementsKind); 6736 ElementsKind);
6753 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, 6737 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*,
6754 ElementsKind, StoreFieldOrKeyedMode); 6738 ElementsKind, StoreFieldOrKeyedMode);
6755 6739
6756 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6740 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6757 // kind_fast: tagged[int32] = tagged 6741 // kind_fast: tagged[int32] = tagged
6758 // kind_double: tagged[int32] = double 6742 // kind_double: tagged[int32] = double
6759 // kind_smi : tagged[int32] = smi 6743 // kind_smi : tagged[int32] = smi
6760 // kind_fixed_typed_array: tagged[int32] = (double | int32) 6744 // kind_external: external[int32] = (double | int32)
6761 // kind_external: external[int32] = (double | int32)
6762 if (index == 0) { 6745 if (index == 0) {
6763 return is_external() ? Representation::External() 6746 return is_external() ? Representation::External()
6764 : Representation::Tagged(); 6747 : Representation::Tagged();
6765 } else if (index == 1) { 6748 } else if (index == 1) {
6766 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6749 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
6767 OperandAt(1)->representation()); 6750 OperandAt(1)->representation());
6768 } 6751 }
6769 6752
6770 ASSERT_EQ(index, 2); 6753 ASSERT_EQ(index, 2);
6771 if (IsDoubleOrFloatElementsKind(elements_kind())) { 6754 if (IsDoubleOrFloatElementsKind(elements_kind())) {
6772 return Representation::Double(); 6755 return Representation::Double();
6773 } 6756 }
6774 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { 6757 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) {
6775 return Representation::Integer32(); 6758 return Representation::Integer32();
6776 } 6759 }
6777 if (IsFastSmiElementsKind(elements_kind())) { 6760 if (IsFastSmiElementsKind(elements_kind())) {
6778 return Representation::Smi(); 6761 return Representation::Smi();
6779 } 6762 }
6780 6763
6781 return is_external() || is_fixed_typed_array() 6764 return is_external() ? Representation::Integer32()
6782 ? Representation::Integer32() 6765 : Representation::Tagged();
6783 : Representation::Tagged();
6784 } 6766 }
6785 6767
6786 bool is_external() const { 6768 bool is_external() const {
6787 return IsExternalArrayElementsKind(elements_kind()); 6769 return IsExternalArrayElementsKind(elements_kind());
6788 } 6770 }
6789 6771
6790 bool is_fixed_typed_array() const {
6791 return IsFixedTypedArrayElementsKind(elements_kind());
6792 }
6793
6794 bool is_typed_elements() const {
6795 return is_external() || is_fixed_typed_array();
6796 }
6797
6798 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 6772 virtual Representation observed_input_representation(int index) V8_OVERRIDE {
6799 if (index < 2) return RequiredInputRepresentation(index); 6773 if (index < 2) return RequiredInputRepresentation(index);
6800 if (IsUninitialized()) { 6774 if (IsUninitialized()) {
6801 return Representation::None(); 6775 return Representation::None();
6802 } 6776 }
6803 if (IsDoubleOrFloatElementsKind(elements_kind())) { 6777 if (IsDoubleOrFloatElementsKind(elements_kind())) {
6804 return Representation::Double(); 6778 return Representation::Double();
6805 } 6779 }
6806 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) { 6780 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) {
6807 return Representation::Integer32(); 6781 return Representation::Integer32();
6808 } 6782 }
6809 if (IsFastSmiElementsKind(elements_kind())) { 6783 if (IsFastSmiElementsKind(elements_kind())) {
6810 return Representation::Smi(); 6784 return Representation::Smi();
6811 } 6785 }
6812 if (is_typed_elements()) { 6786 if (is_external()) {
6813 return Representation::Integer32(); 6787 return Representation::Integer32();
6814 } 6788 }
6815 // For fast object elements kinds, don't assume anything. 6789 // For fast object elements kinds, don't assume anything.
6816 return Representation::None(); 6790 return Representation::None();
6817 } 6791 }
6818 6792
6819 HValue* elements() { return OperandAt(0); } 6793 HValue* elements() { return OperandAt(0); }
6820 HValue* key() { return OperandAt(1); } 6794 HValue* key() { return OperandAt(1); }
6821 HValue* value() { return OperandAt(2); } 6795 HValue* value() { return OperandAt(2); }
6822 bool value_is_smi() const { 6796 bool value_is_smi() const {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
6887 SetFlag(kTrackSideEffectDominators); 6861 SetFlag(kTrackSideEffectDominators);
6888 SetGVNFlag(kDependsOnNewSpacePromotion); 6862 SetGVNFlag(kDependsOnNewSpacePromotion);
6889 } 6863 }
6890 if (is_external()) { 6864 if (is_external()) {
6891 SetGVNFlag(kChangesExternalMemory); 6865 SetGVNFlag(kChangesExternalMemory);
6892 SetFlag(kAllowUndefinedAsNaN); 6866 SetFlag(kAllowUndefinedAsNaN);
6893 } else if (IsFastDoubleElementsKind(elements_kind)) { 6867 } else if (IsFastDoubleElementsKind(elements_kind)) {
6894 SetGVNFlag(kChangesDoubleArrayElements); 6868 SetGVNFlag(kChangesDoubleArrayElements);
6895 } else if (IsFastSmiElementsKind(elements_kind)) { 6869 } else if (IsFastSmiElementsKind(elements_kind)) {
6896 SetGVNFlag(kChangesArrayElements); 6870 SetGVNFlag(kChangesArrayElements);
6897 } else if (is_fixed_typed_array()) {
6898 SetGVNFlag(kChangesTypedArrayElements);
6899 SetFlag(kAllowUndefinedAsNaN);
6900 } else { 6871 } else {
6901 SetGVNFlag(kChangesArrayElements); 6872 SetGVNFlag(kChangesArrayElements);
6902 } 6873 }
6903 6874
6904 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. 6875 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
6905 if ((elements_kind >= EXTERNAL_BYTE_ELEMENTS && 6876 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS &&
6906 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) || 6877 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) {
6907 (elements_kind >= UINT8_ELEMENTS &&
6908 elements_kind <= INT32_ELEMENTS)) {
6909 SetFlag(kTruncatingToInt32); 6878 SetFlag(kTruncatingToInt32);
6910 } 6879 }
6911 } 6880 }
6912 6881
6913 ElementsKind elements_kind_; 6882 ElementsKind elements_kind_;
6914 uint32_t index_offset_; 6883 uint32_t index_offset_;
6915 bool is_dehoisted_ : 1; 6884 bool is_dehoisted_ : 1;
6916 bool is_uninitialized_ : 1; 6885 bool is_uninitialized_ : 1;
6917 StoreFieldOrKeyedMode store_mode_: 1; 6886 StoreFieldOrKeyedMode store_mode_: 1;
6918 HValue* new_space_dominator_; 6887 HValue* new_space_dominator_;
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
7607 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7576 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7608 }; 7577 };
7609 7578
7610 7579
7611 #undef DECLARE_INSTRUCTION 7580 #undef DECLARE_INSTRUCTION
7612 #undef DECLARE_CONCRETE_INSTRUCTION 7581 #undef DECLARE_CONCRETE_INSTRUCTION
7613 7582
7614 } } // namespace v8::internal 7583 } } // namespace v8::internal
7615 7584
7616 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7585 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698