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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 7042004: Handle all kind of arguments in the ToBooleanStub. While this is not very (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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 | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 __ bind(&slow_case); 229 __ bind(&slow_case);
230 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 230 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
231 } 231 }
232 232
233 233
234 void ToBooleanStub::Generate(MacroAssembler* masm) { 234 void ToBooleanStub::Generate(MacroAssembler* masm) {
235 Label false_result, true_result, not_string; 235 Label false_result, true_result, not_string;
236 __ movq(rax, Operand(rsp, 1 * kPointerSize)); 236 __ movq(rax, Operand(rsp, 1 * kPointerSize));
237 237
238 // undefined -> false
239 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex);
240 __ j(equal, &false_result);
241
242 // Boolean -> its value
243 __ CompareRoot(rax, Heap::kFalseValueRootIndex);
244 __ j(equal, &false_result);
245 __ CompareRoot(rax, Heap::kTrueValueRootIndex);
246 __ j(equal, &true_result);
247
248 // Smis: 0 -> false, all other -> true
249 __ Cmp(rax, Smi::FromInt(0));
250 __ j(equal, &false_result);
251 Condition is_smi = __ CheckSmi(rax);
252 __ j(is_smi, &true_result);
253
238 // 'null' => false. 254 // 'null' => false.
239 __ CompareRoot(rax, Heap::kNullValueRootIndex); 255 __ CompareRoot(rax, Heap::kNullValueRootIndex);
240 __ j(equal, &false_result, Label::kNear); 256 __ j(equal, &false_result, Label::kNear);
241 257
242 // Get the map and type of the heap object. 258 // Get the map and type of the heap object.
243 // We don't use CmpObjectType because we manipulate the type field. 259 // We don't use CmpObjectType because we manipulate the type field.
244 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); 260 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset));
245 __ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset)); 261 __ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset));
246 262
247 // Undetectable => false. 263 // Undetectable => false.
(...skipping 4858 matching lines...) Expand 10 before | Expand all | Expand 10 after
5106 __ Drop(1); 5122 __ Drop(1);
5107 __ ret(2 * kPointerSize); 5123 __ ret(2 * kPointerSize);
5108 } 5124 }
5109 5125
5110 5126
5111 #undef __ 5127 #undef __
5112 5128
5113 } } // namespace v8::internal 5129 } } // namespace v8::internal
5114 5130
5115 #endif // V8_TARGET_ARCH_X64 5131 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698