OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5419 Handle<Object> object = args.at<Object>(0); | 5419 Handle<Object> object = args.at<Object>(0); |
5420 | 5420 |
5421 if (object->IsJSFunction()) { | 5421 if (object->IsJSFunction()) { |
5422 JSFunction* func = JSFunction::cast(*object); | 5422 JSFunction* func = JSFunction::cast(*object); |
5423 func->shared()->set_native(true); | 5423 func->shared()->set_native(true); |
5424 } | 5424 } |
5425 return isolate->heap()->undefined_value(); | 5425 return isolate->heap()->undefined_value(); |
5426 } | 5426 } |
5427 | 5427 |
5428 | 5428 |
| 5429 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInlineBuiltinFlag) { |
| 5430 SealHandleScope shs(isolate); |
| 5431 RUNTIME_ASSERT(args.length() == 1); |
| 5432 |
| 5433 Handle<Object> object = args.at<Object>(0); |
| 5434 |
| 5435 if (object->IsJSFunction()) { |
| 5436 JSFunction* func = JSFunction::cast(*object); |
| 5437 func->shared()->set_inline_builtin(true); |
| 5438 } |
| 5439 return isolate->heap()->undefined_value(); |
| 5440 } |
| 5441 |
| 5442 |
5429 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { | 5443 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { |
5430 HandleScope scope(isolate); | 5444 HandleScope scope(isolate); |
5431 RUNTIME_ASSERT(args.length() == 5); | 5445 RUNTIME_ASSERT(args.length() == 5); |
5432 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5446 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
5433 CONVERT_SMI_ARG_CHECKED(store_index, 1); | 5447 CONVERT_SMI_ARG_CHECKED(store_index, 1); |
5434 Handle<Object> value = args.at<Object>(2); | 5448 Handle<Object> value = args.at<Object>(2); |
5435 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); | 5449 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); |
5436 CONVERT_SMI_ARG_CHECKED(literal_index, 4); | 5450 CONVERT_SMI_ARG_CHECKED(literal_index, 4); |
5437 | 5451 |
5438 Object* raw_literal_cell = literals->get(literal_index); | 5452 Object* raw_literal_cell = literals->get(literal_index); |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7840 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_tan) { | 7854 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_tan) { |
7841 SealHandleScope shs(isolate); | 7855 SealHandleScope shs(isolate); |
7842 ASSERT(args.length() == 1); | 7856 ASSERT(args.length() == 1); |
7843 isolate->counters()->math_tan()->Increment(); | 7857 isolate->counters()->math_tan()->Increment(); |
7844 | 7858 |
7845 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7859 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
7846 return isolate->transcendental_cache()->Get(TranscendentalCache::TAN, x); | 7860 return isolate->transcendental_cache()->Get(TranscendentalCache::TAN, x); |
7847 } | 7861 } |
7848 | 7862 |
7849 | 7863 |
| 7864 RUNTIME_FUNCTION(MaybeObject*, Runtime_PopulateTrigonometricTable) { |
| 7865 HandleScope scope(isolate); |
| 7866 ASSERT(args.length() == 3); |
| 7867 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sin_table, 0); |
| 7868 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, cos_table, 1); |
| 7869 CONVERT_SMI_ARG_CHECKED(samples, 2); |
| 7870 RUNTIME_ASSERT(sin_table->type() == kExternalDoubleArray); |
| 7871 RUNTIME_ASSERT(cos_table->type() == kExternalDoubleArray); |
| 7872 double* sin_buffer = reinterpret_cast<double*>( |
| 7873 JSArrayBuffer::cast(sin_table->buffer())->backing_store()); |
| 7874 double* cos_buffer = reinterpret_cast<double*>( |
| 7875 JSArrayBuffer::cast(cos_table->buffer())->backing_store()); |
| 7876 |
| 7877 static const double pi_half = 3.1415926535897932 / 2; |
| 7878 double interval = pi_half / samples; |
| 7879 for (int i = 0; i < samples + 1; i++) { |
| 7880 double sample = sin(i * interval); |
| 7881 sin_buffer[i] = sample; |
| 7882 cos_buffer[samples - i] = sample * interval; |
| 7883 } |
| 7884 |
| 7885 // Fill this to catch out of bound accesses when calculating Math.sin(pi/2). |
| 7886 sin_buffer[samples + 1] = sin(pi_half + interval); |
| 7887 cos_buffer[samples + 1] = cos(pi_half + interval) * interval; |
| 7888 |
| 7889 return isolate->heap()->undefined_value(); |
| 7890 } |
| 7891 |
| 7892 |
7850 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { | 7893 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { |
7851 SealHandleScope shs(isolate); | 7894 SealHandleScope shs(isolate); |
7852 ASSERT(args.length() == 2); | 7895 ASSERT(args.length() == 2); |
7853 | 7896 |
7854 CONVERT_SMI_ARG_CHECKED(year, 0); | 7897 CONVERT_SMI_ARG_CHECKED(year, 0); |
7855 CONVERT_SMI_ARG_CHECKED(month, 1); | 7898 CONVERT_SMI_ARG_CHECKED(month, 1); |
7856 | 7899 |
7857 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); | 7900 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); |
7858 } | 7901 } |
7859 | 7902 |
(...skipping 7006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14866 // Handle last resort GC and make sure to allow future allocations | 14909 // Handle last resort GC and make sure to allow future allocations |
14867 // to grow the heap without causing GCs (if possible). | 14910 // to grow the heap without causing GCs (if possible). |
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14911 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14912 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14870 "Runtime::PerformGC"); | 14913 "Runtime::PerformGC"); |
14871 } | 14914 } |
14872 } | 14915 } |
14873 | 14916 |
14874 | 14917 |
14875 } } // namespace v8::internal | 14918 } } // namespace v8::internal |
OLD | NEW |