OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6877 Result new_value = frame_->Pop(); | 6877 Result new_value = frame_->Pop(); |
6878 new_value.ToRegister(); | 6878 new_value.ToRegister(); |
6879 | 6879 |
6880 Result old_value; // Only allocated in the postfix case. | 6880 Result old_value; // Only allocated in the postfix case. |
6881 if (is_postfix) { | 6881 if (is_postfix) { |
6882 // Allocate a temporary to preserve the old value. | 6882 // Allocate a temporary to preserve the old value. |
6883 old_value = allocator_->Allocate(); | 6883 old_value = allocator_->Allocate(); |
6884 ASSERT(old_value.is_valid()); | 6884 ASSERT(old_value.is_valid()); |
6885 __ mov(old_value.reg(), new_value.reg()); | 6885 __ mov(old_value.reg(), new_value.reg()); |
6886 | 6886 |
6887 // The old value that is return for postfix operations has the | 6887 // The return value for postfix operations is the |
6888 // same type as the input value we got from the frame. | 6888 // same as the input, and has the same number info. |
6889 old_value.set_number_info(new_value.number_info()); | 6889 old_value.set_number_info(new_value.number_info()); |
6890 } | 6890 } |
6891 | 6891 |
6892 // Ensure the new value is writable. | 6892 // Ensure the new value is writable. |
6893 frame_->Spill(new_value.reg()); | 6893 frame_->Spill(new_value.reg()); |
6894 | 6894 |
6895 Result tmp; | 6895 Result tmp; |
6896 if (new_value.is_smi()) { | 6896 if (new_value.is_smi()) { |
6897 if (FLAG_debug_code) { | 6897 if (FLAG_debug_code) { |
6898 __ AbortIfNotSmi(new_value.reg(), "Operand not a smi"); | 6898 __ AbortIfNotSmi(new_value.reg(), "Operand not a smi"); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6945 deferred->Branch(not_zero); | 6945 deferred->Branch(not_zero); |
6946 } else { | 6946 } else { |
6947 // Otherwise we test separately for overflow and smi tag. | 6947 // Otherwise we test separately for overflow and smi tag. |
6948 deferred->Branch(overflow); | 6948 deferred->Branch(overflow); |
6949 __ test(new_value.reg(), Immediate(kSmiTagMask)); | 6949 __ test(new_value.reg(), Immediate(kSmiTagMask)); |
6950 deferred->Branch(not_zero); | 6950 deferred->Branch(not_zero); |
6951 } | 6951 } |
6952 } | 6952 } |
6953 deferred->BindExit(); | 6953 deferred->BindExit(); |
6954 | 6954 |
6955 // The result of ++ or -- is always a number. | 6955 // The result of ++ or -- is an Integer32 if the |
6956 new_value.set_number_info(NumberInfo::Number()); | 6956 // input is a smi. Otherwise it is a number. |
| 6957 if (new_value.is_smi()) { |
| 6958 new_value.set_number_info(NumberInfo::Integer32()); |
| 6959 } else { |
| 6960 new_value.set_number_info(NumberInfo::Number()); |
| 6961 } |
6957 | 6962 |
6958 // Postfix: store the old value in the allocated slot under the | 6963 // Postfix: store the old value in the allocated slot under the |
6959 // reference. | 6964 // reference. |
6960 if (is_postfix) frame_->SetElementAt(target.size(), &old_value); | 6965 if (is_postfix) frame_->SetElementAt(target.size(), &old_value); |
6961 | 6966 |
6962 frame_->Push(&new_value); | 6967 frame_->Push(&new_value); |
6963 // Non-constant: update the reference. | 6968 // Non-constant: update the reference. |
6964 if (!is_const) target.SetValue(NOT_CONST_INIT); | 6969 if (!is_const) target.SetValue(NOT_CONST_INIT); |
6965 } | 6970 } |
6966 | 6971 |
(...skipping 5276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12243 | 12248 |
12244 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12249 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12245 // tagged as a small integer. | 12250 // tagged as a small integer. |
12246 __ bind(&runtime); | 12251 __ bind(&runtime); |
12247 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12252 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12248 } | 12253 } |
12249 | 12254 |
12250 #undef __ | 12255 #undef __ |
12251 | 12256 |
12252 } } // namespace v8::internal | 12257 } } // namespace v8::internal |
OLD | NEW |