| OLD | NEW |
| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // arguments passed in because it is constant. At some point we | 379 // arguments passed in because it is constant. At some point we |
| 380 // should remove this need and make the runtime routine entry code | 380 // should remove this need and make the runtime routine entry code |
| 381 // smarter. | 381 // smarter. |
| 382 movq(rax, Immediate(num_arguments)); | 382 movq(rax, Immediate(num_arguments)); |
| 383 movq(rbx, ExternalReference(f)); | 383 movq(rbx, ExternalReference(f)); |
| 384 CEntryStub ces(f->result_size); | 384 CEntryStub ces(f->result_size); |
| 385 CallStub(&ces); | 385 CallStub(&ces); |
| 386 } | 386 } |
| 387 | 387 |
| 388 | 388 |
| 389 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
| 390 int num_arguments) { |
| 391 movq(rax, Immediate(num_arguments)); |
| 392 movq(rbx, ext); |
| 393 |
| 394 CEntryStub stub(1); |
| 395 CallStub(&stub); |
| 396 } |
| 397 |
| 398 |
| 389 void MacroAssembler::TailCallRuntime(ExternalReference const& ext, | 399 void MacroAssembler::TailCallRuntime(ExternalReference const& ext, |
| 390 int num_arguments, | 400 int num_arguments, |
| 391 int result_size) { | 401 int result_size) { |
| 392 // ----------- S t a t e ------------- | 402 // ----------- S t a t e ------------- |
| 393 // -- rsp[0] : return address | 403 // -- rsp[0] : return address |
| 394 // -- rsp[8] : argument num_arguments - 1 | 404 // -- rsp[8] : argument num_arguments - 1 |
| 395 // ... | 405 // ... |
| 396 // -- rsp[8 * num_arguments] : argument 0 (receiver) | 406 // -- rsp[8 * num_arguments] : argument 0 (receiver) |
| 397 // ----------------------------------- | 407 // ----------------------------------- |
| 398 | 408 |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); | 1895 movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
| 1886 // Advances rdx to the end of the Code object header, to the start of | 1896 // Advances rdx to the end of the Code object header, to the start of |
| 1887 // the executable code. | 1897 // the executable code. |
| 1888 lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); | 1898 lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
| 1889 | 1899 |
| 1890 ParameterCount expected(rbx); | 1900 ParameterCount expected(rbx); |
| 1891 InvokeCode(rdx, expected, actual, flag); | 1901 InvokeCode(rdx, expected, actual, flag); |
| 1892 } | 1902 } |
| 1893 | 1903 |
| 1894 | 1904 |
| 1905 void MacroAssembler::InvokeFunction(JSFunction* function, |
| 1906 const ParameterCount& actual) { |
| 1907 ASSERT(function->is_compiled()); |
| 1908 // Get the function and setup the context. |
| 1909 Move(rdi, Handle<JSFunction>(function)); |
| 1910 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 1911 |
| 1912 // Jump to the cached code (tail call). |
| 1913 Handle<Code> code(function->code()); |
| 1914 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 1915 InvokeCode(code, expected, actual, |
| 1916 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 1917 } |
| 1918 |
| 1919 |
| 1895 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 1920 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 1896 push(rbp); | 1921 push(rbp); |
| 1897 movq(rbp, rsp); | 1922 movq(rbp, rsp); |
| 1898 push(rsi); // Context. | 1923 push(rsi); // Context. |
| 1899 Push(Smi::FromInt(type)); | 1924 Push(Smi::FromInt(type)); |
| 1900 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); | 1925 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); |
| 1901 push(kScratchRegister); | 1926 push(kScratchRegister); |
| 1902 if (FLAG_debug_code) { | 1927 if (FLAG_debug_code) { |
| 1903 movq(kScratchRegister, | 1928 movq(kScratchRegister, |
| 1904 Factory::undefined_value(), | 1929 Factory::undefined_value(), |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2541 CodePatcher::~CodePatcher() { | 2566 CodePatcher::~CodePatcher() { |
| 2542 // Indicate that code has changed. | 2567 // Indicate that code has changed. |
| 2543 CPU::FlushICache(address_, size_); | 2568 CPU::FlushICache(address_, size_); |
| 2544 | 2569 |
| 2545 // Check that the code was patched as expected. | 2570 // Check that the code was patched as expected. |
| 2546 ASSERT(masm_.pc_ == address_ + size_); | 2571 ASSERT(masm_.pc_ == address_ + size_); |
| 2547 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2572 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2548 } | 2573 } |
| 2549 | 2574 |
| 2550 } } // namespace v8::internal | 2575 } } // namespace v8::internal |
| OLD | NEW |