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

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

Issue 2834028: X64: Make the ToBoolean inline code do even less if the value is known to be a smi. (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « src/regexp.js ('k') | 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 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 5324 matching lines...) Expand 10 before | Expand all | Expand 10 after
5335 Result value = frame_->Pop(); 5335 Result value = frame_->Pop();
5336 value.ToRegister(); 5336 value.ToRegister();
5337 5337
5338 if (value.is_number()) { 5338 if (value.is_number()) {
5339 // Fast case if TypeInfo indicates only numbers. 5339 // Fast case if TypeInfo indicates only numbers.
5340 if (FLAG_debug_code) { 5340 if (FLAG_debug_code) {
5341 __ AbortIfNotNumber(value.reg()); 5341 __ AbortIfNotNumber(value.reg());
5342 } 5342 }
5343 // Smi => false iff zero. 5343 // Smi => false iff zero.
5344 __ SmiCompare(value.reg(), Smi::FromInt(0)); 5344 __ SmiCompare(value.reg(), Smi::FromInt(0));
5345 dest->false_target()->Branch(equal); 5345 if (value.is_smi()) {
5346 Condition is_smi = masm_->CheckSmi(value.reg()); 5346 value.Unuse();
5347 dest->true_target()->Branch(is_smi); 5347 dest->Split(not_zero);
5348 __ xorpd(xmm0, xmm0); 5348 } else {
5349 __ ucomisd(xmm0, FieldOperand(value.reg(), HeapNumber::kValueOffset)); 5349 dest->false_target()->Branch(equal);
William Hesse 2010/06/29 10:50:10 Why not also have a case for if value.is_double()?
Lasse Reichstein 2010/06/29 14:13:30 I doubt it will happen in practice that we convert
5350 value.Unuse(); 5350 Condition is_smi = masm_->CheckSmi(value.reg());
5351 dest->Split(not_zero); 5351 dest->true_target()->Branch(is_smi);
5352 __ xorpd(xmm0, xmm0);
5353 __ ucomisd(xmm0, FieldOperand(value.reg(), HeapNumber::kValueOffset));
5354 value.Unuse();
5355 dest->Split(not_zero);
5356 }
5352 } else { 5357 } else {
5353 // Fast case checks. 5358 // Fast case checks.
5354 // 'false' => false. 5359 // 'false' => false.
5355 __ CompareRoot(value.reg(), Heap::kFalseValueRootIndex); 5360 __ CompareRoot(value.reg(), Heap::kFalseValueRootIndex);
5356 dest->false_target()->Branch(equal); 5361 dest->false_target()->Branch(equal);
5357 5362
5358 // 'true' => true. 5363 // 'true' => true.
5359 __ CompareRoot(value.reg(), Heap::kTrueValueRootIndex); 5364 __ CompareRoot(value.reg(), Heap::kTrueValueRootIndex);
5360 dest->true_target()->Branch(equal); 5365 dest->true_target()->Branch(equal);
5361 5366
(...skipping 6539 matching lines...) Expand 10 before | Expand all | Expand 10 after
11901 } 11906 }
11902 11907
11903 #endif 11908 #endif
11904 11909
11905 11910
11906 #undef __ 11911 #undef __
11907 11912
11908 } } // namespace v8::internal 11913 } } // namespace v8::internal
11909 11914
11910 #endif // V8_TARGET_ARCH_X64 11915 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698