| 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 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 ASSERT(args.length() == 2); | 3740 ASSERT(args.length() == 2); |
| 3741 | 3741 |
| 3742 CONVERT_DOUBLE_CHECKED(x, args[0]); | 3742 CONVERT_DOUBLE_CHECKED(x, args[0]); |
| 3743 CONVERT_DOUBLE_CHECKED(y, args[1]); | 3743 CONVERT_DOUBLE_CHECKED(y, args[1]); |
| 3744 | 3744 |
| 3745 #if defined WIN32 || defined _WIN64 | 3745 #if defined WIN32 || defined _WIN64 |
| 3746 // Workaround MS fmod bugs. ECMA-262 says: | 3746 // Workaround MS fmod bugs. ECMA-262 says: |
| 3747 // dividend is finite and divisor is an infinity => result equals dividend | 3747 // dividend is finite and divisor is an infinity => result equals dividend |
| 3748 // dividend is a zero and divisor is nonzero finite => result equals dividend | 3748 // dividend is a zero and divisor is nonzero finite => result equals dividend |
| 3749 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && | 3749 if (!(isfinite(x) && (!isfinite(y) && !isnan(y))) && |
| 3750 !(x == 0 && (y != 0 && isfinite(y)))) | 3750 !(x == 0 && (y != 0 && isfinite(y)))) { |
| 3751 x = fmod(x, y); |
| 3752 } |
| 3753 #else |
| 3754 x = fmod(x, y); |
| 3751 #endif | 3755 #endif |
| 3752 x = fmod(x, y); | |
| 3753 // NewNumberFromDouble may return a Smi instead of a Number object | 3756 // NewNumberFromDouble may return a Smi instead of a Number object |
| 3754 return Heap::NewNumberFromDouble(x); | 3757 return Heap::NewNumberFromDouble(x); |
| 3755 } | 3758 } |
| 3756 | 3759 |
| 3757 | 3760 |
| 3758 static Object* Runtime_StringAdd(Arguments args) { | 3761 static Object* Runtime_StringAdd(Arguments args) { |
| 3759 NoHandleAllocation ha; | 3762 NoHandleAllocation ha; |
| 3760 ASSERT(args.length() == 2); | 3763 ASSERT(args.length() == 2); |
| 3761 CONVERT_CHECKED(String, str1, args[0]); | 3764 CONVERT_CHECKED(String, str1, args[0]); |
| 3762 CONVERT_CHECKED(String, str2, args[1]); | 3765 CONVERT_CHECKED(String, str2, args[1]); |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4357 for (int i = 0; i < length; i++) { | 4360 for (int i = 0; i < length; i++) { |
| 4358 array->set(i, *--parameters, mode); | 4361 array->set(i, *--parameters, mode); |
| 4359 } | 4362 } |
| 4360 JSObject::cast(result)->set_elements(FixedArray::cast(obj), | 4363 JSObject::cast(result)->set_elements(FixedArray::cast(obj), |
| 4361 SKIP_WRITE_BARRIER); | 4364 SKIP_WRITE_BARRIER); |
| 4362 } | 4365 } |
| 4363 return result; | 4366 return result; |
| 4364 } | 4367 } |
| 4365 | 4368 |
| 4366 | 4369 |
| 4370 static Object* Runtime_AllocateHeapNumber(Arguments args) { |
| 4371 ASSERT_EQ(0, args.length()); |
| 4372 return Heap::AllocateHeapNumber(0.0); |
| 4373 } |
| 4374 |
| 4375 |
| 4367 static Object* Runtime_NewClosure(Arguments args) { | 4376 static Object* Runtime_NewClosure(Arguments args) { |
| 4368 HandleScope scope; | 4377 HandleScope scope; |
| 4369 ASSERT(args.length() == 2); | 4378 ASSERT(args.length() == 2); |
| 4370 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 0); | 4379 CONVERT_ARG_CHECKED(JSFunction, boilerplate, 0); |
| 4371 CONVERT_ARG_CHECKED(Context, context, 1); | 4380 CONVERT_ARG_CHECKED(Context, context, 1); |
| 4372 | 4381 |
| 4373 Handle<JSFunction> result = | 4382 Handle<JSFunction> result = |
| 4374 Factory::NewFunctionFromBoilerplate(boilerplate, context); | 4383 Factory::NewFunctionFromBoilerplate(boilerplate, context); |
| 4375 return *result; | 4384 return *result; |
| 4376 } | 4385 } |
| (...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7751 } else { | 7760 } else { |
| 7752 // Handle last resort GC and make sure to allow future allocations | 7761 // Handle last resort GC and make sure to allow future allocations |
| 7753 // to grow the heap without causing GCs (if possible). | 7762 // to grow the heap without causing GCs (if possible). |
| 7754 Counters::gc_last_resort_from_js.Increment(); | 7763 Counters::gc_last_resort_from_js.Increment(); |
| 7755 Heap::CollectAllGarbage(false); | 7764 Heap::CollectAllGarbage(false); |
| 7756 } | 7765 } |
| 7757 } | 7766 } |
| 7758 | 7767 |
| 7759 | 7768 |
| 7760 } } // namespace v8::internal | 7769 } } // namespace v8::internal |
| OLD | NEW |