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

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

Issue 1000893003: Incorrect handling of HTransitionElementsKind in hydrogen check elimination phase fixed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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-check-elimination.cc ('k') | test/mjsunit/regress/regress-460917.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 // 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 7279 matching lines...) Expand 10 before | Expand all | Expand 10 after
7290 } 7290 }
7291 7291
7292 Representation RequiredInputRepresentation(int index) OVERRIDE { 7292 Representation RequiredInputRepresentation(int index) OVERRIDE {
7293 return Representation::Tagged(); 7293 return Representation::Tagged();
7294 } 7294 }
7295 7295
7296 HValue* object() const { return OperandAt(0); } 7296 HValue* object() const { return OperandAt(0); }
7297 HValue* context() const { return OperandAt(1); } 7297 HValue* context() const { return OperandAt(1); }
7298 Unique<Map> original_map() const { return original_map_; } 7298 Unique<Map> original_map() const { return original_map_; }
7299 Unique<Map> transitioned_map() const { return transitioned_map_; } 7299 Unique<Map> transitioned_map() const { return transitioned_map_; }
7300 ElementsKind from_kind() const { return from_kind_; } 7300 ElementsKind from_kind() const {
7301 ElementsKind to_kind() const { return to_kind_; } 7301 return FromElementsKindField::decode(bit_field_);
7302 }
7303 ElementsKind to_kind() const {
7304 return ToElementsKindField::decode(bit_field_);
7305 }
7306 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); }
7302 7307
7303 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT 7308 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT
7304 7309
7305 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) 7310 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
7306 7311
7307 protected: 7312 protected:
7308 bool DataEquals(HValue* other) OVERRIDE { 7313 bool DataEquals(HValue* other) OVERRIDE {
7309 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); 7314 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other);
7310 return original_map_ == instr->original_map_ && 7315 return original_map_ == instr->original_map_ &&
7311 transitioned_map_ == instr->transitioned_map_; 7316 transitioned_map_ == instr->transitioned_map_;
7312 } 7317 }
7313 7318
7314 int RedefinedOperandIndex() OVERRIDE { return 0; } 7319 int RedefinedOperandIndex() OVERRIDE { return 0; }
7315 7320
7316 private: 7321 private:
7317 HTransitionElementsKind(HValue* context, 7322 HTransitionElementsKind(HValue* context, HValue* object,
7318 HValue* object,
7319 Handle<Map> original_map, 7323 Handle<Map> original_map,
7320 Handle<Map> transitioned_map) 7324 Handle<Map> transitioned_map)
7321 : original_map_(Unique<Map>(original_map)), 7325 : original_map_(Unique<Map>(original_map)),
7322 transitioned_map_(Unique<Map>(transitioned_map)), 7326 transitioned_map_(Unique<Map>(transitioned_map)),
7323 from_kind_(original_map->elements_kind()), 7327 bit_field_(
7324 to_kind_(transitioned_map->elements_kind()) { 7328 FromElementsKindField::encode(original_map->elements_kind()) |
7329 ToElementsKindField::encode(transitioned_map->elements_kind()) |
7330 MapIsStableField::encode(transitioned_map->is_stable())) {
7325 SetOperandAt(0, object); 7331 SetOperandAt(0, object);
7326 SetOperandAt(1, context); 7332 SetOperandAt(1, context);
7327 SetFlag(kUseGVN); 7333 SetFlag(kUseGVN);
7328 SetChangesFlag(kElementsKind); 7334 SetChangesFlag(kElementsKind);
7329 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { 7335 if (!IsSimpleMapChangeTransition(from_kind(), to_kind())) {
7330 SetChangesFlag(kElementsPointer); 7336 SetChangesFlag(kElementsPointer);
7331 SetChangesFlag(kNewSpacePromotion); 7337 SetChangesFlag(kNewSpacePromotion);
7332 } 7338 }
7333 set_representation(Representation::Tagged()); 7339 set_representation(Representation::Tagged());
7334 } 7340 }
7335 7341
7342 class FromElementsKindField : public BitField<ElementsKind, 0, 5> {};
7343 class ToElementsKindField : public BitField<ElementsKind, 5, 5> {};
7344 class MapIsStableField : public BitField<bool, 10, 1> {};
7345
7336 Unique<Map> original_map_; 7346 Unique<Map> original_map_;
7337 Unique<Map> transitioned_map_; 7347 Unique<Map> transitioned_map_;
7338 ElementsKind from_kind_; 7348 uint32_t bit_field_;
7339 ElementsKind to_kind_;
7340 }; 7349 };
7341 7350
7342 7351
7343 class HStringAdd FINAL : public HBinaryOperation { 7352 class HStringAdd FINAL : public HBinaryOperation {
7344 public: 7353 public:
7345 static HInstruction* New( 7354 static HInstruction* New(
7346 Isolate* isolate, Zone* zone, HValue* context, HValue* left, 7355 Isolate* isolate, Zone* zone, HValue* context, HValue* left,
7347 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, 7356 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED,
7348 StringAddFlags flags = STRING_ADD_CHECK_BOTH, 7357 StringAddFlags flags = STRING_ADD_CHECK_BOTH,
7349 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); 7358 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null());
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
7964 }; 7973 };
7965 7974
7966 7975
7967 7976
7968 #undef DECLARE_INSTRUCTION 7977 #undef DECLARE_INSTRUCTION
7969 #undef DECLARE_CONCRETE_INSTRUCTION 7978 #undef DECLARE_CONCRETE_INSTRUCTION
7970 7979
7971 } } // namespace v8::internal 7980 } } // namespace v8::internal
7972 7981
7973 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7982 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | test/mjsunit/regress/regress-460917.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698