OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 if (!*definitely_mismatches) { | 1872 if (!*definitely_mismatches) { |
1873 jmp(done, done_near); | 1873 jmp(done, done_near); |
1874 } | 1874 } |
1875 } else { | 1875 } else { |
1876 jmp(adaptor, RelocInfo::CODE_TARGET); | 1876 jmp(adaptor, RelocInfo::CODE_TARGET); |
1877 } | 1877 } |
1878 bind(&invoke); | 1878 bind(&invoke); |
1879 } | 1879 } |
1880 } | 1880 } |
1881 | 1881 |
1882 | 1882 void MacroAssembler::CheckDebugHook(Register fun, Register new_target, |
1883 void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, | 1883 const ParameterCount& expected, |
1884 const ParameterCount& expected, | 1884 const ParameterCount& actual) { |
1885 const ParameterCount& actual) { | 1885 Label skip_hook; |
1886 Label skip_flooding; | 1886 ExternalReference debug_hook_active = |
1887 ExternalReference last_step_action = | 1887 ExternalReference::debug_hook_on_function_call_address(isolate()); |
1888 ExternalReference::debug_last_step_action_address(isolate()); | 1888 cmpb(Operand::StaticVariable(debug_hook_active), Immediate(0)); |
1889 STATIC_ASSERT(StepFrame > StepIn); | 1889 j(equal, &skip_hook); |
1890 cmpb(Operand::StaticVariable(last_step_action), Immediate(StepIn)); | |
1891 j(less, &skip_flooding); | |
1892 { | 1890 { |
1893 FrameScope frame(this, | 1891 FrameScope frame(this, |
1894 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); | 1892 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); |
1895 if (expected.is_reg()) { | 1893 if (expected.is_reg()) { |
1896 SmiTag(expected.reg()); | 1894 SmiTag(expected.reg()); |
1897 Push(expected.reg()); | 1895 Push(expected.reg()); |
1898 } | 1896 } |
1899 if (actual.is_reg()) { | 1897 if (actual.is_reg()) { |
1900 SmiTag(actual.reg()); | 1898 SmiTag(actual.reg()); |
1901 Push(actual.reg()); | 1899 Push(actual.reg()); |
1902 } | 1900 } |
1903 if (new_target.is_valid()) { | 1901 if (new_target.is_valid()) { |
1904 Push(new_target); | 1902 Push(new_target); |
1905 } | 1903 } |
1906 Push(fun); | 1904 Push(fun); |
1907 Push(fun); | 1905 Push(fun); |
1908 CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 1906 CallRuntime(Runtime::kDebugOnFunctionCall); |
1909 Pop(fun); | 1907 Pop(fun); |
1910 if (new_target.is_valid()) { | 1908 if (new_target.is_valid()) { |
1911 Pop(new_target); | 1909 Pop(new_target); |
1912 } | 1910 } |
1913 if (actual.is_reg()) { | 1911 if (actual.is_reg()) { |
1914 Pop(actual.reg()); | 1912 Pop(actual.reg()); |
1915 SmiUntag(actual.reg()); | 1913 SmiUntag(actual.reg()); |
1916 } | 1914 } |
1917 if (expected.is_reg()) { | 1915 if (expected.is_reg()) { |
1918 Pop(expected.reg()); | 1916 Pop(expected.reg()); |
1919 SmiUntag(expected.reg()); | 1917 SmiUntag(expected.reg()); |
1920 } | 1918 } |
1921 } | 1919 } |
1922 bind(&skip_flooding); | 1920 bind(&skip_hook); |
1923 } | 1921 } |
1924 | 1922 |
1925 | 1923 |
1926 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, | 1924 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, |
1927 const ParameterCount& expected, | 1925 const ParameterCount& expected, |
1928 const ParameterCount& actual, | 1926 const ParameterCount& actual, |
1929 InvokeFlag flag, | 1927 InvokeFlag flag, |
1930 const CallWrapper& call_wrapper) { | 1928 const CallWrapper& call_wrapper) { |
1931 // You can't call a function without a valid frame. | 1929 // You can't call a function without a valid frame. |
1932 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 1930 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
1933 DCHECK(function.is(edi)); | 1931 DCHECK(function.is(edi)); |
1934 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(edx)); | 1932 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(edx)); |
1935 | 1933 |
1936 if (call_wrapper.NeedsDebugStepCheck()) { | 1934 if (call_wrapper.NeedsDebugHookCheck()) { |
1937 FloodFunctionIfStepping(function, new_target, expected, actual); | 1935 CheckDebugHook(function, new_target, expected, actual); |
1938 } | 1936 } |
1939 | 1937 |
1940 // Clear the new.target register if not given. | 1938 // Clear the new.target register if not given. |
1941 if (!new_target.is_valid()) { | 1939 if (!new_target.is_valid()) { |
1942 mov(edx, isolate()->factory()->undefined_value()); | 1940 mov(edx, isolate()->factory()->undefined_value()); |
1943 } | 1941 } |
1944 | 1942 |
1945 Label done; | 1943 Label done; |
1946 bool definitely_mismatches = false; | 1944 bool definitely_mismatches = false; |
1947 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, | 1945 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 mov(eax, dividend); | 2794 mov(eax, dividend); |
2797 shr(eax, 31); | 2795 shr(eax, 31); |
2798 add(edx, eax); | 2796 add(edx, eax); |
2799 } | 2797 } |
2800 | 2798 |
2801 | 2799 |
2802 } // namespace internal | 2800 } // namespace internal |
2803 } // namespace v8 | 2801 } // namespace v8 |
2804 | 2802 |
2805 #endif // V8_TARGET_ARCH_X87 | 2803 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |