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

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

Issue 108413003: HStoreNamedField for Smis optimized for x64 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even cleaner implementation Created 7 years 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/objects-inl.h » ('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 6494 matching lines...) Expand 10 before | Expand all | Expand 10 after
6505 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { 6505 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
6506 set_representation(Representation::Tagged()); 6506 set_representation(Representation::Tagged());
6507 SetOperandAt(0, obj); 6507 SetOperandAt(0, obj);
6508 SetOperandAt(1, key); 6508 SetOperandAt(1, key);
6509 SetOperandAt(2, context); 6509 SetOperandAt(2, context);
6510 SetAllSideEffects(); 6510 SetAllSideEffects();
6511 } 6511 }
6512 }; 6512 };
6513 6513
6514 6514
6515 // Indicates whether the store is a store to an entry that was previously
6516 // initialized or not.
6517 enum StoreFieldOrKeyedMode {
6518 INITIALIZING_STORE,
6519 STORE_TO_INITIALIZED_ENTRY
6520 };
6521
6522
6515 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6523 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
6516 public: 6524 public:
6517 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6525 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6518 HObjectAccess, HValue*); 6526 HObjectAccess, HValue*);
6527 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*,
6528 HObjectAccess, HValue*, StoreFieldOrKeyedMode);
6519 6529
6520 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6530 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6521 6531
6522 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { 6532 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE {
6523 return index == 1; 6533 return index == 1;
6524 } 6534 }
6525 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6535 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6526 return !access().IsInobject() || access().offset() >= size; 6536 return !access().IsInobject() || access().offset() >= size;
6527 } 6537 }
6528 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6538 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6529 if (index == 0 && access().IsExternalMemory()) { 6539 if (index == 0 && access().IsExternalMemory()) {
6530 // object must be external in case of external memory access 6540 // object must be external in case of external memory access
6531 return Representation::External(); 6541 return Representation::External();
6532 } else if (index == 1) { 6542 } else if (index == 1) {
6533 if (field_representation().IsInteger8() || 6543 if (field_representation().IsInteger8() ||
6534 field_representation().IsUInteger8() || 6544 field_representation().IsUInteger8() ||
6535 field_representation().IsInteger16() || 6545 field_representation().IsInteger16() ||
6536 field_representation().IsUInteger16() || 6546 field_representation().IsUInteger16() ||
6537 field_representation().IsInteger32()) { 6547 field_representation().IsInteger32()) {
6538 return Representation::Integer32(); 6548 return Representation::Integer32();
6539 } else if (field_representation().IsDouble() || 6549 } else if (field_representation().IsDouble()) {
6540 field_representation().IsSmi()) { 6550 return field_representation();
6551 } else if (field_representation().IsSmi()) {
6552 if (SmiValuesAre32Bits() && store_mode_ == STORE_TO_INITIALIZED_ENTRY) {
6553 return Representation::Integer32();
6554 }
6541 return field_representation(); 6555 return field_representation();
6542 } else if (field_representation().IsExternal()) { 6556 } else if (field_representation().IsExternal()) {
6543 return Representation::External(); 6557 return Representation::External();
6544 } 6558 }
6545 } 6559 }
6546 return Representation::Tagged(); 6560 return Representation::Tagged();
6547 } 6561 }
6548 virtual void HandleSideEffectDominator(GVNFlag side_effect, 6562 virtual void HandleSideEffectDominator(GVNFlag side_effect,
6549 HValue* dominator) V8_OVERRIDE { 6563 HValue* dominator) V8_OVERRIDE {
6550 ASSERT(side_effect == kChangesNewSpacePromotion); 6564 ASSERT(side_effect == kChangesNewSpacePromotion);
6551 new_space_dominator_ = dominator; 6565 new_space_dominator_ = dominator;
6552 } 6566 }
6553 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6567 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6554 6568
6555 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } 6569 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; }
6556 bool IsSkipWriteBarrier() const { 6570 bool IsSkipWriteBarrier() const {
6557 return write_barrier_mode_ == SKIP_WRITE_BARRIER; 6571 return write_barrier_mode_ == SKIP_WRITE_BARRIER;
6558 } 6572 }
6559 6573
6560 HValue* object() const { return OperandAt(0); } 6574 HValue* object() const { return OperandAt(0); }
6561 HValue* value() const { return OperandAt(1); } 6575 HValue* value() const { return OperandAt(1); }
6562 HValue* transition() const { return OperandAt(2); } 6576 HValue* transition() const { return OperandAt(2); }
6563 6577
6564 HObjectAccess access() const { return access_; } 6578 HObjectAccess access() const { return access_; }
6565 HValue* new_space_dominator() const { return new_space_dominator_; } 6579 HValue* new_space_dominator() const { return new_space_dominator_; }
6566 bool has_transition() const { return has_transition_; } 6580 bool has_transition() const { return has_transition_; }
6581 StoreFieldOrKeyedMode store_mode() const { return store_mode_; }
6567 6582
6568 Handle<Map> transition_map() const { 6583 Handle<Map> transition_map() const {
6569 if (has_transition()) { 6584 if (has_transition()) {
6570 return Handle<Map>::cast( 6585 return Handle<Map>::cast(
6571 HConstant::cast(transition())->handle(Isolate::Current())); 6586 HConstant::cast(transition())->handle(Isolate::Current()));
6572 } else { 6587 } else {
6573 return Handle<Map>(); 6588 return Handle<Map>();
6574 } 6589 }
6575 } 6590 }
6576 6591
(...skipping 30 matching lines...) Expand all
6607 return access_.representation(); 6622 return access_.representation();
6608 } 6623 }
6609 6624
6610 void UpdateValue(HValue* value) { 6625 void UpdateValue(HValue* value) {
6611 SetOperandAt(1, value); 6626 SetOperandAt(1, value);
6612 } 6627 }
6613 6628
6614 private: 6629 private:
6615 HStoreNamedField(HValue* obj, 6630 HStoreNamedField(HValue* obj,
6616 HObjectAccess access, 6631 HObjectAccess access,
6617 HValue* val) 6632 HValue* val,
6633 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE)
6618 : access_(access), 6634 : access_(access),
6619 new_space_dominator_(NULL), 6635 new_space_dominator_(NULL),
6620 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6636 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6621 has_transition_(false) { 6637 has_transition_(false),
6638 store_mode_(store_mode) {
6622 SetOperandAt(0, obj); 6639 SetOperandAt(0, obj);
6623 SetOperandAt(1, val); 6640 SetOperandAt(1, val);
6624 SetOperandAt(2, obj); 6641 SetOperandAt(2, obj);
6625 access.SetGVNFlags(this, true); 6642 access.SetGVNFlags(this, true);
6626 } 6643 }
6627 6644
6628 HObjectAccess access_; 6645 HObjectAccess access_;
6629 HValue* new_space_dominator_; 6646 HValue* new_space_dominator_;
6630 WriteBarrierMode write_barrier_mode_ : 1; 6647 WriteBarrierMode write_barrier_mode_ : 1;
6631 bool has_transition_ : 1; 6648 bool has_transition_ : 1;
6649 StoreFieldOrKeyedMode store_mode_ : 1;
6632 }; 6650 };
6633 6651
6634 6652
6635 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6653 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6636 public: 6654 public:
6637 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6655 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6638 Handle<String>, HValue*, 6656 Handle<String>, HValue*,
6639 StrictModeFlag); 6657 StrictModeFlag);
6640 HValue* object() { return OperandAt(0); } 6658 HValue* object() { return OperandAt(0); }
6641 HValue* value() { return OperandAt(1); } 6659 HValue* value() { return OperandAt(1); }
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
7493 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7511 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7494 }; 7512 };
7495 7513
7496 7514
7497 #undef DECLARE_INSTRUCTION 7515 #undef DECLARE_INSTRUCTION
7498 #undef DECLARE_CONCRETE_INSTRUCTION 7516 #undef DECLARE_CONCRETE_INSTRUCTION
7499 7517
7500 } } // namespace v8::internal 7518 } } // namespace v8::internal
7501 7519
7502 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7520 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698