2008-06-28 Darin Adler <darin@apple.com>
Reviewed by Oliver.
- https://bugs.webkit.org/show_bug.cgi?id=19787
create most arrays from values in registers rather than with multiple put operations
SunSpider says 0.8% faster.
* VM/CodeBlock.cpp:
(KJS::CodeBlock::dump): Added argv and argc parameters to new_array.
* VM/Machine.cpp:
(KJS::Machine::privateExecute): Ditto.
* VM/CodeGenerator.cpp:
(KJS::CodeGenerator::emitNewArray): Added.
* VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray.
* kjs/nodes.cpp:
(KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be
initialized with as many elements as possible. If the array doesn't have any
holes in it, that's all that's needed. If there are holes, then emit some separate
put operations for the other values in the array and for the length as needed.
* kjs/nodes.h: Added some accessors to ElementNode so the code generator can
iterate through elements and generate code to evaluate them. Now ArrayNode does
not need to be a friend. Also took out some unused PlacementNewAdoptType
constructors.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34851 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CodeBlock.cpp b/JavaScriptCore/VM/CodeBlock.cpp
index b9de195..ff6903a 100644
--- a/JavaScriptCore/VM/CodeBlock.cpp
+++ b/JavaScriptCore/VM/CodeBlock.cpp
@@ -30,9 +30,9 @@
#include "config.h"
#include "CodeBlock.h"
+#include "JSValue.h"
#include "Machine.h"
#include "debugger.h"
-#include "JSValue.h"
#include <stdio.h>
namespace KJS {
@@ -217,8 +217,10 @@
break;
}
case op_new_array: {
- int r0 = (++it)->u.operand;
- printf("[%4d] new_array\t %s\n", location, registerName(r0).c_str());
+ int dst = (++it)->u.operand;
+ int argv = (++it)->u.operand;
+ int argc = (++it)->u.operand;
+ printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(dst).c_str(), registerName(argv).c_str(), argc);
break;
}
case op_new_regexp: {