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

Side by Side Diff: src/codegen-ia32.cc

Issue 56106: Keep the result of postfix increment and decrement in a register. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4781 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 } 4792 }
4793 return; 4793 return;
4794 } 4794 }
4795 target.TakeValue(NOT_INSIDE_TYPEOF); 4795 target.TakeValue(NOT_INSIDE_TYPEOF);
4796 4796
4797 DeferredCountOperation* deferred = 4797 DeferredCountOperation* deferred =
4798 new DeferredCountOperation(this, is_postfix, is_increment, 4798 new DeferredCountOperation(this, is_postfix, is_increment,
4799 target.size() * kPointerSize); 4799 target.size() * kPointerSize);
4800 4800
4801 Result value = frame_->Pop(); 4801 Result value = frame_->Pop();
4802 value.ToRegister();
4803 ASSERT(value.is_valid());
4804 4802
4805 // Postfix: Store the old value as the result. 4803 // Postfix: Store the old value as the result.
4806 if (is_postfix) { 4804 if (is_postfix) {
4807 Result old_value = value; 4805 if (value.is_register()) {
4808 frame_->SetElementAt(target.size(), &old_value); 4806 Result old_value = allocator_->Allocate();
4807 ASSERT(old_value.is_valid());
4808 __ mov(old_value.reg(), value.reg());
4809 frame_->SetElementAt(target.size(), &old_value);
4810 } else {
4811 ASSERT(value.is_constant());
4812 Result old_value = value;
4813 frame_->SetElementAt(target.size(), &old_value);
4814 }
4809 } 4815 }
4810 4816
4811 // Perform optimistic increment/decrement. Ensure the value is 4817 // Perform optimistic increment/decrement. Ensure the value is
4812 // writable. 4818 // writable.
4819 value.ToRegister();
4820 ASSERT(value.is_valid());
4813 frame_->Spill(value.reg()); 4821 frame_->Spill(value.reg());
4814 ASSERT(allocator_->count(value.reg()) == 1); 4822 ASSERT(allocator_->count(value.reg()) == 1);
4815 4823
4816 // In order to combine the overflow and the smi check, we need to 4824 // In order to combine the overflow and the smi check, we need to
4817 // be able to allocate a byte register. We attempt to do so 4825 // be able to allocate a byte register. We attempt to do so
4818 // without spilling. If we fail, we will generate separate 4826 // without spilling. If we fail, we will generate separate
4819 // overflow and smi checks. 4827 // overflow and smi checks.
4820 // 4828 //
4821 // We need to allocate and clear the temporary byte register 4829 // We need to allocate and clear the temporary byte register
4822 // before performing the count operation since clearing the 4830 // before performing the count operation since clearing the
(...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after
7073 7081
7074 // Slow-case: Go through the JavaScript implementation. 7082 // Slow-case: Go through the JavaScript implementation.
7075 __ bind(&slow); 7083 __ bind(&slow);
7076 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 7084 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
7077 } 7085 }
7078 7086
7079 7087
7080 #undef __ 7088 #undef __
7081 7089
7082 } } // namespace v8::internal 7090 } } // namespace v8::internal
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