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

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

Issue 7461107: Use type info for the ToBoolean translation in crankshaft. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | « src/code-stubs.cc ('k') | src/ia32/lithium-codegen-ia32.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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // undefined -> false 251 // undefined -> false
252 CheckOddball(masm, UNDEFINED, factory->undefined_value(), false, &patch); 252 CheckOddball(masm, UNDEFINED, factory->undefined_value(), false, &patch);
253 253
254 // Boolean -> its value 254 // Boolean -> its value
255 CheckOddball(masm, BOOLEAN, factory->false_value(), false, &patch); 255 CheckOddball(masm, BOOLEAN, factory->false_value(), false, &patch);
256 CheckOddball(masm, BOOLEAN, factory->true_value(), true, &patch); 256 CheckOddball(masm, BOOLEAN, factory->true_value(), true, &patch);
257 257
258 // 'null' -> false. 258 // 'null' -> false.
259 CheckOddball(masm, NULL_TYPE, factory->null_value(), false, &patch); 259 CheckOddball(masm, NULL_TYPE, factory->null_value(), false, &patch);
260 260
261 bool need_map =
262 types_.Contains(SPEC_OBJECT) |
263 types_.Contains(STRING) |
264 types_.Contains(HEAP_NUMBER) |
265 types_.Contains(INTERNAL_OBJECT);
266
267 if (types_.Contains(SMI)) { 261 if (types_.Contains(SMI)) {
268 // Smis: 0 -> false, all other -> true 262 // Smis: 0 -> false, all other -> true
269 Label not_smi; 263 Label not_smi;
270 __ JumpIfNotSmi(argument, &not_smi, Label::kNear); 264 __ JumpIfNotSmi(argument, &not_smi, Label::kNear);
271 // argument contains the correct return value already 265 // argument contains the correct return value already
272 if (!tos_.is(argument)) { 266 if (!tos_.is(argument)) {
273 __ mov(tos_, argument); 267 __ mov(tos_, argument);
274 } 268 }
275 __ ret(1 * kPointerSize); 269 __ ret(1 * kPointerSize);
276 __ bind(&not_smi); 270 __ bind(&not_smi);
277 } else if (need_map) { 271 } else if (types_.NeedsMap()) {
278 // If we need a map later and have a Smi -> patch. 272 // If we need a map later and have a Smi -> patch.
279 __ JumpIfSmi(argument, &patch, Label::kNear); 273 __ JumpIfSmi(argument, &patch, Label::kNear);
280 } 274 }
281 275
282 if (need_map) { 276 if (types_.NeedsMap()) {
283 __ mov(map, FieldOperand(argument, HeapObject::kMapOffset)); 277 __ mov(map, FieldOperand(argument, HeapObject::kMapOffset));
284 278
285 // Everything with a map could be undetectable, so check this now. 279 // Everything with a map could be undetectable, so check this now.
286 __ test_b(FieldOperand(map, Map::kBitFieldOffset), 280 __ test_b(FieldOperand(map, Map::kBitFieldOffset),
287 1 << Map::kIsUndetectable); 281 1 << Map::kIsUndetectable);
288 // Undetectable -> false. 282 // Undetectable -> false.
289 Label not_undetectable; 283 Label not_undetectable;
290 __ j(zero, &not_undetectable, Label::kNear); 284 __ j(zero, &not_undetectable, Label::kNear);
291 __ Set(tos_, Immediate(0)); 285 __ Set(tos_, Immediate(0));
292 __ ret(1 * kPointerSize); 286 __ ret(1 * kPointerSize);
(...skipping 6090 matching lines...) Expand 10 before | Expand all | Expand 10 after
6383 __ Drop(1); 6377 __ Drop(1);
6384 __ ret(2 * kPointerSize); 6378 __ ret(2 * kPointerSize);
6385 } 6379 }
6386 6380
6387 6381
6388 #undef __ 6382 #undef __
6389 6383
6390 } } // namespace v8::internal 6384 } } // namespace v8::internal
6391 6385
6392 #endif // V8_TARGET_ARCH_IA32 6386 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698