Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 171107: X64: Implement debugger hooks. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)), 255 reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)),
256 RelocInfo::NONE); 256 RelocInfo::NONE);
257 push(kScratchRegister); 257 push(kScratchRegister);
258 CallRuntime(Runtime::kAbort, 2); 258 CallRuntime(Runtime::kAbort, 2);
259 // will not return here 259 // will not return here
260 } 260 }
261 261
262 262
263 void MacroAssembler::CallStub(CodeStub* stub) { 263 void MacroAssembler::CallStub(CodeStub* stub) {
264 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 264 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
265 movq(kScratchRegister, stub->GetCode(), RelocInfo::CODE_TARGET); 265 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
266 call(kScratchRegister);
267 } 266 }
268 267
269 268
270 void MacroAssembler::StubReturn(int argc) { 269 void MacroAssembler::StubReturn(int argc) {
271 ASSERT(argc >= 1 && generating_stub()); 270 ASSERT(argc >= 1 && generating_stub());
272 ret((argc - 1) * kPointerSize); 271 ret((argc - 1) * kPointerSize);
273 } 272 }
274 273
275 274
276 void MacroAssembler::IllegalOperation(int num_arguments) { 275 void MacroAssembler::IllegalOperation(int num_arguments) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 487 }
489 488
490 489
491 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { 490 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
492 movq(kScratchRegister, destination, rmode); 491 movq(kScratchRegister, destination, rmode);
493 jmp(kScratchRegister); 492 jmp(kScratchRegister);
494 } 493 }
495 494
496 495
497 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { 496 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) {
498 WriteRecordedPositions();
William Hesse 2009/08/19 08:44:00 How can it be correct to remove this?
Lasse Reichstein 2009/08/19 10:12:32 It's correct in the sense that it matches what we
499 ASSERT(RelocInfo::IsCodeTarget(rmode)); 497 ASSERT(RelocInfo::IsCodeTarget(rmode));
500 movq(kScratchRegister, code_object, rmode); 498 movq(kScratchRegister, code_object, rmode);
501 #ifdef DEBUG 499 #ifdef DEBUG
502 Label target; 500 Label target;
503 bind(&target); 501 bind(&target);
504 #endif 502 #endif
505 jmp(kScratchRegister); 503 jmp(kScratchRegister);
506 #ifdef DEBUG 504 #ifdef DEBUG
507 ASSERT_EQ(kTargetAddrToReturnAddrDist, 505 ASSERT_EQ(kTargetAddrToReturnAddrDist,
508 SizeOfCodeGeneratedSince(&target) + kPointerSize); 506 SizeOfCodeGeneratedSince(&target) + kPointerSize);
509 #endif 507 #endif
510 } 508 }
511 509
512 510
513 void MacroAssembler::Call(ExternalReference ext) { 511 void MacroAssembler::Call(ExternalReference ext) {
514 movq(kScratchRegister, ext); 512 movq(kScratchRegister, ext);
515 call(kScratchRegister); 513 call(kScratchRegister);
516 } 514 }
517 515
518 516
519 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { 517 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
520 movq(kScratchRegister, destination, rmode); 518 movq(kScratchRegister, destination, rmode);
521 call(kScratchRegister); 519 call(kScratchRegister);
522 } 520 }
523 521
524 522
525 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { 523 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) {
524 ASSERT(RelocInfo::IsCodeTarget(rmode));
526 WriteRecordedPositions(); 525 WriteRecordedPositions();
527 ASSERT(RelocInfo::IsCodeTarget(rmode));
528 movq(kScratchRegister, code_object, rmode); 526 movq(kScratchRegister, code_object, rmode);
529 #ifdef DEBUG 527 #ifdef DEBUG
530 // Patch target is kPointer size bytes *before* target label. 528 // Patch target is kPointer size bytes *before* target label.
531 Label target; 529 Label target;
532 bind(&target); 530 bind(&target);
533 #endif 531 #endif
534 call(kScratchRegister); 532 call(kScratchRegister);
535 #ifdef DEBUG 533 #ifdef DEBUG
536 ASSERT_EQ(kTargetAddrToReturnAddrDist, 534 ASSERT_EQ(kTargetAddrToReturnAddrDist,
537 SizeOfCodeGeneratedSince(&target) + kPointerSize); 535 SizeOfCodeGeneratedSince(&target) + kPointerSize);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 if (!definitely_matches) { 850 if (!definitely_matches) {
853 Handle<Code> adaptor = 851 Handle<Code> adaptor =
854 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 852 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline));
855 if (!code_constant.is_null()) { 853 if (!code_constant.is_null()) {
856 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); 854 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT);
857 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 855 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
858 } else if (!code_register.is(rdx)) { 856 } else if (!code_register.is(rdx)) {
859 movq(rdx, code_register); 857 movq(rdx, code_register);
860 } 858 }
861 859
862 movq(kScratchRegister, adaptor, RelocInfo::CODE_TARGET);
863 if (flag == CALL_FUNCTION) { 860 if (flag == CALL_FUNCTION) {
864 call(kScratchRegister); 861 Call(adaptor, RelocInfo::CODE_TARGET);
865 jmp(done); 862 jmp(done);
866 } else { 863 } else {
867 jmp(kScratchRegister); 864 Jump(adaptor, RelocInfo::CODE_TARGET);
868 } 865 }
869 bind(&invoke); 866 bind(&invoke);
870 } 867 }
871 } 868 }
872 869
873 870
874 void MacroAssembler::InvokeCode(Register code, 871 void MacroAssembler::InvokeCode(Register code,
875 const ParameterCount& expected, 872 const ParameterCount& expected,
876 const ParameterCount& actual, 873 const ParameterCount& actual,
877 InvokeFlag flag) { 874 InvokeFlag flag) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 Context::SECURITY_TOKEN_INDEX * kPointerSize; 1195 Context::SECURITY_TOKEN_INDEX * kPointerSize;
1199 movq(scratch, FieldOperand(scratch, token_offset)); 1196 movq(scratch, FieldOperand(scratch, token_offset));
1200 cmpq(scratch, FieldOperand(kScratchRegister, token_offset)); 1197 cmpq(scratch, FieldOperand(kScratchRegister, token_offset));
1201 j(not_equal, miss); 1198 j(not_equal, miss);
1202 1199
1203 bind(&same_contexts); 1200 bind(&same_contexts);
1204 } 1201 }
1205 1202
1206 1203
1207 } } // namespace v8::internal 1204 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698