OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 if (and_then == kReturnAtEnd) { | 252 if (and_then == kReturnAtEnd) { |
253 Label buffer_overflowed; | 253 Label buffer_overflowed; |
254 j(not_equal, &buffer_overflowed, Label::kNear); | 254 j(not_equal, &buffer_overflowed, Label::kNear); |
255 ret(0); | 255 ret(0); |
256 bind(&buffer_overflowed); | 256 bind(&buffer_overflowed); |
257 } else { | 257 } else { |
258 ASSERT(and_then == kFallThroughAtEnd); | 258 ASSERT(and_then == kFallThroughAtEnd); |
259 j(equal, &done, Label::kNear); | 259 j(equal, &done, Label::kNear); |
260 } | 260 } |
261 StoreBufferOverflowStub store_buffer_overflow = | 261 StoreBufferOverflowStub store_buffer_overflow = |
262 StoreBufferOverflowStub(save_fp); | 262 StoreBufferOverflowStub(isolate(), save_fp); |
263 CallStub(&store_buffer_overflow); | 263 CallStub(&store_buffer_overflow); |
264 if (and_then == kReturnAtEnd) { | 264 if (and_then == kReturnAtEnd) { |
265 ret(0); | 265 ret(0); |
266 } else { | 266 } else { |
267 ASSERT(and_then == kFallThroughAtEnd); | 267 ASSERT(and_then == kFallThroughAtEnd); |
268 bind(&done); | 268 bind(&done); |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 | 272 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 &done, | 430 &done, |
431 Label::kNear); | 431 Label::kNear); |
432 | 432 |
433 CheckPageFlag(object, | 433 CheckPageFlag(object, |
434 value, // Used as scratch. | 434 value, // Used as scratch. |
435 MemoryChunk::kPointersFromHereAreInterestingMask, | 435 MemoryChunk::kPointersFromHereAreInterestingMask, |
436 zero, | 436 zero, |
437 &done, | 437 &done, |
438 Label::kNear); | 438 Label::kNear); |
439 | 439 |
440 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); | 440 RecordWriteStub stub(isolate(), object, value, address, remembered_set_action, |
| 441 fp_mode); |
441 CallStub(&stub); | 442 CallStub(&stub); |
442 | 443 |
443 bind(&done); | 444 bind(&done); |
444 | 445 |
445 // Clobber clobbered registers when running with the debug-code flag | 446 // Clobber clobbered registers when running with the debug-code flag |
446 // turned on to provoke errors. | 447 // turned on to provoke errors. |
447 if (emit_debug_code()) { | 448 if (emit_debug_code()) { |
448 Move(address, kZapValue, Assembler::RelocInfoNone()); | 449 Move(address, kZapValue, Assembler::RelocInfoNone()); |
449 Move(value, kZapValue, Assembler::RelocInfoNone()); | 450 Move(value, kZapValue, Assembler::RelocInfoNone()); |
450 } | 451 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 IllegalOperation(num_arguments); | 602 IllegalOperation(num_arguments); |
602 return; | 603 return; |
603 } | 604 } |
604 | 605 |
605 // TODO(1236192): Most runtime routines don't need the number of | 606 // TODO(1236192): Most runtime routines don't need the number of |
606 // arguments passed in because it is constant. At some point we | 607 // arguments passed in because it is constant. At some point we |
607 // should remove this need and make the runtime routine entry code | 608 // should remove this need and make the runtime routine entry code |
608 // smarter. | 609 // smarter. |
609 Set(rax, num_arguments); | 610 Set(rax, num_arguments); |
610 LoadAddress(rbx, ExternalReference(f, isolate())); | 611 LoadAddress(rbx, ExternalReference(f, isolate())); |
611 CEntryStub ces(f->result_size, save_doubles); | 612 CEntryStub ces(isolate(), f->result_size, save_doubles); |
612 CallStub(&ces); | 613 CallStub(&ces); |
613 } | 614 } |
614 | 615 |
615 | 616 |
616 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 617 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
617 int num_arguments) { | 618 int num_arguments) { |
618 Set(rax, num_arguments); | 619 Set(rax, num_arguments); |
619 LoadAddress(rbx, ext); | 620 LoadAddress(rbx, ext); |
620 | 621 |
621 CEntryStub stub(1); | 622 CEntryStub stub(isolate(), 1); |
622 CallStub(&stub); | 623 CallStub(&stub); |
623 } | 624 } |
624 | 625 |
625 | 626 |
626 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, | 627 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
627 int num_arguments, | 628 int num_arguments, |
628 int result_size) { | 629 int result_size) { |
629 // ----------- S t a t e ------------- | 630 // ----------- S t a t e ------------- |
630 // -- rsp[0] : return address | 631 // -- rsp[0] : return address |
631 // -- rsp[8] : argument num_arguments - 1 | 632 // -- rsp[8] : argument num_arguments - 1 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 call(rax); | 821 call(rax); |
821 movp(rax, prev_limit_reg); | 822 movp(rax, prev_limit_reg); |
822 jmp(&leave_exit_frame); | 823 jmp(&leave_exit_frame); |
823 } | 824 } |
824 | 825 |
825 | 826 |
826 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext, | 827 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext, |
827 int result_size) { | 828 int result_size) { |
828 // Set the entry point and jump to the C entry runtime stub. | 829 // Set the entry point and jump to the C entry runtime stub. |
829 LoadAddress(rbx, ext); | 830 LoadAddress(rbx, ext); |
830 CEntryStub ces(result_size); | 831 CEntryStub ces(isolate(), result_size); |
831 jmp(ces.GetCode(isolate()), RelocInfo::CODE_TARGET); | 832 jmp(ces.GetCode(isolate()), RelocInfo::CODE_TARGET); |
832 } | 833 } |
833 | 834 |
834 | 835 |
835 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 836 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, |
836 InvokeFlag flag, | 837 InvokeFlag flag, |
837 const CallWrapper& call_wrapper) { | 838 const CallWrapper& call_wrapper) { |
838 // You can't call a builtin without a valid frame. | 839 // You can't call a builtin without a valid frame. |
839 ASSERT(flag == JUMP_FUNCTION || has_frame()); | 840 ASSERT(flag == JUMP_FUNCTION || has_frame()); |
840 | 841 |
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3295 cmpq(src, Immediate(0xffffffff)); | 3296 cmpq(src, Immediate(0xffffffff)); |
3296 Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared); | 3297 Assert(below_equal, kInputGPRIsExpectedToHaveUpper32Cleared); |
3297 } | 3298 } |
3298 cvtqsi2sd(dst, src); | 3299 cvtqsi2sd(dst, src); |
3299 } | 3300 } |
3300 | 3301 |
3301 | 3302 |
3302 void MacroAssembler::SlowTruncateToI(Register result_reg, | 3303 void MacroAssembler::SlowTruncateToI(Register result_reg, |
3303 Register input_reg, | 3304 Register input_reg, |
3304 int offset) { | 3305 int offset) { |
3305 DoubleToIStub stub(input_reg, result_reg, offset, true); | 3306 DoubleToIStub stub(isolate(), input_reg, result_reg, offset, true); |
3306 call(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); | 3307 call(stub.GetCode(isolate()), RelocInfo::CODE_TARGET); |
3307 } | 3308 } |
3308 | 3309 |
3309 | 3310 |
3310 void MacroAssembler::TruncateHeapNumberToI(Register result_reg, | 3311 void MacroAssembler::TruncateHeapNumberToI(Register result_reg, |
3311 Register input_reg) { | 3312 Register input_reg) { |
3312 Label done; | 3313 Label done; |
3313 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 3314 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
3314 cvttsd2siq(result_reg, xmm0); | 3315 cvttsd2siq(result_reg, xmm0); |
3315 cmpq(result_reg, Immediate(1)); | 3316 cmpq(result_reg, Immediate(1)); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3688 subl(counter_operand, Immediate(value)); | 3689 subl(counter_operand, Immediate(value)); |
3689 } | 3690 } |
3690 } | 3691 } |
3691 } | 3692 } |
3692 | 3693 |
3693 | 3694 |
3694 #ifdef ENABLE_DEBUGGER_SUPPORT | 3695 #ifdef ENABLE_DEBUGGER_SUPPORT |
3695 void MacroAssembler::DebugBreak() { | 3696 void MacroAssembler::DebugBreak() { |
3696 Set(rax, 0); // No arguments. | 3697 Set(rax, 0); // No arguments. |
3697 LoadAddress(rbx, ExternalReference(Runtime::kDebugBreak, isolate())); | 3698 LoadAddress(rbx, ExternalReference(Runtime::kDebugBreak, isolate())); |
3698 CEntryStub ces(1); | 3699 CEntryStub ces(isolate(), 1); |
3699 ASSERT(AllowThisStubCall(&ces)); | 3700 ASSERT(AllowThisStubCall(&ces)); |
3700 Call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); | 3701 Call(ces.GetCode(isolate()), RelocInfo::DEBUG_BREAK); |
3701 } | 3702 } |
3702 #endif // ENABLE_DEBUGGER_SUPPORT | 3703 #endif // ENABLE_DEBUGGER_SUPPORT |
3703 | 3704 |
3704 | 3705 |
3705 void MacroAssembler::InvokeCode(Register code, | 3706 void MacroAssembler::InvokeCode(Register code, |
3706 const ParameterCount& expected, | 3707 const ParameterCount& expected, |
3707 const ParameterCount& actual, | 3708 const ParameterCount& actual, |
3708 InvokeFlag flag, | 3709 InvokeFlag flag, |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5203 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); | 5204 if (ms.shift() > 0) sarl(rdx, Immediate(ms.shift())); |
5204 movl(rax, dividend); | 5205 movl(rax, dividend); |
5205 shrl(rax, Immediate(31)); | 5206 shrl(rax, Immediate(31)); |
5206 addl(rdx, rax); | 5207 addl(rdx, rax); |
5207 } | 5208 } |
5208 | 5209 |
5209 | 5210 |
5210 } } // namespace v8::internal | 5211 } } // namespace v8::internal |
5211 | 5212 |
5212 #endif // V8_TARGET_ARCH_X64 | 5213 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |