Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: src/runtime.cc

Issue 103243005: Captured arguments object materialization (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Formatting fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 8061 matching lines...) Expand 10 before | Expand all | Expand 10 after
8072 int prefix_argc, 8072 int prefix_argc,
8073 int* total_argc) { 8073 int* total_argc) {
8074 // Find frame containing arguments passed to the caller. 8074 // Find frame containing arguments passed to the caller.
8075 JavaScriptFrameIterator it(isolate); 8075 JavaScriptFrameIterator it(isolate);
8076 JavaScriptFrame* frame = it.frame(); 8076 JavaScriptFrame* frame = it.frame();
8077 List<JSFunction*> functions(2); 8077 List<JSFunction*> functions(2);
8078 frame->GetFunctions(&functions); 8078 frame->GetFunctions(&functions);
8079 if (functions.length() > 1) { 8079 if (functions.length() > 1) {
8080 int inlined_jsframe_index = functions.length() - 1; 8080 int inlined_jsframe_index = functions.length() - 1;
8081 JSFunction* inlined_function = functions[inlined_jsframe_index]; 8081 JSFunction* inlined_function = functions[inlined_jsframe_index];
8082 Vector<SlotRef> args_slots = 8082 SlotRefValueBuilder slot_refs(
8083 SlotRef::ComputeSlotMappingForArguments( 8083 frame,
8084 frame, 8084 inlined_jsframe_index,
8085 inlined_jsframe_index, 8085 inlined_function->shared()->formal_parameter_count());
8086 inlined_function->shared()->formal_parameter_count());
8087 8086
8088 int args_count = args_slots.length(); 8087 int args_count = slot_refs.args_length();
8089 8088
8090 *total_argc = prefix_argc + args_count; 8089 *total_argc = prefix_argc + args_count;
8091 SmartArrayPointer<Handle<Object> > param_data( 8090 SmartArrayPointer<Handle<Object> > param_data(
8092 NewArray<Handle<Object> >(*total_argc)); 8091 NewArray<Handle<Object> >(*total_argc));
8092 slot_refs.Prepare(isolate);
8093 for (int i = 0; i < args_count; i++) { 8093 for (int i = 0; i < args_count; i++) {
8094 Handle<Object> val = args_slots[i].GetValue(isolate); 8094 Handle<Object> val = slot_refs.GetNext(isolate, 0);
8095 param_data[prefix_argc + i] = val; 8095 param_data[prefix_argc + i] = val;
8096 } 8096 }
8097 8097 slot_refs.Finish(isolate);
8098 args_slots.Dispose();
8099 8098
8100 return param_data; 8099 return param_data;
8101 } else { 8100 } else {
8102 it.AdvanceToArgumentsFrame(); 8101 it.AdvanceToArgumentsFrame();
8103 frame = it.frame(); 8102 frame = it.frame();
8104 int args_count = frame->ComputeParametersCount(); 8103 int args_count = frame->ComputeParametersCount();
8105 8104
8106 *total_argc = prefix_argc + args_count; 8105 *total_argc = prefix_argc + args_count;
8107 SmartArrayPointer<Handle<Object> > param_data( 8106 SmartArrayPointer<Handle<Object> > param_data(
8108 NewArray<Handle<Object> >(*total_argc)); 8107 NewArray<Handle<Object> >(*total_argc));
(...skipping 6782 matching lines...) Expand 10 before | Expand all | Expand 10 after
14891 // Handle last resort GC and make sure to allow future allocations 14890 // Handle last resort GC and make sure to allow future allocations
14892 // to grow the heap without causing GCs (if possible). 14891 // to grow the heap without causing GCs (if possible).
14893 isolate->counters()->gc_last_resort_from_js()->Increment(); 14892 isolate->counters()->gc_last_resort_from_js()->Increment();
14894 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14893 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14895 "Runtime::PerformGC"); 14894 "Runtime::PerformGC");
14896 } 14895 }
14897 } 14896 }
14898 14897
14899 14898
14900 } } // namespace v8::internal 14899 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698