| OLD | NEW |
| 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 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3263 HConstant(double value, | 3263 HConstant(double value, |
| 3264 Representation r = Representation::None(), | 3264 Representation r = Representation::None(), |
| 3265 bool is_not_in_new_space = true, | 3265 bool is_not_in_new_space = true, |
| 3266 Handle<Object> optional_handle = Handle<Object>::null()); | 3266 Handle<Object> optional_handle = Handle<Object>::null()); |
| 3267 HConstant(Handle<Object> handle, | 3267 HConstant(Handle<Object> handle, |
| 3268 UniqueValueId unique_id, | 3268 UniqueValueId unique_id, |
| 3269 Representation r, | 3269 Representation r, |
| 3270 HType type, | 3270 HType type, |
| 3271 bool is_internalized_string, | 3271 bool is_internalized_string, |
| 3272 bool is_not_in_new_space, | 3272 bool is_not_in_new_space, |
| 3273 bool is_cell, | |
| 3274 bool boolean_value); | 3273 bool boolean_value); |
| 3275 | 3274 |
| 3276 Handle<Object> handle() { | 3275 Handle<Object> handle() { |
| 3277 if (handle_.is_null()) { | 3276 if (handle_.is_null()) { |
| 3278 Factory* factory = Isolate::Current()->factory(); | 3277 Factory* factory = Isolate::Current()->factory(); |
| 3279 // Default arguments to is_not_in_new_space depend on this heap number | 3278 // Default arguments to is_not_in_new_space depend on this heap number |
| 3280 // to be tenured so that it's guaranteed not be be located in new space. | 3279 // to be tenured so that it's guaranteed not be be located in new space. |
| 3281 handle_ = factory->NewNumber(double_value_, TENURED); | 3280 handle_ = factory->NewNumber(double_value_, TENURED); |
| 3282 } | 3281 } |
| 3283 AllowDeferredHandleDereference smi_check; | 3282 AllowDeferredHandleDereference smi_check; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3312 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value())); | 3311 ASSERT(unique_id_ != UniqueValueId(heap->minus_zero_value())); |
| 3313 ASSERT(unique_id_ != UniqueValueId(heap->nan_value())); | 3312 ASSERT(unique_id_ != UniqueValueId(heap->nan_value())); |
| 3314 return unique_id_ == UniqueValueId(heap->undefined_value()) || | 3313 return unique_id_ == UniqueValueId(heap->undefined_value()) || |
| 3315 unique_id_ == UniqueValueId(heap->null_value()) || | 3314 unique_id_ == UniqueValueId(heap->null_value()) || |
| 3316 unique_id_ == UniqueValueId(heap->true_value()) || | 3315 unique_id_ == UniqueValueId(heap->true_value()) || |
| 3317 unique_id_ == UniqueValueId(heap->false_value()) || | 3316 unique_id_ == UniqueValueId(heap->false_value()) || |
| 3318 unique_id_ == UniqueValueId(heap->the_hole_value()) || | 3317 unique_id_ == UniqueValueId(heap->the_hole_value()) || |
| 3319 unique_id_ == UniqueValueId(heap->empty_string()); | 3318 unique_id_ == UniqueValueId(heap->empty_string()); |
| 3320 } | 3319 } |
| 3321 | 3320 |
| 3322 bool IsCell() const { | |
| 3323 return is_cell_; | |
| 3324 } | |
| 3325 | |
| 3326 virtual Representation RequiredInputRepresentation(int index) { | 3321 virtual Representation RequiredInputRepresentation(int index) { |
| 3327 return Representation::None(); | 3322 return Representation::None(); |
| 3328 } | 3323 } |
| 3329 | 3324 |
| 3330 virtual Representation KnownOptimalRepresentation() { | 3325 virtual Representation KnownOptimalRepresentation() { |
| 3331 if (HasSmiValue()) return Representation::Smi(); | 3326 if (HasSmiValue()) return Representation::Smi(); |
| 3332 if (HasInteger32Value()) return Representation::Integer32(); | 3327 if (HasInteger32Value()) return Representation::Integer32(); |
| 3333 if (HasNumberValue()) return Representation::Double(); | 3328 if (HasNumberValue()) return Representation::Double(); |
| 3334 return Representation::Tagged(); | 3329 return Representation::Tagged(); |
| 3335 } | 3330 } |
| 3336 | 3331 |
| 3337 virtual bool EmitAtUses(); | 3332 virtual bool EmitAtUses() { return !representation().IsDouble(); } |
| 3338 virtual void PrintDataTo(StringStream* stream); | 3333 virtual void PrintDataTo(StringStream* stream); |
| 3339 virtual HType CalculateInferredType(); | 3334 virtual HType CalculateInferredType(); |
| 3340 bool IsInteger() { return handle()->IsSmi(); } | 3335 bool IsInteger() { return handle()->IsSmi(); } |
| 3341 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3336 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
| 3342 HConstant* CopyToTruncatedInt32(Zone* zone) const; | 3337 HConstant* CopyToTruncatedInt32(Zone* zone) const; |
| 3343 bool HasInteger32Value() const { return has_int32_value_; } | 3338 bool HasInteger32Value() const { return has_int32_value_; } |
| 3344 int32_t Integer32Value() const { | 3339 int32_t Integer32Value() const { |
| 3345 ASSERT(HasInteger32Value()); | 3340 ASSERT(HasInteger32Value()); |
| 3346 return int32_value_; | 3341 return int32_value_; |
| 3347 } | 3342 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3442 // We store the HConstant in the most specific form safely possible. | 3437 // We store the HConstant in the most specific form safely possible. |
| 3443 // The two flags, has_int32_value_ and has_double_value_ tell us if | 3438 // The two flags, has_int32_value_ and has_double_value_ tell us if |
| 3444 // int32_value_ and double_value_ hold valid, safe representations | 3439 // int32_value_ and double_value_ hold valid, safe representations |
| 3445 // of the constant. has_int32_value_ implies has_double_value_ but | 3440 // of the constant. has_int32_value_ implies has_double_value_ but |
| 3446 // not the converse. | 3441 // not the converse. |
| 3447 bool has_smi_value_ : 1; | 3442 bool has_smi_value_ : 1; |
| 3448 bool has_int32_value_ : 1; | 3443 bool has_int32_value_ : 1; |
| 3449 bool has_double_value_ : 1; | 3444 bool has_double_value_ : 1; |
| 3450 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. | 3445 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
| 3451 bool is_not_in_new_space_ : 1; | 3446 bool is_not_in_new_space_ : 1; |
| 3452 bool is_cell_ : 1; | |
| 3453 bool boolean_value_ : 1; | 3447 bool boolean_value_ : 1; |
| 3454 int32_t int32_value_; | 3448 int32_t int32_value_; |
| 3455 double double_value_; | 3449 double double_value_; |
| 3456 HType type_from_value_; | 3450 HType type_from_value_; |
| 3457 }; | 3451 }; |
| 3458 | 3452 |
| 3459 | 3453 |
| 3460 class HBinaryOperation: public HTemplateInstruction<3> { | 3454 class HBinaryOperation: public HTemplateInstruction<3> { |
| 3461 public: | 3455 public: |
| 3462 HBinaryOperation(HValue* context, HValue* left, HValue* right) | 3456 HBinaryOperation(HValue* context, HValue* left, HValue* right) |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5095 } | 5089 } |
| 5096 | 5090 |
| 5097 | 5091 |
| 5098 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, | 5092 inline bool ReceiverObjectNeedsWriteBarrier(HValue* object, |
| 5099 HValue* new_space_dominator) { | 5093 HValue* new_space_dominator) { |
| 5100 if (object->IsInnerAllocatedObject()) { | 5094 if (object->IsInnerAllocatedObject()) { |
| 5101 return ReceiverObjectNeedsWriteBarrier( | 5095 return ReceiverObjectNeedsWriteBarrier( |
| 5102 HInnerAllocatedObject::cast(object)->base_object(), | 5096 HInnerAllocatedObject::cast(object)->base_object(), |
| 5103 new_space_dominator); | 5097 new_space_dominator); |
| 5104 } | 5098 } |
| 5105 if (object->IsConstant() && HConstant::cast(object)->IsCell()) { | |
| 5106 return false; | |
| 5107 } | |
| 5108 if (object != new_space_dominator) return true; | 5099 if (object != new_space_dominator) return true; |
| 5109 if (object->IsAllocateObject()) return false; | 5100 if (object->IsAllocateObject()) return false; |
| 5110 if (object->IsAllocate()) { | 5101 if (object->IsAllocate()) { |
| 5111 return !HAllocate::cast(object)->GuaranteedInNewSpace(); | 5102 return !HAllocate::cast(object)->GuaranteedInNewSpace(); |
| 5112 } | 5103 } |
| 5113 return true; | 5104 return true; |
| 5114 } | 5105 } |
| 5115 | 5106 |
| 5116 | 5107 |
| 5117 class HStoreGlobalCell: public HUnaryOperation { | 5108 class HStoreGlobalCell: public HUnaryOperation { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5359 // Create an access to an in-object property in a JSArray. | 5350 // Create an access to an in-object property in a JSArray. |
| 5360 static HObjectAccess ForJSArrayOffset(int offset); | 5351 static HObjectAccess ForJSArrayOffset(int offset); |
| 5361 | 5352 |
| 5362 // Create an access to the backing store of an object. | 5353 // Create an access to the backing store of an object. |
| 5363 static HObjectAccess ForBackingStoreOffset(int offset); | 5354 static HObjectAccess ForBackingStoreOffset(int offset); |
| 5364 | 5355 |
| 5365 // Create an access to a resolved field (in-object or backing store). | 5356 // Create an access to a resolved field (in-object or backing store). |
| 5366 static HObjectAccess ForField(Handle<Map> map, | 5357 static HObjectAccess ForField(Handle<Map> map, |
| 5367 LookupResult *lookup, Handle<String> name = Handle<String>::null()); | 5358 LookupResult *lookup, Handle<String> name = Handle<String>::null()); |
| 5368 | 5359 |
| 5369 // Create an access for the payload of a Cell or JSGlobalPropertyCell. | |
| 5370 static HObjectAccess ForCellPayload(Isolate* isolate); | |
| 5371 | |
| 5372 void PrintTo(StringStream* stream); | 5360 void PrintTo(StringStream* stream); |
| 5373 | 5361 |
| 5374 inline bool Equals(HObjectAccess that) const { | 5362 inline bool Equals(HObjectAccess that) const { |
| 5375 return value_ == that.value_; // portion and offset must match | 5363 return value_ == that.value_; // portion and offset must match |
| 5376 } | 5364 } |
| 5377 | 5365 |
| 5378 protected: | 5366 protected: |
| 5379 void SetGVNFlags(HValue *instr, bool is_store); | 5367 void SetGVNFlags(HValue *instr, bool is_store); |
| 5380 | 5368 |
| 5381 private: | 5369 private: |
| (...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6663 virtual bool IsDeletable() const { return true; } | 6651 virtual bool IsDeletable() const { return true; } |
| 6664 }; | 6652 }; |
| 6665 | 6653 |
| 6666 | 6654 |
| 6667 #undef DECLARE_INSTRUCTION | 6655 #undef DECLARE_INSTRUCTION |
| 6668 #undef DECLARE_CONCRETE_INSTRUCTION | 6656 #undef DECLARE_CONCRETE_INSTRUCTION |
| 6669 | 6657 |
| 6670 } } // namespace v8::internal | 6658 } } // namespace v8::internal |
| 6671 | 6659 |
| 6672 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6660 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |