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 8031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8042 int prefix_argc, | 8042 int prefix_argc, |
8043 int* total_argc) { | 8043 int* total_argc) { |
8044 // Find frame containing arguments passed to the caller. | 8044 // Find frame containing arguments passed to the caller. |
8045 JavaScriptFrameIterator it(isolate); | 8045 JavaScriptFrameIterator it(isolate); |
8046 JavaScriptFrame* frame = it.frame(); | 8046 JavaScriptFrame* frame = it.frame(); |
8047 List<JSFunction*> functions(2); | 8047 List<JSFunction*> functions(2); |
8048 frame->GetFunctions(&functions); | 8048 frame->GetFunctions(&functions); |
8049 if (functions.length() > 1) { | 8049 if (functions.length() > 1) { |
8050 int inlined_jsframe_index = functions.length() - 1; | 8050 int inlined_jsframe_index = functions.length() - 1; |
8051 JSFunction* inlined_function = functions[inlined_jsframe_index]; | 8051 JSFunction* inlined_function = functions[inlined_jsframe_index]; |
8052 SlotRefValueBuilder slot_refs( | 8052 Vector<SlotRef> args_slots = |
8053 frame, | 8053 SlotRef::ComputeSlotMappingForArguments( |
8054 inlined_jsframe_index, | 8054 frame, |
8055 inlined_function->shared()->formal_parameter_count()); | 8055 inlined_jsframe_index, |
| 8056 inlined_function->shared()->formal_parameter_count()); |
8056 | 8057 |
8057 int args_count = slot_refs.args_length(); | 8058 int args_count = args_slots.length(); |
8058 | 8059 |
8059 *total_argc = prefix_argc + args_count; | 8060 *total_argc = prefix_argc + args_count; |
8060 SmartArrayPointer<Handle<Object> > param_data( | 8061 SmartArrayPointer<Handle<Object> > param_data( |
8061 NewArray<Handle<Object> >(*total_argc)); | 8062 NewArray<Handle<Object> >(*total_argc)); |
8062 slot_refs.Prepare(isolate); | |
8063 for (int i = 0; i < args_count; i++) { | 8063 for (int i = 0; i < args_count; i++) { |
8064 Handle<Object> val = slot_refs.GetNext(isolate, 0); | 8064 Handle<Object> val = args_slots[i].GetValue(isolate); |
8065 param_data[prefix_argc + i] = val; | 8065 param_data[prefix_argc + i] = val; |
8066 } | 8066 } |
8067 slot_refs.Finish(isolate); | 8067 |
| 8068 args_slots.Dispose(); |
8068 | 8069 |
8069 return param_data; | 8070 return param_data; |
8070 } else { | 8071 } else { |
8071 it.AdvanceToArgumentsFrame(); | 8072 it.AdvanceToArgumentsFrame(); |
8072 frame = it.frame(); | 8073 frame = it.frame(); |
8073 int args_count = frame->ComputeParametersCount(); | 8074 int args_count = frame->ComputeParametersCount(); |
8074 | 8075 |
8075 *total_argc = prefix_argc + args_count; | 8076 *total_argc = prefix_argc + args_count; |
8076 SmartArrayPointer<Handle<Object> > param_data( | 8077 SmartArrayPointer<Handle<Object> > param_data( |
8077 NewArray<Handle<Object> >(*total_argc)); | 8078 NewArray<Handle<Object> >(*total_argc)); |
(...skipping 6749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14827 // Handle last resort GC and make sure to allow future allocations | 14828 // Handle last resort GC and make sure to allow future allocations |
14828 // to grow the heap without causing GCs (if possible). | 14829 // to grow the heap without causing GCs (if possible). |
14829 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14830 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14830 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14831 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14831 "Runtime::PerformGC"); | 14832 "Runtime::PerformGC"); |
14832 } | 14833 } |
14833 } | 14834 } |
14834 | 14835 |
14835 | 14836 |
14836 } } // namespace v8::internal | 14837 } } // namespace v8::internal |
OLD | NEW |