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

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

Issue 165525: X64: Remove compound smi+overflow test using cmov. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 DeferredCode* deferred = NULL; 3077 DeferredCode* deferred = NULL;
3078 if (is_postfix) { 3078 if (is_postfix) {
3079 deferred = new DeferredPostfixCountOperation(new_value.reg(), 3079 deferred = new DeferredPostfixCountOperation(new_value.reg(),
3080 old_value.reg(), 3080 old_value.reg(),
3081 is_increment); 3081 is_increment);
3082 } else { 3082 } else {
3083 deferred = new DeferredPrefixCountOperation(new_value.reg(), 3083 deferred = new DeferredPrefixCountOperation(new_value.reg(),
3084 is_increment); 3084 is_increment);
3085 } 3085 }
3086 3086
3087 // If we have a free register, combine the smi and overflow checks.
3088 Result tmp = allocator_->AllocateWithoutSpilling();
3089 ASSERT(kSmiTagMask == 1 && kSmiTag == 0);
3090 if (tmp.is_valid()) {
3091 __ movl(tmp.reg(), Immediate(kSmiTagMask));
3092 }
3093
3094 // Try incrementing or decrementing the smi.
3095 __ movq(kScratchRegister, new_value.reg()); 3087 __ movq(kScratchRegister, new_value.reg());
3096 if (is_increment) { 3088 if (is_increment) {
3097 __ addl(kScratchRegister, Immediate(Smi::FromInt(1))); 3089 __ addl(kScratchRegister, Immediate(Smi::FromInt(1)));
3098 } else { 3090 } else {
3099 __ subl(kScratchRegister, Immediate(Smi::FromInt(1))); 3091 __ subl(kScratchRegister, Immediate(Smi::FromInt(1)));
3100 } 3092 }
3101 3093 // Smi test.
3102 // Go to the deferred case if the result overflows or is non-smi. 3094 deferred->Branch(overflow);
3103 if (tmp.is_valid()){ 3095 __ testl(kScratchRegister, Immediate(kSmiTagMask));
3104 __ cmovl(overflow, kScratchRegister, tmp.reg()); 3096 deferred->Branch(not_zero);
3105 __ testl(kScratchRegister, tmp.reg());
3106 tmp.Unuse();
3107 deferred->Branch(not_zero);
3108 } else {
3109 deferred->Branch(overflow);
3110 __ testl(kScratchRegister, Immediate(kSmiTagMask));
3111 deferred->Branch(not_zero);
3112 }
3113
3114 __ movq(new_value.reg(), kScratchRegister); 3097 __ movq(new_value.reg(), kScratchRegister);
3115 deferred->BindExit(); 3098 deferred->BindExit();
3116 3099
3117 // Postfix: store the old value in the allocated slot under the 3100 // Postfix: store the old value in the allocated slot under the
3118 // reference. 3101 // reference.
3119 if (is_postfix) frame_->SetElementAt(target.size(), &old_value); 3102 if (is_postfix) frame_->SetElementAt(target.size(), &old_value);
3120 3103
3121 frame_->Push(&new_value); 3104 frame_->Push(&new_value);
3122 // Non-constant: update the reference. 3105 // Non-constant: update the reference.
3123 if (!is_const) target.SetValue(NOT_CONST_INIT); 3106 if (!is_const) target.SetValue(NOT_CONST_INIT);
(...skipping 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after
7704 int CompareStub::MinorKey() { 7687 int CompareStub::MinorKey() {
7705 // Encode the two parameters in a unique 16 bit value. 7688 // Encode the two parameters in a unique 16 bit value.
7706 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7689 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7707 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7690 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7708 } 7691 }
7709 7692
7710 7693
7711 #undef __ 7694 #undef __
7712 7695
7713 } } // namespace v8::internal 7696 } } // 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