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 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 if (FLAG_native_code_counters && counter->Enabled()) { | 4081 if (FLAG_native_code_counters && counter->Enabled()) { |
4082 Operand counter_operand = ExternalOperand(ExternalReference(counter)); | 4082 Operand counter_operand = ExternalOperand(ExternalReference(counter)); |
4083 if (value == 1) { | 4083 if (value == 1) { |
4084 decl(counter_operand); | 4084 decl(counter_operand); |
4085 } else { | 4085 } else { |
4086 subl(counter_operand, Immediate(value)); | 4086 subl(counter_operand, Immediate(value)); |
4087 } | 4087 } |
4088 } | 4088 } |
4089 } | 4089 } |
4090 | 4090 |
| 4091 void MacroAssembler::DebugBreak() { |
| 4092 Call(isolate()->builtins()->HandleDebuggerStatement(), |
| 4093 RelocInfo::DEBUGGER_STATEMENT); |
| 4094 } |
4091 | 4095 |
4092 void MacroAssembler::DebugBreak() { | 4096 void MacroAssembler::MaybeDropFrames() { |
4093 Set(rax, 0); // No arguments. | 4097 // Check whether we need to drop frames to restart a function on the stack. |
4094 LoadAddress(rbx, | 4098 ExternalReference restart_fp = |
4095 ExternalReference(Runtime::kHandleDebuggerStatement, isolate())); | 4099 ExternalReference::debug_restart_fp_address(isolate()); |
4096 CEntryStub ces(isolate(), 1); | 4100 Load(rbx, restart_fp); |
4097 DCHECK(AllowThisStubCall(&ces)); | 4101 testp(rbx, rbx); |
4098 Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT); | 4102 j(not_zero, isolate()->builtins()->FrameDropperTrampoline(), |
| 4103 RelocInfo::CODE_TARGET); |
4099 } | 4104 } |
4100 | 4105 |
4101 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count, | 4106 void MacroAssembler::PrepareForTailCall(const ParameterCount& callee_args_count, |
4102 Register caller_args_count_reg, | 4107 Register caller_args_count_reg, |
4103 Register scratch0, Register scratch1, | 4108 Register scratch0, Register scratch1, |
4104 ReturnAddressState ra_state) { | 4109 ReturnAddressState ra_state) { |
4105 #if DEBUG | 4110 #if DEBUG |
4106 if (callee_args_count.is_reg()) { | 4111 if (callee_args_count.is_reg()) { |
4107 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0, | 4112 DCHECK(!AreAliased(callee_args_count.reg(), caller_args_count_reg, scratch0, |
4108 scratch1)); | 4113 scratch1)); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4290 j(equal, &invoke, Label::kNear); | 4295 j(equal, &invoke, Label::kNear); |
4291 DCHECK(expected.reg().is(rbx)); | 4296 DCHECK(expected.reg().is(rbx)); |
4292 } else if (!expected.reg().is(actual.reg())) { | 4297 } else if (!expected.reg().is(actual.reg())) { |
4293 // Both expected and actual are in (different) registers. This | 4298 // Both expected and actual are in (different) registers. This |
4294 // is the case when we invoke functions using call and apply. | 4299 // is the case when we invoke functions using call and apply. |
4295 cmpp(expected.reg(), actual.reg()); | 4300 cmpp(expected.reg(), actual.reg()); |
4296 j(equal, &invoke, Label::kNear); | 4301 j(equal, &invoke, Label::kNear); |
4297 DCHECK(actual.reg().is(rax)); | 4302 DCHECK(actual.reg().is(rax)); |
4298 DCHECK(expected.reg().is(rbx)); | 4303 DCHECK(expected.reg().is(rbx)); |
4299 } else { | 4304 } else { |
| 4305 definitely_matches = true; |
4300 Move(rax, actual.reg()); | 4306 Move(rax, actual.reg()); |
4301 } | 4307 } |
4302 } | 4308 } |
4303 | 4309 |
4304 if (!definitely_matches) { | 4310 if (!definitely_matches) { |
4305 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 4311 Handle<Code> adaptor = isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
4306 if (flag == CALL_FUNCTION) { | 4312 if (flag == CALL_FUNCTION) { |
4307 call_wrapper.BeforeCall(CallSize(adaptor)); | 4313 call_wrapper.BeforeCall(CallSize(adaptor)); |
4308 Call(adaptor, RelocInfo::CODE_TARGET); | 4314 Call(adaptor, RelocInfo::CODE_TARGET); |
4309 call_wrapper.AfterCall(); | 4315 call_wrapper.AfterCall(); |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5302 movl(rax, dividend); | 5308 movl(rax, dividend); |
5303 shrl(rax, Immediate(31)); | 5309 shrl(rax, Immediate(31)); |
5304 addl(rdx, rax); | 5310 addl(rdx, rax); |
5305 } | 5311 } |
5306 | 5312 |
5307 | 5313 |
5308 } // namespace internal | 5314 } // namespace internal |
5309 } // namespace v8 | 5315 } // namespace v8 |
5310 | 5316 |
5311 #endif // V8_TARGET_ARCH_X64 | 5317 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |