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

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

Issue 16542003: Enable map dependency to in-flight compilation info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: put transition maps and initial maps dependency into a separate CL Created 7 years, 6 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 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2959 2959
2960 protected: 2960 protected:
2961 virtual bool DataEquals(HValue* other) { return true; } 2961 virtual bool DataEquals(HValue* other) { return true; }
2962 }; 2962 };
2963 2963
2964 2964
2965 class HCheckPrototypeMaps: public HTemplateInstruction<0> { 2965 class HCheckPrototypeMaps: public HTemplateInstruction<0> {
2966 public: 2966 public:
2967 HCheckPrototypeMaps(Handle<JSObject> prototype, 2967 HCheckPrototypeMaps(Handle<JSObject> prototype,
2968 Handle<JSObject> holder, 2968 Handle<JSObject> holder,
2969 Zone* zone) 2969 Zone* zone,
2970 CompilationInfo* info)
2970 : prototypes_(2, zone), 2971 : prototypes_(2, zone),
2971 maps_(2, zone), 2972 maps_(2, zone),
2972 first_prototype_unique_id_(), 2973 first_prototype_unique_id_(),
2973 last_prototype_unique_id_() { 2974 last_prototype_unique_id_(),
2975 can_omit_prototype_maps_(true) {
2974 SetFlag(kUseGVN); 2976 SetFlag(kUseGVN);
2975 SetGVNFlag(kDependsOnMaps); 2977 SetGVNFlag(kDependsOnMaps);
2976 // Keep a list of all objects on the prototype chain up to the holder 2978 // Keep a list of all objects on the prototype chain up to the holder
2977 // and the expected maps. 2979 // and the expected maps.
2978 while (true) { 2980 while (true) {
2979 prototypes_.Add(prototype, zone); 2981 prototypes_.Add(prototype, zone);
2980 maps_.Add(Handle<Map>(prototype->map()), zone); 2982 Handle<Map> map(prototype->map());
2983 maps_.Add(map, zone);
2984 can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks();
2981 if (prototype.is_identical_to(holder)) break; 2985 if (prototype.is_identical_to(holder)) break;
2982 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); 2986 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype()));
2983 } 2987 }
2988 if (can_omit_prototype_maps_) {
2989 // Mark in-flight compilation as dependent on those maps.
2990 for (int i = 0; i < maps()->length(); i++) {
2991 Handle<Map> map = maps()->at(i);
2992 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup,
2993 info);
2994 }
2995 }
2984 } 2996 }
2985 2997
2986 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } 2998 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; }
2987 2999
2988 ZoneList<Handle<Map> >* maps() { return &maps_; } 3000 ZoneList<Handle<Map> >* maps() { return &maps_; }
2989 3001
2990 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) 3002 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps)
2991 3003
2992 virtual Representation RequiredInputRepresentation(int index) { 3004 virtual Representation RequiredInputRepresentation(int index) {
2993 return Representation::None(); 3005 return Representation::None();
2994 } 3006 }
2995 3007
2996 virtual void PrintDataTo(StringStream* stream); 3008 virtual void PrintDataTo(StringStream* stream);
2997 3009
2998 virtual intptr_t Hashcode() { 3010 virtual intptr_t Hashcode() {
2999 return first_prototype_unique_id_.Hashcode() * 17 + 3011 return first_prototype_unique_id_.Hashcode() * 17 +
3000 last_prototype_unique_id_.Hashcode(); 3012 last_prototype_unique_id_.Hashcode();
3001 } 3013 }
3002 3014
3003 virtual void FinalizeUniqueValueId() { 3015 virtual void FinalizeUniqueValueId() {
3004 first_prototype_unique_id_ = UniqueValueId(prototypes_.first()); 3016 first_prototype_unique_id_ = UniqueValueId(prototypes_.first());
3005 last_prototype_unique_id_ = UniqueValueId(prototypes_.last()); 3017 last_prototype_unique_id_ = UniqueValueId(prototypes_.last());
3006 } 3018 }
3007 3019
3008 bool CanOmitPrototypeChecks() { 3020 bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; }
3009 for (int i = 0; i < maps()->length(); i++) {
3010 if (!maps()->at(i)->CanOmitPrototypeChecks()) return false;
3011 }
3012 return true;
3013 }
3014 3021
3015 protected: 3022 protected:
3016 virtual bool DataEquals(HValue* other) { 3023 virtual bool DataEquals(HValue* other) {
3017 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); 3024 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other);
3018 return first_prototype_unique_id_ == b->first_prototype_unique_id_ && 3025 return first_prototype_unique_id_ == b->first_prototype_unique_id_ &&
3019 last_prototype_unique_id_ == b->last_prototype_unique_id_; 3026 last_prototype_unique_id_ == b->last_prototype_unique_id_;
3020 } 3027 }
3021 3028
3022 private: 3029 private:
3023 ZoneList<Handle<JSObject> > prototypes_; 3030 ZoneList<Handle<JSObject> > prototypes_;
3024 ZoneList<Handle<Map> > maps_; 3031 ZoneList<Handle<Map> > maps_;
3025 UniqueValueId first_prototype_unique_id_; 3032 UniqueValueId first_prototype_unique_id_;
3026 UniqueValueId last_prototype_unique_id_; 3033 UniqueValueId last_prototype_unique_id_;
3034 bool can_omit_prototype_maps_;
3027 }; 3035 };
3028 3036
3029 3037
3030 class HPhi: public HValue { 3038 class HPhi: public HValue {
3031 public: 3039 public:
3032 HPhi(int merged_index, Zone* zone) 3040 HPhi(int merged_index, Zone* zone)
3033 : inputs_(2, zone), 3041 : inputs_(2, zone),
3034 merged_index_(merged_index), 3042 merged_index_(merged_index),
3035 phi_id_(-1) { 3043 phi_id_(-1) {
3036 for (int i = 0; i < Representation::kNumRepresentations; i++) { 3044 for (int i = 0; i < Representation::kNumRepresentations; i++) {
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after
6565 virtual bool IsDeletable() const { return true; } 6573 virtual bool IsDeletable() const { return true; }
6566 }; 6574 };
6567 6575
6568 6576
6569 #undef DECLARE_INSTRUCTION 6577 #undef DECLARE_INSTRUCTION
6570 #undef DECLARE_CONCRETE_INSTRUCTION 6578 #undef DECLARE_CONCRETE_INSTRUCTION
6571 6579
6572 } } // namespace v8::internal 6580 } } // namespace v8::internal
6573 6581
6574 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6582 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698