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 5231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5242 NoHandleAllocation ha; | 5242 NoHandleAllocation ha; |
5243 ASSERT(args.length() == 1); | 5243 ASSERT(args.length() == 1); |
5244 | 5244 |
5245 Object* number = args[0]; | 5245 Object* number = args[0]; |
5246 RUNTIME_ASSERT(number->IsNumber()); | 5246 RUNTIME_ASSERT(number->IsNumber()); |
5247 | 5247 |
5248 return Heap::NumberToString(number); | 5248 return Heap::NumberToString(number); |
5249 } | 5249 } |
5250 | 5250 |
5251 | 5251 |
| 5252 static Object* Runtime_NumberToStringSkipCache(Arguments args) { |
| 5253 NoHandleAllocation ha; |
| 5254 ASSERT(args.length() == 1); |
| 5255 |
| 5256 Object* number = args[0]; |
| 5257 RUNTIME_ASSERT(number->IsNumber()); |
| 5258 |
| 5259 return Heap::NumberToString(number, false); |
| 5260 } |
| 5261 |
| 5262 |
5252 static Object* Runtime_NumberToInteger(Arguments args) { | 5263 static Object* Runtime_NumberToInteger(Arguments args) { |
5253 NoHandleAllocation ha; | 5264 NoHandleAllocation ha; |
5254 ASSERT(args.length() == 1); | 5265 ASSERT(args.length() == 1); |
5255 | 5266 |
5256 CONVERT_DOUBLE_CHECKED(number, args[0]); | 5267 CONVERT_DOUBLE_CHECKED(number, args[0]); |
5257 | 5268 |
5258 // We do not include 0 so that we don't have to treat +0 / -0 cases. | 5269 // We do not include 0 so that we don't have to treat +0 / -0 cases. |
5259 if (number > 0 && number <= Smi::kMaxValue) { | 5270 if (number > 0 && number <= Smi::kMaxValue) { |
5260 return Smi::FromInt(static_cast<int>(number)); | 5271 return Smi::FromInt(static_cast<int>(number)); |
5261 } | 5272 } |
(...skipping 4777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10039 } else { | 10050 } else { |
10040 // Handle last resort GC and make sure to allow future allocations | 10051 // Handle last resort GC and make sure to allow future allocations |
10041 // to grow the heap without causing GCs (if possible). | 10052 // to grow the heap without causing GCs (if possible). |
10042 Counters::gc_last_resort_from_js.Increment(); | 10053 Counters::gc_last_resort_from_js.Increment(); |
10043 Heap::CollectAllGarbage(false); | 10054 Heap::CollectAllGarbage(false); |
10044 } | 10055 } |
10045 } | 10056 } |
10046 | 10057 |
10047 | 10058 |
10048 } } // namespace v8::internal | 10059 } } // namespace v8::internal |
OLD | NEW |