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

Side by Side Diff: src/code-stubs.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.h ('k') | src/ia32/code-stubs-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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 stream->Add("CallFunctionStub_Args%d%s%s", argc_, in_loop_name, flags_name); 329 stream->Add("CallFunctionStub_Args%d%s%s", argc_, in_loop_name, flags_name);
330 } 330 }
331 331
332 332
333 void ToBooleanStub::PrintName(StringStream* stream) { 333 void ToBooleanStub::PrintName(StringStream* stream) {
334 stream->Add("ToBooleanStub_"); 334 stream->Add("ToBooleanStub_");
335 types_.Print(stream); 335 types_.Print(stream);
336 } 336 }
337 337
338 338
339 void ToBooleanStub::Types::Print(StringStream* stream) { 339 void ToBooleanStub::Types::Print(StringStream* stream) const {
340 if (IsEmpty()) stream->Add("None"); 340 if (IsEmpty()) stream->Add("None");
341 if (Contains(UNDEFINED)) stream->Add("Undefined"); 341 if (Contains(UNDEFINED)) stream->Add("Undefined");
342 if (Contains(BOOLEAN)) stream->Add("Bool"); 342 if (Contains(BOOLEAN)) stream->Add("Bool");
343 if (Contains(SMI)) stream->Add("Smi"); 343 if (Contains(SMI)) stream->Add("Smi");
344 if (Contains(NULL_TYPE)) stream->Add("Null"); 344 if (Contains(NULL_TYPE)) stream->Add("Null");
345 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); 345 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject");
346 if (Contains(STRING)) stream->Add("String"); 346 if (Contains(STRING)) stream->Add("String");
347 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); 347 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber");
348 if (Contains(INTERNAL_OBJECT)) stream->Add("InternalObject"); 348 if (Contains(INTERNAL_OBJECT)) stream->Add("InternalObject");
349 } 349 }
350 350
351 351
352 void ToBooleanStub::Types::TraceTransition(Types to) { 352 void ToBooleanStub::Types::TraceTransition(Types to) const {
353 if (!FLAG_trace_ic) return; 353 if (!FLAG_trace_ic) return;
354 char buffer[100]; 354 char buffer[100];
355 NoAllocationStringAllocator allocator(buffer, 355 NoAllocationStringAllocator allocator(buffer,
356 static_cast<unsigned>(sizeof(buffer))); 356 static_cast<unsigned>(sizeof(buffer)));
357 StringStream stream(&allocator); 357 StringStream stream(&allocator);
358 stream.Add("[ToBooleanIC ("); 358 stream.Add("[ToBooleanIC (");
359 Print(&stream); 359 Print(&stream);
360 stream.Add("->"); 360 stream.Add("->");
361 to.Print(&stream); 361 to.Print(&stream);
362 stream.Add(")]\n"); 362 stream.Add(")]\n");
(...skipping 25 matching lines...) Expand all
388 Add(HEAP_NUMBER); 388 Add(HEAP_NUMBER);
389 double value = HeapNumber::cast(*object)->value(); 389 double value = HeapNumber::cast(*object)->value();
390 return !object->IsUndetectableObject() && value != 0 && !isnan(value); 390 return !object->IsUndetectableObject() && value != 0 && !isnan(value);
391 } else { 391 } else {
392 Add(INTERNAL_OBJECT); 392 Add(INTERNAL_OBJECT);
393 return !object->IsUndetectableObject(); 393 return !object->IsUndetectableObject();
394 } 394 }
395 } 395 }
396 396
397 397
398 bool ToBooleanStub::Types::NeedsMap() const {
399 return Contains(ToBooleanStub::SPEC_OBJECT)
400 || Contains(ToBooleanStub::STRING)
401 || Contains(ToBooleanStub::HEAP_NUMBER)
402 || Contains(ToBooleanStub::INTERNAL_OBJECT);
403 }
404
405
398 } } // namespace v8::internal 406 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698