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

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

Issue 13426006: Improvements for x87 stack handling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review updates Created 7 years, 8 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 | « no previous file | src/ia32/lithium-codegen-ia32.h » ('j') | src/ia32/lithium-ia32.cc » ('J')
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 3172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 Handle<Object> handle() { 3183 Handle<Object> handle() {
3184 if (handle_.is_null()) { 3184 if (handle_.is_null()) {
3185 handle_ = FACTORY->NewNumber(double_value_, TENURED); 3185 handle_ = FACTORY->NewNumber(double_value_, TENURED);
3186 } 3186 }
3187 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3187 ASSERT(has_int32_value_ || !handle_->IsSmi());
3188 return handle_; 3188 return handle_;
3189 } 3189 }
3190 3190
3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); } 3191 bool InOldSpace() const { return !HEAP->InNewSpace(*handle_); }
3192 3192
3193 bool IsSpecialDouble() const {
3194 ASSERT(has_double_value_);
danno 2013/04/08 20:51:21 Any reason this has to be an assert? Why not just
mvstanton 2013/04/09 07:13:08 Good idea, done.
3195 return BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) ||
3196 isnan(double_value_) ||
3197 IsDoubleCanonicalHole();
3198 }
3199
3193 bool ImmortalImmovable() const { 3200 bool ImmortalImmovable() const {
3194 if (has_int32_value_) { 3201 if (has_int32_value_) {
3195 return false; 3202 return false;
3196 } 3203 }
3197 if (has_double_value_) { 3204 if (has_double_value_) {
3198 if (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3205 if (IsSpecialDouble()) {
3199 isnan(double_value_)) {
3200 return true; 3206 return true;
3201 } 3207 }
3202 return false; 3208 return false;
3203 } 3209 }
3204 3210
3205 ASSERT(!handle_.is_null()); 3211 ASSERT(!handle_.is_null());
3206 Heap* heap = isolate()->heap(); 3212 Heap* heap = isolate()->heap();
3207 // We should have handled minus_zero_value and nan_value in the 3213 // We should have handled minus_zero_value and nan_value in the
3208 // has_double_value_ clause above. 3214 // has_double_value_ clause above.
3209 // Dereferencing is safe to compare against immovable singletons. 3215 // Dereferencing is safe to compare against immovable singletons.
(...skipping 10 matching lines...) Expand all
3220 } 3226 }
3221 3227
3222 virtual Representation RequiredInputRepresentation(int index) { 3228 virtual Representation RequiredInputRepresentation(int index) {
3223 return Representation::None(); 3229 return Representation::None();
3224 } 3230 }
3225 3231
3226 virtual bool IsConvertibleToInteger() const { 3232 virtual bool IsConvertibleToInteger() const {
3227 return has_int32_value_; 3233 return has_int32_value_;
3228 } 3234 }
3229 3235
3230 virtual bool EmitAtUses() { return !representation().IsDouble(); } 3236 virtual bool EmitAtUses() {
3237 return !representation().IsDouble() || ImmortalImmovable();
danno 2013/04/08 20:51:21 || IsSpecialDouble instead of || ImmortanImmovable
mvstanton 2013/04/09 07:13:08 Now I see, thanks.
3238 }
3231 virtual void PrintDataTo(StringStream* stream); 3239 virtual void PrintDataTo(StringStream* stream);
3232 virtual HType CalculateInferredType(); 3240 virtual HType CalculateInferredType();
3233 bool IsInteger() { return handle()->IsSmi(); } 3241 bool IsInteger() { return handle()->IsSmi(); }
3234 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; 3242 HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
3235 HConstant* CopyToTruncatedInt32(Zone* zone) const; 3243 HConstant* CopyToTruncatedInt32(Zone* zone) const;
3236 bool HasInteger32Value() const { return has_int32_value_; } 3244 bool HasInteger32Value() const { return has_int32_value_; }
3237 int32_t Integer32Value() const { 3245 int32_t Integer32Value() const {
3238 ASSERT(HasInteger32Value()); 3246 ASSERT(HasInteger32Value());
3239 return int32_value_; 3247 return int32_value_;
3240 } 3248 }
3241 bool HasSmiValue() const { 3249 bool HasSmiValue() const {
3242 return HasInteger32Value() && Smi::IsValid(Integer32Value()); 3250 return HasInteger32Value() && Smi::IsValid(Integer32Value());
3243 } 3251 }
3244 bool HasDoubleValue() const { return has_double_value_; } 3252 bool HasDoubleValue() const { return has_double_value_; }
3245 double DoubleValue() const { 3253 double DoubleValue() const {
3246 ASSERT(HasDoubleValue()); 3254 ASSERT(HasDoubleValue());
3247 return double_value_; 3255 return double_value_;
3248 } 3256 }
3257 bool IsTheHole() const {
3258 if (HasDoubleValue() && IsDoubleCanonicalHole()) return true;
3259 Heap* heap = isolate()->heap();
3260 if (!handle_.is_null() && *handle_ == heap->the_hole_value()) return true;
3261 return false;
3262 }
3249 bool HasNumberValue() const { return has_double_value_; } 3263 bool HasNumberValue() const { return has_double_value_; }
3250 int32_t NumberValueAsInteger32() const { 3264 int32_t NumberValueAsInteger32() const {
3251 ASSERT(HasNumberValue()); 3265 ASSERT(HasNumberValue());
3252 // Irrespective of whether a numeric HConstant can be safely 3266 // Irrespective of whether a numeric HConstant can be safely
3253 // represented as an int32, we store the (in some cases lossy) 3267 // represented as an int32, we store the (in some cases lossy)
3254 // representation of the number in int32_value_. 3268 // representation of the number in int32_value_.
3255 return int32_value_; 3269 return int32_value_;
3256 } 3270 }
3257 bool HasStringValue() const { 3271 bool HasStringValue() const {
3258 if (has_double_value_ || has_int32_value_) return false; 3272 if (has_double_value_ || has_int32_value_) return false;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 return !other_constant->handle_.is_null() && 3331 return !other_constant->handle_.is_null() &&
3318 handle_.is_identical_to(other_constant->handle_); 3332 handle_.is_identical_to(other_constant->handle_);
3319 } 3333 }
3320 } 3334 }
3321 3335
3322 private: 3336 private:
3323 void Initialize(Representation r); 3337 void Initialize(Representation r);
3324 3338
3325 virtual bool IsDeletable() const { return true; } 3339 virtual bool IsDeletable() const { return true; }
3326 3340
3341 bool IsDoubleCanonicalHole() const {
3342 ASSERT(HasDoubleValue());
3343 return FixedDoubleArray::is_the_hole_nan(double_value_);
danno 2013/04/08 20:51:21 Since this is only used once, it's probably fine j
mvstanton 2013/04/09 07:13:08 Also in IsSpecialDouble(), but that is okay, this
3344 }
3345
3327 // If this is a numerical constant, handle_ either points to to the 3346 // If this is a numerical constant, handle_ either points to to the
3328 // HeapObject the constant originated from or is null. If the 3347 // HeapObject the constant originated from or is null. If the
3329 // constant is non-numeric, handle_ always points to a valid 3348 // constant is non-numeric, handle_ always points to a valid
3330 // constant HeapObject. 3349 // constant HeapObject.
3331 Handle<Object> handle_; 3350 Handle<Object> handle_;
3332 3351
3333 // We store the HConstant in the most specific form safely possible. 3352 // We store the HConstant in the most specific form safely possible.
3334 // The two flags, has_int32_value_ and has_double_value_ tell us if 3353 // The two flags, has_int32_value_ and has_double_value_ tell us if
3335 // int32_value_ and double_value_ hold valid, safe representations 3354 // int32_value_ and double_value_ hold valid, safe representations
3336 // of the constant. has_int32_value_ implies has_double_value_ but 3355 // of the constant. has_int32_value_ implies has_double_value_ but
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after
5670 return IsFastSmiElementsKind(elements_kind_); 5689 return IsFastSmiElementsKind(elements_kind_);
5671 } 5690 }
5672 ElementsKind elements_kind() const { return elements_kind_; } 5691 ElementsKind elements_kind() const { return elements_kind_; }
5673 uint32_t index_offset() { return index_offset_; } 5692 uint32_t index_offset() { return index_offset_; }
5674 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; } 5693 void SetIndexOffset(uint32_t index_offset) { index_offset_ = index_offset; }
5675 HValue* GetKey() { return key(); } 5694 HValue* GetKey() { return key(); }
5676 void SetKey(HValue* key) { SetOperandAt(1, key); } 5695 void SetKey(HValue* key) { SetOperandAt(1, key); }
5677 bool IsDehoisted() { return is_dehoisted_; } 5696 bool IsDehoisted() { return is_dehoisted_; }
5678 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } 5697 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; }
5679 5698
5699 bool IsConstantHoleStore() {
5700 return value()->IsConstant() && HConstant::cast(value())->IsTheHole();
5701 }
5702
5680 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) { 5703 virtual void SetSideEffectDominator(GVNFlag side_effect, HValue* dominator) {
5681 ASSERT(side_effect == kChangesNewSpacePromotion); 5704 ASSERT(side_effect == kChangesNewSpacePromotion);
5682 new_space_dominator_ = dominator; 5705 new_space_dominator_ = dominator;
5683 } 5706 }
5684 5707
5685 HValue* new_space_dominator() const { return new_space_dominator_; } 5708 HValue* new_space_dominator() const { return new_space_dominator_; }
5686 5709
5687 bool NeedsWriteBarrier() { 5710 bool NeedsWriteBarrier() {
5688 if (value_is_smi()) { 5711 if (value_is_smi()) {
5689 return false; 5712 return false;
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
6449 virtual bool IsDeletable() const { return true; } 6472 virtual bool IsDeletable() const { return true; }
6450 }; 6473 };
6451 6474
6452 6475
6453 #undef DECLARE_INSTRUCTION 6476 #undef DECLARE_INSTRUCTION
6454 #undef DECLARE_CONCRETE_INSTRUCTION 6477 #undef DECLARE_CONCRETE_INSTRUCTION
6455 6478
6456 } } // namespace v8::internal 6479 } } // namespace v8::internal
6457 6480
6458 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6481 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.h » ('j') | src/ia32/lithium-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698