| 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 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3475 if (obj->IsHeapNumber()) { | 3475 if (obj->IsHeapNumber()) { |
| 3476 double value = HeapNumber::cast(obj)->value(); | 3476 double value = HeapNumber::cast(obj)->value(); |
| 3477 int int_value = FastD2I(value); | 3477 int int_value = FastD2I(value); |
| 3478 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { | 3478 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { |
| 3479 return Smi::FromInt(int_value); | 3479 return Smi::FromInt(int_value); |
| 3480 } | 3480 } |
| 3481 } | 3481 } |
| 3482 return Heap::nan_value(); | 3482 return Heap::nan_value(); |
| 3483 } | 3483 } |
| 3484 | 3484 |
| 3485 |
| 3485 static Object* Runtime_NumberAdd(Arguments args) { | 3486 static Object* Runtime_NumberAdd(Arguments args) { |
| 3486 NoHandleAllocation ha; | 3487 NoHandleAllocation ha; |
| 3487 ASSERT(args.length() == 2); | 3488 ASSERT(args.length() == 2); |
| 3488 | 3489 |
| 3489 CONVERT_DOUBLE_CHECKED(x, args[0]); | 3490 CONVERT_DOUBLE_CHECKED(x, args[0]); |
| 3490 CONVERT_DOUBLE_CHECKED(y, args[1]); | 3491 CONVERT_DOUBLE_CHECKED(y, args[1]); |
| 3491 return Heap::AllocateHeapNumber(x + y); | 3492 return Heap::AllocateHeapNumber(x + y); |
| 3492 } | 3493 } |
| 3493 | 3494 |
| 3494 | 3495 |
| (...skipping 3457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6952 } else { | 6953 } else { |
| 6953 // Handle last resort GC and make sure to allow future allocations | 6954 // Handle last resort GC and make sure to allow future allocations |
| 6954 // to grow the heap without causing GCs (if possible). | 6955 // to grow the heap without causing GCs (if possible). |
| 6955 Counters::gc_last_resort_from_js.Increment(); | 6956 Counters::gc_last_resort_from_js.Increment(); |
| 6956 Heap::CollectAllGarbage(); | 6957 Heap::CollectAllGarbage(); |
| 6957 } | 6958 } |
| 6958 } | 6959 } |
| 6959 | 6960 |
| 6960 | 6961 |
| 6961 } } // namespace v8::internal | 6962 } } // namespace v8::internal |
| OLD | NEW |