Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2242 | 2242 |
| 2243 | 2243 |
| 2244 class HConstant: public HTemplateInstruction<0> { | 2244 class HConstant: public HTemplateInstruction<0> { |
| 2245 public: | 2245 public: |
| 2246 HConstant(Handle<Object> handle, Representation r); | 2246 HConstant(Handle<Object> handle, Representation r); |
| 2247 | 2247 |
| 2248 Handle<Object> handle() const { return handle_; } | 2248 Handle<Object> handle() const { return handle_; } |
| 2249 | 2249 |
| 2250 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } | 2250 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } |
| 2251 | 2251 |
| 2252 bool ImmortalImmovable() const { | |
| 2253 Heap* heap = HEAP; | |
| 2254 if (*handle_ == heap->undefined_value()) return true; | |
| 2255 if (*handle_ == heap->null_value()) return true; | |
| 2256 if (*handle_ == heap->true_value()) return true; | |
| 2257 if (*handle_ == heap->false_value()) return true; | |
| 2258 if (*handle_ == heap->the_hole_value()) return true; | |
| 2259 return false; | |
| 2260 } | |
| 2261 | |
| 2252 virtual Representation RequiredInputRepresentation(int index) const { | 2262 virtual Representation RequiredInputRepresentation(int index) const { |
| 2253 return Representation::None(); | 2263 return Representation::None(); |
| 2254 } | 2264 } |
| 2255 | 2265 |
| 2256 virtual bool IsConvertibleToInteger() const { | 2266 virtual bool IsConvertibleToInteger() const { |
| 2257 if (handle_->IsSmi()) return true; | 2267 if (handle_->IsSmi()) return true; |
| 2258 if (handle_->IsHeapNumber() && | 2268 if (handle_->IsHeapNumber() && |
| 2259 (HeapNumber::cast(*handle_)->value() == | 2269 (HeapNumber::cast(*handle_)->value() == |
| 2260 static_cast<double>(NumberToInt32(*handle_)))) return true; | 2270 static_cast<double>(NumberToInt32(*handle_)))) return true; |
| 2261 return false; | 2271 return false; |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3323 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 3333 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
| 3324 return (slot_index() == b->slot_index()); | 3334 return (slot_index() == b->slot_index()); |
| 3325 } | 3335 } |
| 3326 | 3336 |
| 3327 private: | 3337 private: |
| 3328 int slot_index_; | 3338 int slot_index_; |
| 3329 }; | 3339 }; |
| 3330 | 3340 |
| 3331 | 3341 |
| 3332 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 3342 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
| 3333 // TODO(gc) On bleeding edge we omit write barrier when we are | 3343 // TODO(gc) On bleeding edge we omit write barrier when we are |
|
fschneider
2011/09/08 19:57:43
This TODO can be removed as well (or changed into
| |
| 3334 // storing old space constant. We can't allow such an optimization | 3344 // storing old space constant. We can't allow such an optimization |
| 3335 // on GC branch. | 3345 // on GC branch. |
| 3336 return !value->type().IsSmi(); | 3346 return !value->type().IsBoolean() |
| 3347 && !value->type().IsSmi() | |
| 3348 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); | |
| 3337 } | 3349 } |
| 3338 | 3350 |
| 3339 | 3351 |
| 3340 class HStoreContextSlot: public HTemplateInstruction<2> { | 3352 class HStoreContextSlot: public HTemplateInstruction<2> { |
| 3341 public: | 3353 public: |
| 3342 HStoreContextSlot(HValue* context, int slot_index, HValue* value) | 3354 HStoreContextSlot(HValue* context, int slot_index, HValue* value) |
| 3343 : slot_index_(slot_index) { | 3355 : slot_index_(slot_index) { |
| 3344 SetOperandAt(0, context); | 3356 SetOperandAt(0, context); |
| 3345 SetOperandAt(1, value); | 3357 SetOperandAt(1, value); |
| 3346 SetFlag(kChangesContextSlots); | 3358 SetFlag(kChangesContextSlots); |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4192 | 4204 |
| 4193 DECLARE_CONCRETE_INSTRUCTION(In) | 4205 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4194 }; | 4206 }; |
| 4195 | 4207 |
| 4196 #undef DECLARE_INSTRUCTION | 4208 #undef DECLARE_INSTRUCTION |
| 4197 #undef DECLARE_CONCRETE_INSTRUCTION | 4209 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4198 | 4210 |
| 4199 } } // namespace v8::internal | 4211 } } // namespace v8::internal |
| 4200 | 4212 |
| 4201 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4213 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |