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

Unified Diff: src/runtime.cc

Issue 6794050: Revert "[Arguments] Merge (7442,7496] from bleeding_edge." (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform-win32.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 65d399d6d9e50b73bc64a2b056b8261b61881ef8..526686d361eacbb0b527c2e464cc1d64f3eaea84 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -7169,46 +7169,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewClosure) {
return *result;
}
-
-static SmartPointer<Object**> GetNonBoundArguments(int bound_argc,
- int* total_argc) {
- // Find frame containing arguments passed to the caller.
- JavaScriptFrameIterator it;
- JavaScriptFrame* frame = it.frame();
- List<JSFunction*> functions(2);
- frame->GetFunctions(&functions);
- if (functions.length() > 1) {
- int inlined_frame_index = functions.length() - 1;
- JSFunction* inlined_function = functions[inlined_frame_index];
- int args_count = inlined_function->shared()->formal_parameter_count();
- ScopedVector<SlotRef> args_slots(args_count);
- SlotRef::ComputeSlotMappingForArguments(frame,
- inlined_frame_index,
- &args_slots);
-
- *total_argc = bound_argc + args_count;
- SmartPointer<Object**> param_data(NewArray<Object**>(*total_argc));
- for (int i = 0; i < args_count; i++) {
- Handle<Object> val = args_slots[i].GetValue();
- param_data[bound_argc + i] = val.location();
- }
- return param_data;
- } else {
- it.AdvanceToArgumentsFrame();
- frame = it.frame();
- int args_count = frame->ComputeParametersCount();
-
- *total_argc = bound_argc + args_count;
- SmartPointer<Object**> param_data(NewArray<Object**>(*total_argc));
- for (int i = 0; i < args_count; i++) {
- Handle<Object> val = Handle<Object>(frame->GetParameter(i));
- param_data[bound_argc + i] = val.location();
- }
- return param_data;
- }
-}
-
-
RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
HandleScope scope(isolate);
ASSERT(args.length() == 2);
@@ -7216,22 +7176,34 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObjectFromBound) {
CONVERT_ARG_CHECKED(JSFunction, function, 0);
// Second argument is either null or an array of bound arguments.
- Handle<FixedArray> bound_args;
+ FixedArray* bound_args = NULL;
int bound_argc = 0;
if (!args[1]->IsNull()) {
CONVERT_ARG_CHECKED(JSArray, params, 1);
RUNTIME_ASSERT(params->HasFastElements());
- bound_args = Handle<FixedArray>(FixedArray::cast(params->elements()));
+ bound_args = FixedArray::cast(params->elements());
bound_argc = Smi::cast(params->length())->value();
}
- int total_argc = 0;
- SmartPointer<Object**> param_data =
- GetNonBoundArguments(bound_argc, &total_argc);
+ // Find frame containing arguments passed to the caller.
+ JavaScriptFrameIterator it;
+ JavaScriptFrame* frame = it.frame();
+ ASSERT(!frame->is_optimized());
+ it.AdvanceToArgumentsFrame();
+ frame = it.frame();
+ int argc = frame->ComputeParametersCount();
+
+ // Prepend bound arguments to caller's arguments.
+ int total_argc = bound_argc + argc;
+ SmartPointer<Object**> param_data(NewArray<Object**>(total_argc));
for (int i = 0; i < bound_argc; i++) {
Handle<Object> val = Handle<Object>(bound_args->get(i));
param_data[i] = val.location();
}
+ for (int i = 0; i < argc; i++) {
+ Handle<Object> val = Handle<Object>(frame->GetParameter(i));
+ param_data[bound_argc + i] = val.location();
+ }
bool exception = false;
Handle<Object> result =
« no previous file with comments | « src/platform-win32.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698