OLD | NEW |
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
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(UNDETECTABLE)) stream->Add("Undetectable"); | |
346 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); | 345 if (Contains(SPEC_OBJECT)) stream->Add("SpecObject"); |
347 if (Contains(STRING)) stream->Add("String"); | 346 if (Contains(STRING)) stream->Add("String"); |
348 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); | 347 if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber"); |
349 if (Contains(INTERNAL_OBJECT)) stream->Add("InternalObject"); | 348 if (Contains(INTERNAL_OBJECT)) stream->Add("InternalObject"); |
350 } | 349 } |
351 | 350 |
352 | 351 |
353 void ToBooleanStub::Types::TraceTransition(Types to) { | 352 void ToBooleanStub::Types::TraceTransition(Types to) { |
354 if (!FLAG_trace_ic) return; | 353 if (!FLAG_trace_ic) return; |
355 char buffer[100]; | 354 char buffer[100]; |
(...skipping 15 matching lines...) Expand all Loading... |
371 return false; | 370 return false; |
372 } else if (object->IsBoolean()) { | 371 } else if (object->IsBoolean()) { |
373 Add(BOOLEAN); | 372 Add(BOOLEAN); |
374 return object->IsTrue(); | 373 return object->IsTrue(); |
375 } else if (object->IsNull()) { | 374 } else if (object->IsNull()) { |
376 Add(NULL_TYPE); | 375 Add(NULL_TYPE); |
377 return false; | 376 return false; |
378 } else if (object->IsSmi()) { | 377 } else if (object->IsSmi()) { |
379 Add(SMI); | 378 Add(SMI); |
380 return Smi::cast(*object)->value() != 0; | 379 return Smi::cast(*object)->value() != 0; |
381 } else if (object->IsUndetectableObject()) { | |
382 Add(UNDETECTABLE); | |
383 return false; | |
384 } else if (object->IsSpecObject()) { | 380 } else if (object->IsSpecObject()) { |
385 Add(SPEC_OBJECT); | 381 Add(SPEC_OBJECT); |
386 return true; | 382 return !object->IsUndetectableObject(); |
387 } else if (object->IsString()) { | 383 } else if (object->IsString()) { |
388 Add(STRING); | 384 Add(STRING); |
389 return String::cast(*object)->length() != 0; | 385 return !object->IsUndetectableObject() && |
| 386 String::cast(*object)->length() != 0; |
390 } else if (object->IsHeapNumber()) { | 387 } else if (object->IsHeapNumber()) { |
391 Add(HEAP_NUMBER); | 388 Add(HEAP_NUMBER); |
392 double value = HeapNumber::cast(*object)->value(); | 389 double value = HeapNumber::cast(*object)->value(); |
393 return value != 0 && !isnan(value); | 390 return !object->IsUndetectableObject() && value != 0 && !isnan(value); |
394 } else { | 391 } else { |
395 Add(INTERNAL_OBJECT); | 392 Add(INTERNAL_OBJECT); |
396 return true; | 393 return !object->IsUndetectableObject(); |
397 } | 394 } |
398 } | 395 } |
399 | 396 |
400 | 397 |
401 } } // namespace v8::internal | 398 } } // namespace v8::internal |
OLD | NEW |