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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 if (!*definitely_mismatches) { | 1930 if (!*definitely_mismatches) { |
1931 jmp(done, done_near); | 1931 jmp(done, done_near); |
1932 } | 1932 } |
1933 } else { | 1933 } else { |
1934 jmp(adaptor, RelocInfo::CODE_TARGET); | 1934 jmp(adaptor, RelocInfo::CODE_TARGET); |
1935 } | 1935 } |
1936 bind(&invoke); | 1936 bind(&invoke); |
1937 } | 1937 } |
1938 } | 1938 } |
1939 | 1939 |
1940 | 1940 void MacroAssembler::CheckDebugHook(Register fun, Register new_target, |
1941 void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, | 1941 const ParameterCount& expected, |
1942 const ParameterCount& expected, | 1942 const ParameterCount& actual) { |
1943 const ParameterCount& actual) { | 1943 Label skip_hook; |
1944 Label skip_flooding; | 1944 ExternalReference debug_hook_active = |
1945 ExternalReference last_step_action = | 1945 ExternalReference::debug_hook_on_function_call_address(isolate()); |
1946 ExternalReference::debug_last_step_action_address(isolate()); | 1946 cmpb(Operand::StaticVariable(debug_hook_active), Immediate(0)); |
1947 STATIC_ASSERT(StepFrame > StepIn); | 1947 j(equal, &skip_hook); |
1948 cmpb(Operand::StaticVariable(last_step_action), Immediate(StepIn)); | |
1949 j(less, &skip_flooding); | |
1950 { | 1948 { |
1951 FrameScope frame(this, | 1949 FrameScope frame(this, |
1952 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); | 1950 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); |
1953 if (expected.is_reg()) { | 1951 if (expected.is_reg()) { |
1954 SmiTag(expected.reg()); | 1952 SmiTag(expected.reg()); |
1955 Push(expected.reg()); | 1953 Push(expected.reg()); |
1956 } | 1954 } |
1957 if (actual.is_reg()) { | 1955 if (actual.is_reg()) { |
1958 SmiTag(actual.reg()); | 1956 SmiTag(actual.reg()); |
1959 Push(actual.reg()); | 1957 Push(actual.reg()); |
1960 } | 1958 } |
1961 if (new_target.is_valid()) { | 1959 if (new_target.is_valid()) { |
1962 Push(new_target); | 1960 Push(new_target); |
1963 } | 1961 } |
1964 Push(fun); | 1962 Push(fun); |
1965 Push(fun); | 1963 Push(fun); |
1966 CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 1964 CallRuntime(Runtime::kDebugOnFunctionCall); |
1967 Pop(fun); | 1965 Pop(fun); |
1968 if (new_target.is_valid()) { | 1966 if (new_target.is_valid()) { |
1969 Pop(new_target); | 1967 Pop(new_target); |
1970 } | 1968 } |
1971 if (actual.is_reg()) { | 1969 if (actual.is_reg()) { |
1972 Pop(actual.reg()); | 1970 Pop(actual.reg()); |
1973 SmiUntag(actual.reg()); | 1971 SmiUntag(actual.reg()); |
1974 } | 1972 } |
1975 if (expected.is_reg()) { | 1973 if (expected.is_reg()) { |
1976 Pop(expected.reg()); | 1974 Pop(expected.reg()); |
1977 SmiUntag(expected.reg()); | 1975 SmiUntag(expected.reg()); |
1978 } | 1976 } |
1979 } | 1977 } |
1980 bind(&skip_flooding); | 1978 bind(&skip_hook); |
1981 } | 1979 } |
1982 | 1980 |
1983 | 1981 |
1984 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, | 1982 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, |
1985 const ParameterCount& expected, | 1983 const ParameterCount& expected, |
1986 const ParameterCount& actual, | 1984 const ParameterCount& actual, |
1987 InvokeFlag flag, | 1985 InvokeFlag flag, |
1988 const CallWrapper& call_wrapper) { | 1986 const CallWrapper& call_wrapper) { |
1989 // You can't call a function without a valid frame. | 1987 // You can't call a function without a valid frame. |
1990 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 1988 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
1991 DCHECK(function.is(edi)); | 1989 DCHECK(function.is(edi)); |
1992 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(edx)); | 1990 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(edx)); |
1993 | 1991 |
1994 if (call_wrapper.NeedsDebugStepCheck()) { | 1992 if (call_wrapper.NeedsDebugHookCheck()) { |
1995 FloodFunctionIfStepping(function, new_target, expected, actual); | 1993 CheckDebugHook(function, new_target, expected, actual); |
1996 } | 1994 } |
1997 | 1995 |
1998 // Clear the new.target register if not given. | 1996 // Clear the new.target register if not given. |
1999 if (!new_target.is_valid()) { | 1997 if (!new_target.is_valid()) { |
2000 mov(edx, isolate()->factory()->undefined_value()); | 1998 mov(edx, isolate()->factory()->undefined_value()); |
2001 } | 1999 } |
2002 | 2000 |
2003 Label done; | 2001 Label done; |
2004 bool definitely_mismatches = false; | 2002 bool definitely_mismatches = false; |
2005 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, | 2003 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 mov(eax, dividend); | 2947 mov(eax, dividend); |
2950 shr(eax, 31); | 2948 shr(eax, 31); |
2951 add(edx, eax); | 2949 add(edx, eax); |
2952 } | 2950 } |
2953 | 2951 |
2954 | 2952 |
2955 } // namespace internal | 2953 } // namespace internal |
2956 } // namespace v8 | 2954 } // namespace v8 |
2957 | 2955 |
2958 #endif // V8_TARGET_ARCH_IA32 | 2956 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |