LLIntSlowPaths.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /*
  2. * Copyright (C) 2011 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
  14. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
  17. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef LLIntSlowPaths_h
  26. #define LLIntSlowPaths_h
  27. #include <wtf/Platform.h>
  28. #include <wtf/StdLibExtras.h>
  29. #if ENABLE(LLINT)
  30. namespace JSC {
  31. class ExecState;
  32. struct Instruction;
  33. namespace LLInt {
  34. #if USE(JSVALUE64)
  35. // According to C++ rules, a type used for the return signature of function with C linkage (i.e.
  36. // 'extern "C"') needs to be POD; hence putting any constructors into it could cause either compiler
  37. // warnings, or worse, a change in the ABI used to return these types.
  38. struct SlowPathReturnType {
  39. void* a;
  40. ExecState* b;
  41. };
  42. inline SlowPathReturnType encodeResult(void* a, ExecState* b)
  43. {
  44. SlowPathReturnType result;
  45. result.a = a;
  46. result.b = b;
  47. return result;
  48. }
  49. inline void decodeResult(SlowPathReturnType result, void*& a, ExecState*& b)
  50. {
  51. a = result.a;
  52. b = result.b;
  53. }
  54. #else // USE(JSVALUE32_64)
  55. typedef int64_t SlowPathReturnType;
  56. typedef union {
  57. struct {
  58. void* a;
  59. ExecState* b;
  60. } pair;
  61. int64_t i;
  62. } SlowPathReturnTypeEncoding;
  63. inline SlowPathReturnType encodeResult(void* a, ExecState* b)
  64. {
  65. SlowPathReturnTypeEncoding u;
  66. u.pair.a = a;
  67. u.pair.b = b;
  68. return u.i;
  69. }
  70. inline void decodeResult(SlowPathReturnType result, void*& a, ExecState*& b)
  71. {
  72. SlowPathReturnTypeEncoding u;
  73. u.i = result;
  74. a = u.pair.a;
  75. b = u.pair.b;
  76. }
  77. #endif // USE(JSVALUE32_64)
  78. extern "C" SlowPathReturnType llint_trace_operand(ExecState*, Instruction*, int fromWhere, int operand);
  79. extern "C" SlowPathReturnType llint_trace_value(ExecState*, Instruction*, int fromWhere, int operand);
  80. #define LLINT_SLOW_PATH_DECL(name) \
  81. extern "C" SlowPathReturnType llint_##name(ExecState* exec, Instruction* pc)
  82. #define LLINT_SLOW_PATH_HIDDEN_DECL(name) \
  83. LLINT_SLOW_PATH_DECL(name) WTF_INTERNAL
  84. LLINT_SLOW_PATH_HIDDEN_DECL(trace_prologue);
  85. LLINT_SLOW_PATH_HIDDEN_DECL(trace_prologue_function_for_call);
  86. LLINT_SLOW_PATH_HIDDEN_DECL(trace_prologue_function_for_construct);
  87. LLINT_SLOW_PATH_HIDDEN_DECL(trace_arityCheck_for_call);
  88. LLINT_SLOW_PATH_HIDDEN_DECL(trace_arityCheck_for_construct);
  89. LLINT_SLOW_PATH_HIDDEN_DECL(trace);
  90. LLINT_SLOW_PATH_HIDDEN_DECL(special_trace);
  91. LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr);
  92. LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr_function_for_call);
  93. LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr_function_for_construct);
  94. LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr_function_for_call_arityCheck);
  95. LLINT_SLOW_PATH_HIDDEN_DECL(entry_osr_function_for_construct_arityCheck);
  96. LLINT_SLOW_PATH_HIDDEN_DECL(loop_osr);
  97. LLINT_SLOW_PATH_HIDDEN_DECL(replace);
  98. LLINT_SLOW_PATH_HIDDEN_DECL(stack_check);
  99. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_call_arityCheck);
  100. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_construct_arityCheck);
  101. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_create_activation);
  102. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_create_arguments);
  103. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_create_this);
  104. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_convert_this);
  105. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_object);
  106. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_array);
  107. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_array_with_size);
  108. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_array_buffer);
  109. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_regexp);
  110. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_not);
  111. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_eq);
  112. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_neq);
  113. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_stricteq);
  114. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_nstricteq);
  115. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_less);
  116. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_lesseq);
  117. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_greater);
  118. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_greatereq);
  119. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_pre_inc);
  120. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_pre_dec);
  121. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_to_number);
  122. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_negate);
  123. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_add);
  124. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_mul);
  125. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_sub);
  126. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_div);
  127. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_mod);
  128. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_lshift);
  129. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_rshift);
  130. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_urshift);
  131. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_bitand);
  132. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_bitor);
  133. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_bitxor);
  134. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_check_has_instance);
  135. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof);
  136. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_typeof);
  137. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_is_object);
  138. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_is_function);
  139. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_in);
  140. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve);
  141. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_to_base);
  142. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve_base);
  143. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve_with_base);
  144. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_resolve_with_this);
  145. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_init_global_const_check);
  146. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id);
  147. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_arguments_length);
  148. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_by_id);
  149. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_del_by_id);
  150. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_val);
  151. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_argument_by_val);
  152. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_pname);
  153. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_by_val);
  154. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_del_by_val);
  155. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_by_index);
  156. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_put_getter_setter);
  157. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jtrue);
  158. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jfalse);
  159. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jless);
  160. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jnless);
  161. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jgreater);
  162. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jngreater);
  163. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jlesseq);
  164. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jnlesseq);
  165. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jgreatereq);
  166. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_jngreatereq);
  167. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_switch_imm);
  168. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_switch_char);
  169. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_switch_string);
  170. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_func);
  171. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_new_func_exp);
  172. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_call);
  173. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_construct);
  174. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_call_varargs);
  175. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_call_eval);
  176. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_tear_off_activation);
  177. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_tear_off_arguments);
  178. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_strcat);
  179. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_to_primitive);
  180. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_pnames);
  181. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_next_pname);
  182. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_push_with_scope);
  183. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_pop_scope);
  184. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_push_name_scope);
  185. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_throw);
  186. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_throw_static_error);
  187. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_handle_watchdog_timer);
  188. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_debug);
  189. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_profile_will_call);
  190. LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_profile_did_call);
  191. LLINT_SLOW_PATH_HIDDEN_DECL(throw_from_native_call);
  192. } } // namespace JSC::LLInt
  193. #endif // ENABLE(LLINT)
  194. #endif // LLIntSlowPaths_h