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

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

Issue 21065006: Replace HCheckPrototypeMaps by explicit map checks of constant values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Prepare all HConstant js objects Created 7 years, 4 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.cc ('k') | src/hydrogen-instructions.cc » ('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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 V(CallNew) \ 86 V(CallNew) \
87 V(CallNewArray) \ 87 V(CallNewArray) \
88 V(CallRuntime) \ 88 V(CallRuntime) \
89 V(CallStub) \ 89 V(CallStub) \
90 V(Change) \ 90 V(Change) \
91 V(CheckFunction) \ 91 V(CheckFunction) \
92 V(CheckHeapObject) \ 92 V(CheckHeapObject) \
93 V(CheckInstanceType) \ 93 V(CheckInstanceType) \
94 V(CheckMaps) \ 94 V(CheckMaps) \
95 V(CheckMapValue) \ 95 V(CheckMapValue) \
96 V(CheckPrototypeMaps) \
97 V(CheckSmi) \ 96 V(CheckSmi) \
98 V(ClampToUint8) \ 97 V(ClampToUint8) \
99 V(ClassOfTestAndBranch) \ 98 V(ClassOfTestAndBranch) \
100 V(CompareNumericAndBranch) \ 99 V(CompareNumericAndBranch) \
101 V(CompareGeneric) \ 100 V(CompareGeneric) \
102 V(CompareObjectEqAndBranch) \ 101 V(CompareObjectEqAndBranch) \
103 V(CompareMap) \ 102 V(CompareMap) \
104 V(Constant) \ 103 V(Constant) \
105 V(Context) \ 104 V(Context) \
106 V(DateField) \ 105 V(DateField) \
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3119 3118
3120 private: 3119 private:
3121 explicit HCheckHeapObject(HValue* value) 3120 explicit HCheckHeapObject(HValue* value)
3122 : HUnaryOperation(value, HType::NonPrimitive()) { 3121 : HUnaryOperation(value, HType::NonPrimitive()) {
3123 set_representation(Representation::Tagged()); 3122 set_representation(Representation::Tagged());
3124 SetFlag(kUseGVN); 3123 SetFlag(kUseGVN);
3125 } 3124 }
3126 }; 3125 };
3127 3126
3128 3127
3129 class HCheckPrototypeMaps: public HTemplateInstruction<0> {
3130 public:
3131 static HCheckPrototypeMaps* New(Zone* zone,
3132 HValue* context,
3133 Handle<JSObject> prototype,
3134 Handle<JSObject> holder,
3135 CompilationInfo* info) {
3136 return new(zone) HCheckPrototypeMaps(prototype, holder, zone, info);
3137 }
3138
3139 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; }
3140
3141 ZoneList<Handle<Map> >* maps() { return &maps_; }
3142
3143 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps)
3144
3145 virtual Representation RequiredInputRepresentation(int index) {
3146 return Representation::None();
3147 }
3148
3149 virtual void PrintDataTo(StringStream* stream);
3150
3151 virtual intptr_t Hashcode() {
3152 return first_prototype_unique_id_.Hashcode() * 17 +
3153 last_prototype_unique_id_.Hashcode();
3154 }
3155
3156 virtual void FinalizeUniqueValueId() {
3157 first_prototype_unique_id_ = UniqueValueId(prototypes_.first());
3158 last_prototype_unique_id_ = UniqueValueId(prototypes_.last());
3159 }
3160
3161 bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; }
3162
3163 protected:
3164 virtual bool DataEquals(HValue* other) {
3165 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other);
3166 return first_prototype_unique_id_ == b->first_prototype_unique_id_ &&
3167 last_prototype_unique_id_ == b->last_prototype_unique_id_;
3168 }
3169
3170 private:
3171 HCheckPrototypeMaps(Handle<JSObject> prototype,
3172 Handle<JSObject> holder,
3173 Zone* zone,
3174 CompilationInfo* info)
3175 : prototypes_(2, zone),
3176 maps_(2, zone),
3177 first_prototype_unique_id_(),
3178 last_prototype_unique_id_(),
3179 can_omit_prototype_maps_(true) {
3180 SetFlag(kUseGVN);
3181 SetGVNFlag(kDependsOnMaps);
3182 // Keep a list of all objects on the prototype chain up to the holder
3183 // and the expected maps.
3184 while (true) {
3185 prototypes_.Add(prototype, zone);
3186 Handle<Map> map(prototype->map());
3187 maps_.Add(map, zone);
3188 can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks();
3189 if (prototype.is_identical_to(holder)) break;
3190 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype()));
3191 }
3192 if (can_omit_prototype_maps_) {
3193 // Mark in-flight compilation as dependent on those maps.
3194 for (int i = 0; i < maps()->length(); i++) {
3195 Handle<Map> map = maps()->at(i);
3196 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup,
3197 info);
3198 }
3199 }
3200 }
3201
3202 ZoneList<Handle<JSObject> > prototypes_;
3203 ZoneList<Handle<Map> > maps_;
3204 UniqueValueId first_prototype_unique_id_;
3205 UniqueValueId last_prototype_unique_id_;
3206 bool can_omit_prototype_maps_;
3207 };
3208
3209
3210 class InductionVariableData; 3128 class InductionVariableData;
3211 3129
3212 3130
3213 struct InductionVariableLimitUpdate { 3131 struct InductionVariableLimitUpdate {
3214 InductionVariableData* updated_variable; 3132 InductionVariableData* updated_variable;
3215 HValue* limit; 3133 HValue* limit;
3216 bool limit_is_upper; 3134 bool limit_is_upper;
3217 bool limit_is_included; 3135 bool limit_is_included;
3218 3136
3219 InductionVariableLimitUpdate() 3137 InductionVariableLimitUpdate()
(...skipping 4050 matching lines...) Expand 10 before | Expand all | Expand 10 after
7270 virtual bool IsDeletable() const { return true; } 7188 virtual bool IsDeletable() const { return true; }
7271 }; 7189 };
7272 7190
7273 7191
7274 #undef DECLARE_INSTRUCTION 7192 #undef DECLARE_INSTRUCTION
7275 #undef DECLARE_CONCRETE_INSTRUCTION 7193 #undef DECLARE_CONCRETE_INSTRUCTION
7276 7194
7277 } } // namespace v8::internal 7195 } } // namespace v8::internal
7278 7196
7279 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7197 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698