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

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

Issue 14455004: HConstant::InNewSpace() should be a constant function (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | no next file » | 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 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3244 Handle<Object> optional_handle = Handle<Object>::null()); 3244 Handle<Object> optional_handle = Handle<Object>::null());
3245 HConstant(Handle<Object> handle, 3245 HConstant(Handle<Object> handle,
3246 UniqueValueId unique_id, 3246 UniqueValueId unique_id,
3247 Representation r, 3247 Representation r,
3248 HType type, 3248 HType type,
3249 bool is_internalized_string, 3249 bool is_internalized_string,
3250 bool boolean_value); 3250 bool boolean_value);
3251 3251
3252 Handle<Object> handle() { 3252 Handle<Object> handle() {
3253 if (handle_.is_null()) { 3253 if (handle_.is_null()) {
3254 handle_ = FACTORY->NewNumber(double_value_, TENURED); 3254 handle_ = FACTORY->NewNumber(double_value_, pretenure());
3255 } 3255 }
3256 ALLOW_HANDLE_DEREF(Isolate::Current(), "smi check"); 3256 ALLOW_HANDLE_DEREF(Isolate::Current(), "smi check");
3257 ASSERT(has_int32_value_ || !handle_->IsSmi()); 3257 ASSERT(has_int32_value_ || !handle_->IsSmi());
3258 return handle_; 3258 return handle_;
3259 } 3259 }
3260 3260
3261 bool IsSpecialDouble() const { 3261 bool IsSpecialDouble() const {
3262 return has_double_value_ && 3262 return has_double_value_ &&
3263 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3263 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) ||
3264 FixedDoubleArray::is_the_hole_nan(double_value_) || 3264 FixedDoubleArray::is_the_hole_nan(double_value_) ||
3265 std::isnan(double_value_)); 3265 std::isnan(double_value_));
3266 } 3266 }
3267 3267
3268 bool InNewSpace() { 3268 bool InNewSpace() const {
3269 if (handle().is_null()) return false; 3269 if (!handle_.is_null()) {
3270 ALLOW_HANDLE_DEREF(isolate(), "using raw address"); 3270 ALLOW_HANDLE_DEREF(isolate(), "using raw address");
3271 return isolate()->heap()->InNewSpace(*handle()); 3271 return isolate()->heap()->InNewSpace(*handle_);
3272 }
3273 // If the handle wasn't created yet, then we have a number.
3274 // If the handle is created it'll be tenured in old space.
3275 ASSERT(pretenure() == TENURED);
3276 return false;
3272 } 3277 }
3273 3278
3274 bool ImmortalImmovable() const { 3279 bool ImmortalImmovable() const {
3275 if (has_int32_value_) { 3280 if (has_int32_value_) {
3276 return false; 3281 return false;
3277 } 3282 }
3278 if (has_double_value_) { 3283 if (has_double_value_) {
3279 if (IsSpecialDouble()) { 3284 if (IsSpecialDouble()) {
3280 return true; 3285 return true;
3281 } 3286 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3399 3404
3400 private: 3405 private:
3401 void Initialize(Representation r); 3406 void Initialize(Representation r);
3402 3407
3403 virtual bool IsDeletable() const { return true; } 3408 virtual bool IsDeletable() const { return true; }
3404 3409
3405 // If this is a numerical constant, handle_ either points to to the 3410 // If this is a numerical constant, handle_ either points to to the
3406 // HeapObject the constant originated from or is null. If the 3411 // HeapObject the constant originated from or is null. If the
3407 // constant is non-numeric, handle_ always points to a valid 3412 // constant is non-numeric, handle_ always points to a valid
3408 // constant HeapObject. 3413 // constant HeapObject.
3414 static PretenureFlag pretenure() { return TENURED; }
Michael Starzinger 2013/04/29 11:16:44 I don't understand this function, wouldn't a comme
3415
3409 Handle<Object> handle_; 3416 Handle<Object> handle_;
3410 UniqueValueId unique_id_; 3417 UniqueValueId unique_id_;
3411 3418
3412 // We store the HConstant in the most specific form safely possible. 3419 // We store the HConstant in the most specific form safely possible.
3413 // The two flags, has_int32_value_ and has_double_value_ tell us if 3420 // The two flags, has_int32_value_ and has_double_value_ tell us if
3414 // int32_value_ and double_value_ hold valid, safe representations 3421 // int32_value_ and double_value_ hold valid, safe representations
3415 // of the constant. has_int32_value_ implies has_double_value_ but 3422 // of the constant. has_int32_value_ implies has_double_value_ but
3416 // not the converse. 3423 // not the converse.
3417 bool has_int32_value_ : 1; 3424 bool has_int32_value_ : 1;
3418 bool has_double_value_ : 1; 3425 bool has_double_value_ : 1;
(...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after
6581 virtual bool IsDeletable() const { return true; } 6588 virtual bool IsDeletable() const { return true; }
6582 }; 6589 };
6583 6590
6584 6591
6585 #undef DECLARE_INSTRUCTION 6592 #undef DECLARE_INSTRUCTION
6586 #undef DECLARE_CONCRETE_INSTRUCTION 6593 #undef DECLARE_CONCRETE_INSTRUCTION
6587 6594
6588 } } // namespace v8::internal 6595 } } // namespace v8::internal
6589 6596
6590 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6597 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698