]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - jit/ThunkGenerators.h
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / jit / ThunkGenerators.h
index c3374f2d92d0251e1ccb26da67c2e2335fc7f91e..c35a2f54799cc8a6a448dfeaf11b5ef3afdec088 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2012, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #ifndef ThunkGenerators_h
 #define ThunkGenerators_h
 
-#if ENABLE(JIT)
-#include <wtf/PassRefPtr.h>
+#include "CodeSpecializationKind.h"
+#include "RegisterPreservationMode.h"
+#include "ThunkGenerator.h"
 
+#if ENABLE(JIT)
 namespace JSC {
-    class ExecutablePool;
-    class JSGlobalData;
-    class NativeExecutable;
-
-    typedef PassRefPtr<NativeExecutable> (*ThunkGenerator)(JSGlobalData*, ExecutablePool*);
-    PassRefPtr<NativeExecutable> charCodeAtThunkGenerator(JSGlobalData*, ExecutablePool*);
-    PassRefPtr<NativeExecutable> charAtThunkGenerator(JSGlobalData*, ExecutablePool*);
-    PassRefPtr<NativeExecutable> fromCharCodeThunkGenerator(JSGlobalData*, ExecutablePool*);
-    PassRefPtr<NativeExecutable> sqrtThunkGenerator(JSGlobalData*, ExecutablePool*);
-    PassRefPtr<NativeExecutable> powThunkGenerator(JSGlobalData*, ExecutablePool*);
+
+MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM*);
+
+MacroAssemblerCodeRef linkCallThunkGenerator(VM*);
+MacroAssemblerCodeRef linkConstructThunkGenerator(VM*);
+MacroAssemblerCodeRef linkCallThatPreservesRegsThunkGenerator(VM*);
+MacroAssemblerCodeRef linkConstructThatPreservesRegsThunkGenerator(VM*);
+
+inline ThunkGenerator linkThunkGeneratorFor(
+    CodeSpecializationKind kind, RegisterPreservationMode registers)
+{
+    switch (kind) {
+    case CodeForCall:
+        switch (registers) {
+        case RegisterPreservationNotRequired:
+            return linkCallThunkGenerator;
+        case MustPreserveRegisters:
+            return linkCallThatPreservesRegsThunkGenerator;
+        }
+        break;
+    case CodeForConstruct:
+        switch (registers) {
+        case RegisterPreservationNotRequired:
+            return linkConstructThunkGenerator;
+        case MustPreserveRegisters:
+            return linkConstructThatPreservesRegsThunkGenerator;
+        }
+        break;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return 0;
+}
+
+MacroAssemblerCodeRef linkClosureCallThunkGenerator(VM*);
+MacroAssemblerCodeRef linkClosureCallThatPreservesRegsThunkGenerator(VM*);
+
+inline ThunkGenerator linkClosureCallThunkGeneratorFor(RegisterPreservationMode registers)
+{
+    switch (registers) {
+    case RegisterPreservationNotRequired:
+        return linkClosureCallThunkGenerator;
+    case MustPreserveRegisters:
+        return linkClosureCallThatPreservesRegsThunkGenerator;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return 0;
+}
+
+MacroAssemblerCodeRef virtualCallThunkGenerator(VM*);
+MacroAssemblerCodeRef virtualConstructThunkGenerator(VM*);
+MacroAssemblerCodeRef virtualCallThatPreservesRegsThunkGenerator(VM*);
+MacroAssemblerCodeRef virtualConstructThatPreservesRegsThunkGenerator(VM*);
+
+inline ThunkGenerator virtualThunkGeneratorFor(
+    CodeSpecializationKind kind, RegisterPreservationMode registers)
+{
+    switch (kind) {
+    case CodeForCall:
+        switch (registers) {
+        case RegisterPreservationNotRequired:
+            return virtualCallThunkGenerator;
+        case MustPreserveRegisters:
+            return virtualCallThatPreservesRegsThunkGenerator;
+        }
+        break;
+    case CodeForConstruct:
+        switch (registers) {
+        case RegisterPreservationNotRequired:
+            return virtualConstructThunkGenerator;
+        case MustPreserveRegisters:
+            return virtualConstructThatPreservesRegsThunkGenerator;
+        }
+        break;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return 0;
+}
+
+MacroAssemblerCodeRef nativeCallGenerator(VM*);
+MacroAssemblerCodeRef nativeConstructGenerator(VM*);
+MacroAssemblerCodeRef nativeTailCallGenerator(VM*);
+MacroAssemblerCodeRef arityFixup(VM*);
+
+MacroAssemblerCodeRef charCodeAtThunkGenerator(VM*);
+MacroAssemblerCodeRef charAtThunkGenerator(VM*);
+MacroAssemblerCodeRef fromCharCodeThunkGenerator(VM*);
+MacroAssemblerCodeRef absThunkGenerator(VM*);
+MacroAssemblerCodeRef ceilThunkGenerator(VM*);
+MacroAssemblerCodeRef expThunkGenerator(VM*);
+MacroAssemblerCodeRef floorThunkGenerator(VM*);
+MacroAssemblerCodeRef logThunkGenerator(VM*);
+MacroAssemblerCodeRef roundThunkGenerator(VM*);
+MacroAssemblerCodeRef sqrtThunkGenerator(VM*);
+MacroAssemblerCodeRef powThunkGenerator(VM*);
+MacroAssemblerCodeRef imulThunkGenerator(VM*);
+MacroAssemblerCodeRef arrayIteratorNextKeyThunkGenerator(VM*);
+MacroAssemblerCodeRef arrayIteratorNextValueThunkGenerator(VM*);
+
 }
-#endif
+#endif // ENABLE(JIT)
 
 #endif // ThunkGenerator_h