Index: src/runtime.cc |
=================================================================== |
--- src/runtime.cc (revision 433) |
+++ src/runtime.cc (working copy) |
@@ -2703,6 +2703,9 @@ |
} |
+// The NewArguments function is only used when constructing the |
+// arguments array when calling non-functions from JavaScript in |
+// runtime.js:CALL_NON_FUNCTION. |
static Object* Runtime_NewArguments(Arguments args) { |
NoHandleAllocation ha; |
ASSERT(args.length() == 1); |
@@ -2727,6 +2730,26 @@ |
} |
+static Object* Runtime_NewArgumentsFast(Arguments args) { |
+ NoHandleAllocation ha; |
+ ASSERT(args.length() == 3); |
+ |
+ JSFunction* callee = JSFunction::cast(args[0]); |
+ Object** parameters = reinterpret_cast<Object**>(args[1]); |
+ const int length = Smi::cast(args[2])->value(); |
+ |
+ Object* result = Heap::AllocateArgumentsObject(callee, length); |
+ if (result->IsFailure()) return result; |
+ FixedArray* array = FixedArray::cast(JSObject::cast(result)->elements()); |
+ ASSERT(array->length() == length); |
+ FixedArray::WriteBarrierMode mode = array->GetWriteBarrierMode(); |
+ for (int i = 0; i < length; i++) { |
+ array->set(i, *--parameters, mode); |
+ } |
+ return result; |
+} |
+ |
+ |
static Object* Runtime_NewClosure(Arguments args) { |
HandleScope scope; |
ASSERT(args.length() == 2); |