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 5361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5372 CONVERT_ARG_CHECKED(Object, object, 0); | 5372 CONVERT_ARG_CHECKED(Object, object, 0); |
5373 | 5373 |
5374 if (object->IsJSFunction()) { | 5374 if (object->IsJSFunction()) { |
5375 JSFunction* func = JSFunction::cast(object); | 5375 JSFunction* func = JSFunction::cast(object); |
5376 func->shared()->set_native(true); | 5376 func->shared()->set_native(true); |
5377 } | 5377 } |
5378 return isolate->heap()->undefined_value(); | 5378 return isolate->heap()->undefined_value(); |
5379 } | 5379 } |
5380 | 5380 |
5381 | 5381 |
5382 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInlineBuiltinFlag) { | |
5383 SealHandleScope shs(isolate); | |
5384 RUNTIME_ASSERT(args.length() == 1); | |
5385 | |
5386 Handle<Object> object = args.at<Object>(0); | |
5387 | |
5388 if (object->IsJSFunction()) { | |
5389 JSFunction* func = JSFunction::cast(*object); | |
5390 func->shared()->set_inline_builtin(true); | |
5391 } | |
5392 return isolate->heap()->undefined_value(); | |
5393 } | |
5394 | |
5395 | |
5396 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { | 5382 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { |
5397 HandleScope scope(isolate); | 5383 HandleScope scope(isolate); |
5398 RUNTIME_ASSERT(args.length() == 5); | 5384 RUNTIME_ASSERT(args.length() == 5); |
5399 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 5385 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
5400 CONVERT_SMI_ARG_CHECKED(store_index, 1); | 5386 CONVERT_SMI_ARG_CHECKED(store_index, 1); |
5401 Handle<Object> value = args.at<Object>(2); | 5387 Handle<Object> value = args.at<Object>(2); |
5402 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); | 5388 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); |
5403 CONVERT_SMI_ARG_CHECKED(literal_index, 4); | 5389 CONVERT_SMI_ARG_CHECKED(literal_index, 4); |
5404 | 5390 |
5405 Object* raw_literal_cell = literals->get(literal_index); | 5391 Object* raw_literal_cell = literals->get(literal_index); |
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7809 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_tan) { | 7795 RUNTIME_FUNCTION(MaybeObject*, Runtime_Math_tan) { |
7810 SealHandleScope shs(isolate); | 7796 SealHandleScope shs(isolate); |
7811 ASSERT(args.length() == 1); | 7797 ASSERT(args.length() == 1); |
7812 isolate->counters()->math_tan()->Increment(); | 7798 isolate->counters()->math_tan()->Increment(); |
7813 | 7799 |
7814 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 7800 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
7815 return isolate->transcendental_cache()->Get(TranscendentalCache::TAN, x); | 7801 return isolate->transcendental_cache()->Get(TranscendentalCache::TAN, x); |
7816 } | 7802 } |
7817 | 7803 |
7818 | 7804 |
7819 RUNTIME_FUNCTION(MaybeObject*, Runtime_PopulateTrigonometricTable) { | |
7820 HandleScope scope(isolate); | |
7821 ASSERT(args.length() == 3); | |
7822 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sin_table, 0); | |
7823 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, cos_table, 1); | |
7824 CONVERT_SMI_ARG_CHECKED(samples, 2); | |
7825 RUNTIME_ASSERT(sin_table->type() == kExternalDoubleArray); | |
7826 RUNTIME_ASSERT(cos_table->type() == kExternalDoubleArray); | |
7827 double* sin_buffer = reinterpret_cast<double*>( | |
7828 JSArrayBuffer::cast(sin_table->buffer())->backing_store()); | |
7829 double* cos_buffer = reinterpret_cast<double*>( | |
7830 JSArrayBuffer::cast(cos_table->buffer())->backing_store()); | |
7831 | |
7832 static const double pi_half = 3.1415926535897932 / 2; | |
7833 double interval = pi_half / samples; | |
7834 for (int i = 0; i < samples + 1; i++) { | |
7835 double sample = sin(i * interval); | |
7836 sin_buffer[i] = sample; | |
7837 cos_buffer[samples - i] = sample * interval; | |
7838 } | |
7839 | |
7840 // Fill this to catch out of bound accesses when calculating Math.sin(pi/2). | |
7841 sin_buffer[samples + 1] = sin(pi_half + interval); | |
7842 cos_buffer[samples + 1] = cos(pi_half + interval) * interval; | |
7843 | |
7844 return isolate->heap()->undefined_value(); | |
7845 } | |
7846 | |
7847 | |
7848 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { | 7805 RUNTIME_FUNCTION(MaybeObject*, Runtime_DateMakeDay) { |
7849 SealHandleScope shs(isolate); | 7806 SealHandleScope shs(isolate); |
7850 ASSERT(args.length() == 2); | 7807 ASSERT(args.length() == 2); |
7851 | 7808 |
7852 CONVERT_SMI_ARG_CHECKED(year, 0); | 7809 CONVERT_SMI_ARG_CHECKED(year, 0); |
7853 CONVERT_SMI_ARG_CHECKED(month, 1); | 7810 CONVERT_SMI_ARG_CHECKED(month, 1); |
7854 | 7811 |
7855 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); | 7812 return Smi::FromInt(isolate->date_cache()->DaysFromYearMonth(year, month)); |
7856 } | 7813 } |
7857 | 7814 |
(...skipping 6995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14853 // Handle last resort GC and make sure to allow future allocations | 14810 // Handle last resort GC and make sure to allow future allocations |
14854 // to grow the heap without causing GCs (if possible). | 14811 // to grow the heap without causing GCs (if possible). |
14855 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14812 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14856 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14813 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14857 "Runtime::PerformGC"); | 14814 "Runtime::PerformGC"); |
14858 } | 14815 } |
14859 } | 14816 } |
14860 | 14817 |
14861 | 14818 |
14862 } } // namespace v8::internal | 14819 } } // namespace v8::internal |
OLD | NEW |