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 6849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6860 | 6860 |
6861 Result new_value = frame_->Pop(); | 6861 Result new_value = frame_->Pop(); |
6862 new_value.ToRegister(); | 6862 new_value.ToRegister(); |
6863 | 6863 |
6864 Result old_value; // Only allocated in the postfix case. | 6864 Result old_value; // Only allocated in the postfix case. |
6865 if (is_postfix) { | 6865 if (is_postfix) { |
6866 // Allocate a temporary to preserve the old value. | 6866 // Allocate a temporary to preserve the old value. |
6867 old_value = allocator_->Allocate(); | 6867 old_value = allocator_->Allocate(); |
6868 ASSERT(old_value.is_valid()); | 6868 ASSERT(old_value.is_valid()); |
6869 __ mov(old_value.reg(), new_value.reg()); | 6869 __ mov(old_value.reg(), new_value.reg()); |
| 6870 |
| 6871 // The old value that is return for postfix operations has the |
| 6872 // same type as the input value we got from the frame. |
| 6873 old_value.set_number_info(new_value.number_info()); |
6870 } | 6874 } |
| 6875 |
6871 // Ensure the new value is writable. | 6876 // Ensure the new value is writable. |
6872 frame_->Spill(new_value.reg()); | 6877 frame_->Spill(new_value.reg()); |
6873 | 6878 |
6874 Result tmp; | 6879 Result tmp; |
6875 if (new_value.is_smi()) { | 6880 if (new_value.is_smi()) { |
6876 if (FLAG_debug_code) { | 6881 if (FLAG_debug_code) { |
6877 __ AbortIfNotSmi(new_value.reg(), "Operand not a smi"); | 6882 __ AbortIfNotSmi(new_value.reg(), "Operand not a smi"); |
6878 } | 6883 } |
6879 } else { | 6884 } else { |
6880 // We don't know statically if the input is a smi. | 6885 // We don't know statically if the input is a smi. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6924 deferred->Branch(not_zero); | 6929 deferred->Branch(not_zero); |
6925 } else { | 6930 } else { |
6926 // Otherwise we test separately for overflow and smi tag. | 6931 // Otherwise we test separately for overflow and smi tag. |
6927 deferred->Branch(overflow); | 6932 deferred->Branch(overflow); |
6928 __ test(new_value.reg(), Immediate(kSmiTagMask)); | 6933 __ test(new_value.reg(), Immediate(kSmiTagMask)); |
6929 deferred->Branch(not_zero); | 6934 deferred->Branch(not_zero); |
6930 } | 6935 } |
6931 } | 6936 } |
6932 deferred->BindExit(); | 6937 deferred->BindExit(); |
6933 | 6938 |
| 6939 // The result of ++ or -- is always a number. |
| 6940 new_value.set_number_info(NumberInfo::Number()); |
6934 | 6941 |
6935 // Postfix: store the old value in the allocated slot under the | 6942 // Postfix: store the old value in the allocated slot under the |
6936 // reference. | 6943 // reference. |
6937 if (is_postfix) frame_->SetElementAt(target.size(), &old_value); | 6944 if (is_postfix) frame_->SetElementAt(target.size(), &old_value); |
6938 | 6945 |
6939 frame_->Push(&new_value); | 6946 frame_->Push(&new_value); |
6940 // Non-constant: update the reference. | 6947 // Non-constant: update the reference. |
6941 if (!is_const) target.SetValue(NOT_CONST_INIT); | 6948 if (!is_const) target.SetValue(NOT_CONST_INIT); |
6942 } | 6949 } |
6943 | 6950 |
(...skipping 5276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12220 | 12227 |
12221 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12228 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
12222 // tagged as a small integer. | 12229 // tagged as a small integer. |
12223 __ bind(&runtime); | 12230 __ bind(&runtime); |
12224 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12231 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
12225 } | 12232 } |
12226 | 12233 |
12227 #undef __ | 12234 #undef __ |
12228 | 12235 |
12229 } } // namespace v8::internal | 12236 } } // namespace v8::internal |
OLD | NEW |