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

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

Issue 23892007: Consider out-of-bounds accesses as escaping uses. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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-escape-analysis.cc ('k') | test/mjsunit/compiler/escape-analysis.js » ('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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } 860 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); }
861 bool RangeCanInclude(int value) const { 861 bool RangeCanInclude(int value) const {
862 return !HasRange() || range()->Includes(value); 862 return !HasRange() || range()->Includes(value);
863 } 863 }
864 void AddNewRange(Range* r, Zone* zone); 864 void AddNewRange(Range* r, Zone* zone);
865 void RemoveLastAddedRange(); 865 void RemoveLastAddedRange();
866 void ComputeInitialRange(Zone* zone); 866 void ComputeInitialRange(Zone* zone);
867 867
868 // Escape analysis helpers. 868 // Escape analysis helpers.
869 virtual bool HasEscapingOperandAt(int index) { return true; } 869 virtual bool HasEscapingOperandAt(int index) { return true; }
870 virtual bool HasOutOfBoundsAccess(int size) { return false; }
870 871
871 // Representation helpers. 872 // Representation helpers.
872 virtual Representation observed_input_representation(int index) { 873 virtual Representation observed_input_representation(int index) {
873 return Representation::None(); 874 return Representation::None();
874 } 875 }
875 virtual Representation RequiredInputRepresentation(int index) = 0; 876 virtual Representation RequiredInputRepresentation(int index) = 0;
876 virtual void InferRepresentation(HInferRepresentationPhase* h_infer); 877 virtual void InferRepresentation(HInferRepresentationPhase* h_infer);
877 878
878 // This gives the instruction an opportunity to replace itself with an 879 // This gives the instruction an opportunity to replace itself with an
879 // instruction that does the same in some better way. To replace an 880 // instruction that does the same in some better way. To replace an
(...skipping 4869 matching lines...) Expand 10 before | Expand all | Expand 10 after
5749 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); 5750 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess);
5750 5751
5751 HValue* object() { return OperandAt(0); } 5752 HValue* object() { return OperandAt(0); }
5752 bool HasTypeCheck() { return object()->IsCheckMaps(); } 5753 bool HasTypeCheck() { return object()->IsCheckMaps(); }
5753 HObjectAccess access() const { return access_; } 5754 HObjectAccess access() const { return access_; }
5754 Representation field_representation() const { 5755 Representation field_representation() const {
5755 return access_.representation(); 5756 return access_.representation();
5756 } 5757 }
5757 5758
5758 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 5759 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
5760 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
5761 return !access().IsInobject() || access().offset() >= size;
5762 }
5759 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5763 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5760 if (index == 0 && access().IsExternalMemory()) { 5764 if (index == 0 && access().IsExternalMemory()) {
5761 // object must be external in case of external memory access 5765 // object must be external in case of external memory access
5762 return Representation::External(); 5766 return Representation::External();
5763 } 5767 }
5764 return Representation::Tagged(); 5768 return Representation::Tagged();
5765 } 5769 }
5766 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5770 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
5767 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5771 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5768 5772
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
6064 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> { 6068 class HStoreNamedField V8_FINAL : public HTemplateInstruction<3> {
6065 public: 6069 public:
6066 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, 6070 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*,
6067 HObjectAccess, HValue*); 6071 HObjectAccess, HValue*);
6068 6072
6069 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 6073 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
6070 6074
6071 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { 6075 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE {
6072 return index == 1; 6076 return index == 1;
6073 } 6077 }
6078 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6079 return !access().IsInobject() || access().offset() >= size;
6080 }
6074 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6081 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6075 if (index == 0 && access().IsExternalMemory()) { 6082 if (index == 0 && access().IsExternalMemory()) {
6076 // object must be external in case of external memory access 6083 // object must be external in case of external memory access
6077 return Representation::External(); 6084 return Representation::External();
6078 } else if (index == 1 && 6085 } else if (index == 1 &&
6079 (field_representation().IsDouble() || 6086 (field_representation().IsDouble() ||
6080 field_representation().IsSmi() || 6087 field_representation().IsSmi() ||
6081 field_representation().IsInteger32())) { 6088 field_representation().IsInteger32())) {
6082 return field_representation(); 6089 return field_representation();
6083 } 6090 }
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6954 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6948 }; 6955 };
6949 6956
6950 6957
6951 #undef DECLARE_INSTRUCTION 6958 #undef DECLARE_INSTRUCTION
6952 #undef DECLARE_CONCRETE_INSTRUCTION 6959 #undef DECLARE_CONCRETE_INSTRUCTION
6953 6960
6954 } } // namespace v8::internal 6961 } } // namespace v8::internal
6955 6962
6956 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6963 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | test/mjsunit/compiler/escape-analysis.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698