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

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

Issue 143413019: Load elimination fix with a test case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Making store_mode parameter of HStoreNamedField explicit. 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
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 6500 matching lines...) Expand 10 before | Expand all | Expand 10 after
6511 SetOperandAt(1, key); 6511 SetOperandAt(1, key);
6512 SetOperandAt(2, context); 6512 SetOperandAt(2, context);
6513 SetAllSideEffects(); 6513 SetAllSideEffects();
6514 } 6514 }
6515 }; 6515 };
6516 6516
6517 6517
6518 // Indicates whether the store is a store to an entry that was previously 6518 // Indicates whether the store is a store to an entry that was previously
6519 // initialized or not. 6519 // initialized or not.
6520 enum StoreFieldOrKeyedMode { 6520 enum StoreFieldOrKeyedMode {
6521 // This is a store of either an undefined value to a field or a hole/NaN to
6522 // an entry of a newly allocated object.
6523 PREINITIALIZING_STORE,
6524 // The entry could be either previously initialized or not.
6521 INITIALIZING_STORE, 6525 INITIALIZING_STORE,
6526 // At the time of this store it is guaranteed that the entry is already
6527 // initialized.
6522 STORE_TO_INITIALIZED_ENTRY 6528 STORE_TO_INITIALIZED_ENTRY
6523 }; 6529 };
6524 6530
6525 6531
6526 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6532 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
6527 public: 6533 public:
6528 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6529 HObjectAccess, HValue*);
6530 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, 6534 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*,
6531 HObjectAccess, HValue*, StoreFieldOrKeyedMode); 6535 HObjectAccess, HValue*, StoreFieldOrKeyedMode);
6532 6536
6533 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6537 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6534 6538
6535 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { 6539 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE {
6536 return index == 1; 6540 return index == 1;
6537 } 6541 }
6538 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6542 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6539 return !access().IsInobject() || access().offset() >= size; 6543 return !access().IsInobject() || access().offset() >= size;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
6626 } 6630 }
6627 6631
6628 void UpdateValue(HValue* value) { 6632 void UpdateValue(HValue* value) {
6629 SetOperandAt(1, value); 6633 SetOperandAt(1, value);
6630 } 6634 }
6631 6635
6632 private: 6636 private:
6633 HStoreNamedField(HValue* obj, 6637 HStoreNamedField(HValue* obj,
6634 HObjectAccess access, 6638 HObjectAccess access,
6635 HValue* val, 6639 HValue* val,
6636 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) 6640 StoreFieldOrKeyedMode store_mode)
6637 : access_(access), 6641 : access_(access),
6638 new_space_dominator_(NULL), 6642 new_space_dominator_(NULL),
6639 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6643 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6640 has_transition_(false), 6644 has_transition_(false),
6641 store_mode_(store_mode) { 6645 store_mode_(store_mode) {
6646 // Preinitializing stores are made only to just allocated objects.
6647 ASSERT(store_mode != PREINITIALIZING_STORE ||
6648 obj->IsAllocate() || obj->IsInnerAllocatedObject());
6642 SetOperandAt(0, obj); 6649 SetOperandAt(0, obj);
6643 SetOperandAt(1, val); 6650 SetOperandAt(1, val);
6644 SetOperandAt(2, obj); 6651 SetOperandAt(2, obj);
6645 access.SetGVNFlags(this, true); 6652 access.SetGVNFlags(this, true);
6646 } 6653 }
6647 6654
6648 HObjectAccess access_; 6655 HObjectAccess access_;
6649 HValue* new_space_dominator_; 6656 HValue* new_space_dominator_;
6650 WriteBarrierMode write_barrier_mode_ : 1; 6657 WriteBarrierMode write_barrier_mode_ : 1;
6651 bool has_transition_ : 1; 6658 bool has_transition_ : 1;
6652 StoreFieldOrKeyedMode store_mode_ : 1; 6659 StoreFieldOrKeyedMode store_mode_ : 2;
6653 }; 6660 };
6654 6661
6655 6662
6656 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6663 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6657 public: 6664 public:
6658 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6665 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6659 Handle<String>, HValue*, 6666 Handle<String>, HValue*,
6660 StrictModeFlag); 6667 StrictModeFlag);
6661 HValue* object() { return OperandAt(0); } 6668 HValue* object() { return OperandAt(0); }
6662 HValue* value() { return OperandAt(1); } 6669 HValue* value() { return OperandAt(1); }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
6853 (elements_kind >= UINT8_ELEMENTS && 6860 (elements_kind >= UINT8_ELEMENTS &&
6854 elements_kind <= INT32_ELEMENTS)) { 6861 elements_kind <= INT32_ELEMENTS)) {
6855 SetFlag(kTruncatingToInt32); 6862 SetFlag(kTruncatingToInt32);
6856 } 6863 }
6857 } 6864 }
6858 6865
6859 ElementsKind elements_kind_; 6866 ElementsKind elements_kind_;
6860 uint32_t index_offset_; 6867 uint32_t index_offset_;
6861 bool is_dehoisted_ : 1; 6868 bool is_dehoisted_ : 1;
6862 bool is_uninitialized_ : 1; 6869 bool is_uninitialized_ : 1;
6863 StoreFieldOrKeyedMode store_mode_: 1; 6870 StoreFieldOrKeyedMode store_mode_: 2;
6864 HValue* new_space_dominator_; 6871 HValue* new_space_dominator_;
6865 }; 6872 };
6866 6873
6867 6874
6868 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 6875 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
6869 public: 6876 public:
6870 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, 6877 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
6871 HValue*, HValue*, StrictModeFlag); 6878 HValue*, HValue*, StrictModeFlag);
6872 6879
6873 HValue* object() { return OperandAt(0); } 6880 HValue* object() { return OperandAt(0); }
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
7553 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7560 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7554 }; 7561 };
7555 7562
7556 7563
7557 #undef DECLARE_INSTRUCTION 7564 #undef DECLARE_INSTRUCTION
7558 #undef DECLARE_CONCRETE_INSTRUCTION 7565 #undef DECLARE_CONCRETE_INSTRUCTION
7559 7566
7560 } } // namespace v8::internal 7567 } } // namespace v8::internal
7561 7568
7562 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7569 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698