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