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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 11043020: Add fast 64-bit bitwise negation to the IA32 optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed bug in the optimizer that prevented optimization Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 2194
2195 if (value_cid == kMintCid) { 2195 if (value_cid == kMintCid) {
2196 __ movsd(result, FieldAddress(value, Mint::value_offset())); 2196 __ movsd(result, FieldAddress(value, Mint::value_offset()));
2197 } else if (value_cid == kSmiCid) { 2197 } else if (value_cid == kSmiCid) {
2198 __ SmiUntag(value); // Untag input before conversion. 2198 __ SmiUntag(value); // Untag input before conversion.
2199 __ movd(result, value); 2199 __ movd(result, value);
2200 __ pmovsxdq(result, result); 2200 __ pmovsxdq(result, result);
2201 __ SmiTag(value); // Restore input register. 2201 __ SmiTag(value); // Restore input register.
2202 } else { 2202 } else {
2203 Register temp = locs()->temp(0).reg(); 2203 Register temp = locs()->temp(0).reg();
2204 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptBinaryDoubleOp); 2204 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptUnboxInteger);
2205 Label is_smi, done; 2205 Label is_smi, done;
2206 __ testl(value, Immediate(kSmiTagMask)); 2206 __ testl(value, Immediate(kSmiTagMask));
2207 __ j(ZERO, &is_smi); 2207 __ j(ZERO, &is_smi);
2208 __ CompareClassId(value, kMintCid, temp); 2208 __ CompareClassId(value, kMintCid, temp);
2209 __ j(NOT_EQUAL, deopt); 2209 __ j(NOT_EQUAL, deopt);
2210 __ movsd(result, FieldAddress(value, Mint::value_offset())); 2210 __ movsd(result, FieldAddress(value, Mint::value_offset()));
2211 __ jmp(&done); 2211 __ jmp(&done);
2212 __ Bind(&is_smi); 2212 __ Bind(&is_smi);
2213 __ movl(temp, value); 2213 __ movl(temp, value);
2214 __ SmiUntag(temp); 2214 __ SmiUntag(temp);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 __ Bind(&overflow); 2373 __ Bind(&overflow);
2374 __ addl(ESP, Immediate(2 * kWordSize)); 2374 __ addl(ESP, Immediate(2 * kWordSize));
2375 __ jmp(deopt); 2375 __ jmp(deopt);
2376 __ Bind(&done); 2376 __ Bind(&done);
2377 break; 2377 break;
2378 } 2378 }
2379 default: UNREACHABLE(); 2379 default: UNREACHABLE();
2380 } 2380 }
2381 } 2381 }
2382 2382
2383
2384 LocationSummary* UnboxedMintUnaryOpInstr::MakeLocationSummary() const {
2385 const intptr_t kNumInputs = 1;
2386 const intptr_t kNumTemps = 0;
2387 LocationSummary* summary =
2388 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2389 summary->set_in(0, Location::RequiresXmmRegister());
2390 summary->set_out(Location::SameAsFirstInput());
2391 return summary;
2392 }
2393
2394
2395 void UnboxedMintUnaryOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2396 ASSERT(op_kind() == Token::kBIT_NOT);
2397 XmmRegister value = locs()->in(0).xmm_reg();
2398 ASSERT(value == locs()->out().xmm_reg());
2399 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2400 __ pxor(value, XMM0);
2401 }
2402
2403
2383 } // namespace dart 2404 } // namespace dart
2384 2405
2385 #undef __ 2406 #undef __
2386 2407
2387 #endif // defined TARGET_ARCH_X64 2408 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698