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

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

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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/heap/heap.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 3524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 object_ = Unique<Object>::CreateUninitialized( 3535 object_ = Unique<Object>::CreateUninitialized(
3536 isolate->factory()->NewNumber(double_value_, TENURED)); 3536 isolate->factory()->NewNumber(double_value_, TENURED));
3537 } 3537 }
3538 AllowDeferredHandleDereference smi_check; 3538 AllowDeferredHandleDereference smi_check;
3539 DCHECK(has_int32_value_ || !object_.handle()->IsSmi()); 3539 DCHECK(has_int32_value_ || !object_.handle()->IsSmi());
3540 return object_.handle(); 3540 return object_.handle();
3541 } 3541 }
3542 3542
3543 bool IsSpecialDouble() const { 3543 bool IsSpecialDouble() const {
3544 return has_double_value_ && 3544 return has_double_value_ &&
3545 (BitCast<int64_t>(double_value_) == BitCast<int64_t>(-0.0) || 3545 (bit_cast<int64_t>(double_value_) == bit_cast<int64_t>(-0.0) ||
3546 FixedDoubleArray::is_the_hole_nan(double_value_) || 3546 FixedDoubleArray::is_the_hole_nan(double_value_) ||
3547 std::isnan(double_value_)); 3547 std::isnan(double_value_));
3548 } 3548 }
3549 3549
3550 bool NotInNewSpace() const { 3550 bool NotInNewSpace() const {
3551 return is_not_in_new_space_; 3551 return is_not_in_new_space_;
3552 } 3552 }
3553 3553
3554 bool ImmortalImmovable() const; 3554 bool ImmortalImmovable() const;
3555 3555
3556 bool IsCell() const { 3556 bool IsCell() const {
3557 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE; 3557 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 bool HasObjectMap() const { return !object_map_.IsNull(); } 3641 bool HasObjectMap() const { return !object_map_.IsNull(); }
3642 Unique<Map> ObjectMap() const { 3642 Unique<Map> ObjectMap() const {
3643 DCHECK(HasObjectMap()); 3643 DCHECK(HasObjectMap());
3644 return object_map_; 3644 return object_map_;
3645 } 3645 }
3646 3646
3647 virtual intptr_t Hashcode() OVERRIDE { 3647 virtual intptr_t Hashcode() OVERRIDE {
3648 if (has_int32_value_) { 3648 if (has_int32_value_) {
3649 return static_cast<intptr_t>(int32_value_); 3649 return static_cast<intptr_t>(int32_value_);
3650 } else if (has_double_value_) { 3650 } else if (has_double_value_) {
3651 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); 3651 return static_cast<intptr_t>(bit_cast<int64_t>(double_value_));
3652 } else if (has_external_reference_value_) { 3652 } else if (has_external_reference_value_) {
3653 return reinterpret_cast<intptr_t>(external_reference_value_.address()); 3653 return reinterpret_cast<intptr_t>(external_reference_value_.address());
3654 } else { 3654 } else {
3655 DCHECK(!object_.handle().is_null()); 3655 DCHECK(!object_.handle().is_null());
3656 return object_.Hashcode(); 3656 return object_.Hashcode();
3657 } 3657 }
3658 } 3658 }
3659 3659
3660 virtual void FinalizeUniqueness() OVERRIDE { 3660 virtual void FinalizeUniqueness() OVERRIDE {
3661 if (!has_double_value_ && !has_external_reference_value_) { 3661 if (!has_double_value_ && !has_external_reference_value_) {
(...skipping 10 matching lines...) Expand all
3672 return object_.IsInitialized() && object_ == other; 3672 return object_.IsInitialized() && object_ == other;
3673 } 3673 }
3674 3674
3675 virtual bool DataEquals(HValue* other) OVERRIDE { 3675 virtual bool DataEquals(HValue* other) OVERRIDE {
3676 HConstant* other_constant = HConstant::cast(other); 3676 HConstant* other_constant = HConstant::cast(other);
3677 if (has_int32_value_) { 3677 if (has_int32_value_) {
3678 return other_constant->has_int32_value_ && 3678 return other_constant->has_int32_value_ &&
3679 int32_value_ == other_constant->int32_value_; 3679 int32_value_ == other_constant->int32_value_;
3680 } else if (has_double_value_) { 3680 } else if (has_double_value_) {
3681 return other_constant->has_double_value_ && 3681 return other_constant->has_double_value_ &&
3682 BitCast<int64_t>(double_value_) == 3682 bit_cast<int64_t>(double_value_) ==
3683 BitCast<int64_t>(other_constant->double_value_); 3683 bit_cast<int64_t>(other_constant->double_value_);
3684 } else if (has_external_reference_value_) { 3684 } else if (has_external_reference_value_) {
3685 return other_constant->has_external_reference_value_ && 3685 return other_constant->has_external_reference_value_ &&
3686 external_reference_value_ == 3686 external_reference_value_ ==
3687 other_constant->external_reference_value_; 3687 other_constant->external_reference_value_;
3688 } else { 3688 } else {
3689 if (other_constant->has_int32_value_ || 3689 if (other_constant->has_int32_value_ ||
3690 other_constant->has_double_value_ || 3690 other_constant->has_double_value_ ||
3691 other_constant->has_external_reference_value_) { 3691 other_constant->has_external_reference_value_) {
3692 return false; 3692 return false;
3693 } 3693 }
(...skipping 4167 matching lines...) Expand 10 before | Expand all | Expand 10 after
7861 }; 7861 };
7862 7862
7863 7863
7864 7864
7865 #undef DECLARE_INSTRUCTION 7865 #undef DECLARE_INSTRUCTION
7866 #undef DECLARE_CONCRETE_INSTRUCTION 7866 #undef DECLARE_CONCRETE_INSTRUCTION
7867 7867
7868 } } // namespace v8::internal 7868 } } // namespace v8::internal
7869 7869
7870 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7870 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698