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

Unified Diff: src/runtime.cc

Issue 6262: Improve performance of arguments object allocation by taking... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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
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);
« src/codegen-arm.cc ('K') | « src/runtime.h ('k') | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698