| 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 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 4191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, | 4202 void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, |
| 4203 const ParameterCount& expected, | 4203 const ParameterCount& expected, |
| 4204 const ParameterCount& actual, | 4204 const ParameterCount& actual, |
| 4205 InvokeFlag flag, | 4205 InvokeFlag flag, |
| 4206 const CallWrapper& call_wrapper) { | 4206 const CallWrapper& call_wrapper) { |
| 4207 // You can't call a function without a valid frame. | 4207 // You can't call a function without a valid frame. |
| 4208 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4208 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4209 DCHECK(function.is(rdi)); | 4209 DCHECK(function.is(rdi)); |
| 4210 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(rdx)); | 4210 DCHECK_IMPLIES(new_target.is_valid(), new_target.is(rdx)); |
| 4211 | 4211 |
| 4212 if (call_wrapper.NeedsDebugStepCheck()) { | 4212 if (call_wrapper.NeedsDebugHookCheck()) { |
| 4213 FloodFunctionIfStepping(function, new_target, expected, actual); | 4213 CheckDebugHook(function, new_target, expected, actual); |
| 4214 } | 4214 } |
| 4215 | 4215 |
| 4216 // Clear the new.target register if not given. | 4216 // Clear the new.target register if not given. |
| 4217 if (!new_target.is_valid()) { | 4217 if (!new_target.is_valid()) { |
| 4218 LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | 4218 LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
| 4219 } | 4219 } |
| 4220 | 4220 |
| 4221 Label done; | 4221 Label done; |
| 4222 bool definitely_mismatches = false; | 4222 bool definitely_mismatches = false; |
| 4223 InvokePrologue(expected, | 4223 InvokePrologue(expected, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4303 if (!*definitely_mismatches) { | 4303 if (!*definitely_mismatches) { |
| 4304 jmp(done, near_jump); | 4304 jmp(done, near_jump); |
| 4305 } | 4305 } |
| 4306 } else { | 4306 } else { |
| 4307 Jump(adaptor, RelocInfo::CODE_TARGET); | 4307 Jump(adaptor, RelocInfo::CODE_TARGET); |
| 4308 } | 4308 } |
| 4309 bind(&invoke); | 4309 bind(&invoke); |
| 4310 } | 4310 } |
| 4311 } | 4311 } |
| 4312 | 4312 |
| 4313 | 4313 void MacroAssembler::CheckDebugHook(Register fun, Register new_target, |
| 4314 void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, | 4314 const ParameterCount& expected, |
| 4315 const ParameterCount& expected, | 4315 const ParameterCount& actual) { |
| 4316 const ParameterCount& actual) { | 4316 Label skip_hook; |
| 4317 Label skip_flooding; | 4317 ExternalReference debug_hook_active = |
| 4318 ExternalReference last_step_action = | 4318 ExternalReference::debug_hook_on_function_call_address(isolate()); |
| 4319 ExternalReference::debug_last_step_action_address(isolate()); | 4319 Operand debug_hook_active_operand = ExternalOperand(debug_hook_active); |
| 4320 Operand last_step_action_operand = ExternalOperand(last_step_action); | 4320 cmpb(debug_hook_active_operand, Immediate(0)); |
| 4321 STATIC_ASSERT(StepFrame > StepIn); | 4321 j(equal, &skip_hook); |
| 4322 cmpb(last_step_action_operand, Immediate(StepIn)); | |
| 4323 j(less, &skip_flooding); | |
| 4324 { | 4322 { |
| 4325 FrameScope frame(this, | 4323 FrameScope frame(this, |
| 4326 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); | 4324 has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); |
| 4327 if (expected.is_reg()) { | 4325 if (expected.is_reg()) { |
| 4328 Integer32ToSmi(expected.reg(), expected.reg()); | 4326 Integer32ToSmi(expected.reg(), expected.reg()); |
| 4329 Push(expected.reg()); | 4327 Push(expected.reg()); |
| 4330 } | 4328 } |
| 4331 if (actual.is_reg()) { | 4329 if (actual.is_reg()) { |
| 4332 Integer32ToSmi(actual.reg(), actual.reg()); | 4330 Integer32ToSmi(actual.reg(), actual.reg()); |
| 4333 Push(actual.reg()); | 4331 Push(actual.reg()); |
| 4334 } | 4332 } |
| 4335 if (new_target.is_valid()) { | 4333 if (new_target.is_valid()) { |
| 4336 Push(new_target); | 4334 Push(new_target); |
| 4337 } | 4335 } |
| 4338 Push(fun); | 4336 Push(fun); |
| 4339 Push(fun); | 4337 Push(fun); |
| 4340 CallRuntime(Runtime::kDebugPrepareStepInIfStepping); | 4338 CallRuntime(Runtime::kDebugOnFunctionCall); |
| 4341 Pop(fun); | 4339 Pop(fun); |
| 4342 if (new_target.is_valid()) { | 4340 if (new_target.is_valid()) { |
| 4343 Pop(new_target); | 4341 Pop(new_target); |
| 4344 } | 4342 } |
| 4345 if (actual.is_reg()) { | 4343 if (actual.is_reg()) { |
| 4346 Pop(actual.reg()); | 4344 Pop(actual.reg()); |
| 4347 SmiToInteger64(actual.reg(), actual.reg()); | 4345 SmiToInteger64(actual.reg(), actual.reg()); |
| 4348 } | 4346 } |
| 4349 if (expected.is_reg()) { | 4347 if (expected.is_reg()) { |
| 4350 Pop(expected.reg()); | 4348 Pop(expected.reg()); |
| 4351 SmiToInteger64(expected.reg(), expected.reg()); | 4349 SmiToInteger64(expected.reg(), expected.reg()); |
| 4352 } | 4350 } |
| 4353 } | 4351 } |
| 4354 bind(&skip_flooding); | 4352 bind(&skip_hook); |
| 4355 } | 4353 } |
| 4356 | 4354 |
| 4357 void MacroAssembler::StubPrologue(StackFrame::Type type) { | 4355 void MacroAssembler::StubPrologue(StackFrame::Type type) { |
| 4358 pushq(rbp); // Caller's frame pointer. | 4356 pushq(rbp); // Caller's frame pointer. |
| 4359 movp(rbp, rsp); | 4357 movp(rbp, rsp); |
| 4360 Push(Smi::FromInt(type)); | 4358 Push(Smi::FromInt(type)); |
| 4361 } | 4359 } |
| 4362 | 4360 |
| 4363 void MacroAssembler::Prologue(bool code_pre_aging) { | 4361 void MacroAssembler::Prologue(bool code_pre_aging) { |
| 4364 PredictableCodeSizeScope predictible_code_size_scope(this, | 4362 PredictableCodeSizeScope predictible_code_size_scope(this, |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5297 movl(rax, dividend); | 5295 movl(rax, dividend); |
| 5298 shrl(rax, Immediate(31)); | 5296 shrl(rax, Immediate(31)); |
| 5299 addl(rdx, rax); | 5297 addl(rdx, rax); |
| 5300 } | 5298 } |
| 5301 | 5299 |
| 5302 | 5300 |
| 5303 } // namespace internal | 5301 } // namespace internal |
| 5304 } // namespace v8 | 5302 } // namespace v8 |
| 5305 | 5303 |
| 5306 #endif // V8_TARGET_ARCH_X64 | 5304 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |