| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } else if (!has_int_result() && op_ != Token::SHR && | 578 } else if (!has_int_result() && op_ != Token::SHR && |
| 579 max_input <= NUMBER && max_input > result_state_) { | 579 max_input <= NUMBER && max_input > result_state_) { |
| 580 result_state_ = max_input; | 580 result_state_ = max_input; |
| 581 } | 581 } |
| 582 | 582 |
| 583 ASSERT(result_state_ <= (has_int_result() ? INT32 : NUMBER) || | 583 ASSERT(result_state_ <= (has_int_result() ? INT32 : NUMBER) || |
| 584 op_ == Token::ADD); | 584 op_ == Token::ADD); |
| 585 | 585 |
| 586 if (old_state == GetExtraICState()) { | 586 if (old_state == GetExtraICState()) { |
| 587 // Tagged operations can lead to non-truncating HChanges | 587 // Tagged operations can lead to non-truncating HChanges |
| 588 if (left->IsUndefined()) { | 588 if (left->IsUndefined() || left->IsBoolean()) { |
| 589 left_state_ = GENERIC; | 589 left_state_ = GENERIC; |
| 590 } else if (right->IsUndefined()) { | 590 } else if (right->IsUndefined() || right->IsBoolean()) { |
| 591 right_state_ = GENERIC; | 591 right_state_ = GENERIC; |
| 592 } else { | 592 } else { |
| 593 // Since the fpu is to precise, we might bail out on numbers which | 593 // Since the fpu is to precise, we might bail out on numbers which |
| 594 // actually would truncate with 64 bit precision. | 594 // actually would truncate with 64 bit precision. |
| 595 ASSERT(!CpuFeatures::IsSupported(SSE2) && | 595 ASSERT(!CpuFeatures::IsSupported(SSE2) && |
| 596 result_state_ <= INT32); | 596 result_state_ <= INT32); |
| 597 result_state_ = NUMBER; | 597 result_state_ = NUMBER; |
| 598 } | 598 } |
| 599 } | 599 } |
| 600 } | 600 } |
| 601 | 601 |
| 602 | 602 |
| 603 void BinaryOpStub::UpdateStatus(Handle<Object> object, | 603 void BinaryOpStub::UpdateStatus(Handle<Object> object, |
| 604 State* state) { | 604 State* state) { |
| 605 bool is_truncating = (op_ == Token::BIT_AND || op_ == Token::BIT_OR || |
| 606 op_ == Token::BIT_XOR || op_ == Token::SAR || |
| 607 op_ == Token::SHL || op_ == Token::SHR); |
| 605 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(object); | 608 v8::internal::TypeInfo type = v8::internal::TypeInfo::FromValue(object); |
| 609 if (object->IsBoolean() && is_truncating) { |
| 610 // Booleans are converted by truncating by HChange. |
| 611 type = TypeInfo::Integer32(); |
| 612 } |
| 606 if (object->IsUndefined()) { | 613 if (object->IsUndefined()) { |
| 607 // Undefined will be automatically truncated for us by HChange. | 614 // Undefined will be automatically truncated for us by HChange. |
| 608 type = (op_ == Token::BIT_AND || op_ == Token::BIT_OR || | 615 type = is_truncating ? TypeInfo::Integer32() : TypeInfo::Double(); |
| 609 op_ == Token::BIT_XOR || op_ == Token::SAR || | |
| 610 op_ == Token::SHL || op_ == Token::SHR) | |
| 611 ? TypeInfo::Integer32() | |
| 612 : TypeInfo::Double(); | |
| 613 } | 616 } |
| 614 State int_state = SmiValuesAre32Bits() ? NUMBER : INT32; | 617 State int_state = SmiValuesAre32Bits() ? NUMBER : INT32; |
| 615 State new_state = NONE; | 618 State new_state = NONE; |
| 616 if (type.IsSmi()) { | 619 if (type.IsSmi()) { |
| 617 new_state = SMI; | 620 new_state = SMI; |
| 618 } else if (type.IsInteger32()) { | 621 } else if (type.IsInteger32()) { |
| 619 new_state = int_state; | 622 new_state = int_state; |
| 620 } else if (type.IsNumber()) { | 623 } else if (type.IsNumber()) { |
| 621 new_state = NUMBER; | 624 new_state = NUMBER; |
| 622 } else if (object->IsString() && operation() == Token::ADD) { | 625 } else if (object->IsString() && operation() == Token::ADD) { |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 InstallDescriptor(isolate, &stub3); | 1162 InstallDescriptor(isolate, &stub3); |
| 1160 } | 1163 } |
| 1161 | 1164 |
| 1162 InternalArrayConstructorStub::InternalArrayConstructorStub( | 1165 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 1163 Isolate* isolate) { | 1166 Isolate* isolate) { |
| 1164 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1167 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 1165 } | 1168 } |
| 1166 | 1169 |
| 1167 | 1170 |
| 1168 } } // namespace v8::internal | 1171 } } // namespace v8::internal |
| OLD | NEW |