| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 5350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5361 CONVERT_DOUBLE_CHECKED(number, args[0]); | 5361 CONVERT_DOUBLE_CHECKED(number, args[0]); |
| 5362 | 5362 |
| 5363 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 5363 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
| 5364 if (number > 0 && number <= Smi::kMaxValue) { | 5364 if (number > 0 && number <= Smi::kMaxValue) { |
| 5365 return Smi::FromInt(static_cast<int>(number)); | 5365 return Smi::FromInt(static_cast<int>(number)); |
| 5366 } | 5366 } |
| 5367 return Heap::NumberFromDouble(DoubleToInteger(number)); | 5367 return Heap::NumberFromDouble(DoubleToInteger(number)); |
| 5368 } | 5368 } |
| 5369 | 5369 |
| 5370 | 5370 |
| 5371 | |
| 5372 | |
| 5373 | |
| 5374 static Object* Runtime_NumberToIntegerMapMinusZero(Arguments args) { | 5371 static Object* Runtime_NumberToIntegerMapMinusZero(Arguments args) { |
| 5375 NoHandleAllocation ha; | 5372 NoHandleAllocation ha; |
| 5376 ASSERT(args.length() == 1); | 5373 ASSERT(args.length() == 1); |
| 5377 | 5374 |
| 5378 CONVERT_DOUBLE_CHECKED(number, args[0]); | 5375 CONVERT_DOUBLE_CHECKED(number, args[0]); |
| 5379 | 5376 |
| 5380 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 5377 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
| 5381 if (number > 0 && number <= Smi::kMaxValue) { | 5378 if (number > 0 && number <= Smi::kMaxValue) { |
| 5382 return Smi::FromInt(static_cast<int>(number)); | 5379 return Smi::FromInt(static_cast<int>(number)); |
| 5383 } | 5380 } |
| (...skipping 5017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10401 } else { | 10398 } else { |
| 10402 // Handle last resort GC and make sure to allow future allocations | 10399 // Handle last resort GC and make sure to allow future allocations |
| 10403 // to grow the heap without causing GCs (if possible). | 10400 // to grow the heap without causing GCs (if possible). |
| 10404 Counters::gc_last_resort_from_js.Increment(); | 10401 Counters::gc_last_resort_from_js.Increment(); |
| 10405 Heap::CollectAllGarbage(false); | 10402 Heap::CollectAllGarbage(false); |
| 10406 } | 10403 } |
| 10407 } | 10404 } |
| 10408 | 10405 |
| 10409 | 10406 |
| 10410 } } // namespace v8::internal | 10407 } } // namespace v8::internal |
| OLD | NEW |