2008-07-02  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Oliver Hunt.

        Optimized a[n] get for cases where a is an array or a string, and a[n]
        put for cases where a is an array.
        
        SunSpider says 9.0% faster.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/Machine.h b/JavaScriptCore/VM/Machine.h
index 38c97af..228cf04 100644
--- a/JavaScriptCore/VM/Machine.h
+++ b/JavaScriptCore/VM/Machine.h
@@ -29,6 +29,8 @@
 #ifndef Machine_h
 #define Machine_h
 
+#include "JSCell.h"
+#include "JSValue.h"
 #include "Opcode.h"
 #include "RegisterFile.h"
 #include <kjs/list.h>
@@ -140,6 +142,9 @@
         JSValue* checkTimeout(JSGlobalObject*);
         void resetTimeoutCheck();
 
+        bool isJSArray(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsArrayVptr; }
+        bool isJSString(JSValue* v) { return !JSImmediate::isImmediate(v) && v->asCell()->vptr() == m_jsStringVptr; }
+        
         int m_reentryDepth;
         unsigned m_timeoutTime;
         unsigned m_timeAtLastCheckTimeout;
@@ -148,6 +153,9 @@
         unsigned m_ticksUntilNextTimeoutCheck;
 
         RegisterFile m_registerFile;
+        
+        void* m_jsArrayVptr;
+        void* m_jsStringVptr;
 
 #if HAVE(COMPUTED_GOTO)
         Opcode m_opcodeTable[numOpcodeIDs]; // Maps OpcodeID => Opcode for compiling