2008-10-05  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Cameron Zwarich.

        Fix for bug #21387 - using SamplingTool with CTI.

        (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
        (2) Fix an incusion order problem due to ExecState changes.
        (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.

        * VM/CTI.h:
        (JSC::CTI::execute):
        * VM/SamplingTool.h:
        (JSC::SamplingTool::privateExecuteReturned):
        * kjs/Shell.cpp:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index 603292b..a44da1d 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -37,10 +37,6 @@
 #include <wtf/AlwaysInline.h>
 #include <wtf/Vector.h>
 
-#if ENABLE(SAMPLING_TOOL)
-#include "SamplingTool.h"
-#endif
-
 #if COMPILER(MSVC)
 #define CTI_ARGS void** args
 #define ARGS (args)
@@ -259,7 +255,11 @@
         static const int repatchOffsetGetByIdStructureID = 19;
         static const int repatchOffsetGetByIdBranchToSlowCase = 25;
         static const int repatchOffsetGetByIdPropertyMapOffset = 34;
+#if ENABLE(SAMPLING_TOOL)
+        static const int repatchOffsetGetByIdSlowCaseCall = 27 + ctiArgumentInitSize;
+#else
         static const int repatchOffsetGetByIdSlowCaseCall = 17 + ctiArgumentInitSize;
+#endif
 
     public:
         static void compile(Machine* machine, ExecState* exec, CodeBlock* codeBlock)
@@ -325,11 +325,7 @@
 
         inline static JSValue* execute(void* code, RegisterFile* registerFile, Register* r, JSGlobalData* globalData, JSValue** exception)
         {
-            JSValue* value = ctiTrampoline(code, registerFile, r, exception, Profiler::enabledProfilerReference(), globalData);
-#if ENABLE(SAMPLING_TOOL)
-            currentOpcodeID = static_cast<OpcodeID>(-1);
-#endif
-            return value;
+            return ctiTrampoline(code, registerFile, r, exception, Profiler::enabledProfilerReference(), globalData);
         }
 
     private: