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 8671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8682 | 8682 |
8683 | 8683 |
8684 RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) { | 8684 RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) { |
8685 HandleScope scope(isolate); | 8685 HandleScope scope(isolate); |
8686 ASSERT(args.length() == 5); | 8686 ASSERT(args.length() == 5); |
8687 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); | 8687 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, fun, 0); |
8688 Handle<Object> receiver = args.at<Object>(1); | 8688 Handle<Object> receiver = args.at<Object>(1); |
8689 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2); | 8689 CONVERT_ARG_HANDLE_CHECKED(JSObject, arguments, 2); |
8690 CONVERT_SMI_ARG_CHECKED(offset, 3); | 8690 CONVERT_SMI_ARG_CHECKED(offset, 3); |
8691 CONVERT_SMI_ARG_CHECKED(argc, 4); | 8691 CONVERT_SMI_ARG_CHECKED(argc, 4); |
8692 ASSERT(offset >= 0); | 8692 RUNTIME_ASSERT(offset >= 0); |
8693 ASSERT(argc >= 0); | 8693 RUNTIME_ASSERT(argc >= 0); |
8694 | 8694 |
8695 // If there are too many arguments, allocate argv via malloc. | 8695 // If there are too many arguments, allocate argv via malloc. |
8696 const int argv_small_size = 10; | 8696 const int argv_small_size = 10; |
8697 Handle<Object> argv_small_buffer[argv_small_size]; | 8697 Handle<Object> argv_small_buffer[argv_small_size]; |
8698 SmartArrayPointer<Handle<Object> > argv_large_buffer; | 8698 SmartArrayPointer<Handle<Object> > argv_large_buffer; |
8699 Handle<Object>* argv = argv_small_buffer; | 8699 Handle<Object>* argv = argv_small_buffer; |
8700 if (argc > argv_small_size) { | 8700 if (argc > argv_small_size) { |
8701 argv = new Handle<Object>[argc]; | 8701 argv = new Handle<Object>[argc]; |
8702 if (argv == NULL) return isolate->StackOverflow(); | 8702 if (argv == NULL) return isolate->StackOverflow(); |
8703 argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv); | 8703 argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv); |
(...skipping 5466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14170 // Handle last resort GC and make sure to allow future allocations | 14170 // Handle last resort GC and make sure to allow future allocations |
14171 // to grow the heap without causing GCs (if possible). | 14171 // to grow the heap without causing GCs (if possible). |
14172 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14172 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14173 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14173 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14174 "Runtime::PerformGC"); | 14174 "Runtime::PerformGC"); |
14175 } | 14175 } |
14176 } | 14176 } |
14177 | 14177 |
14178 | 14178 |
14179 } } // namespace v8::internal | 14179 } } // namespace v8::internal |
OLD | NEW |