| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 } | 321 } |
| 322 LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 322 LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 323 } | 323 } |
| 324 | 324 |
| 325 | 325 |
| 326 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { | 326 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { |
| 327 CallRuntime(Runtime::FunctionForId(id), num_arguments); | 327 CallRuntime(Runtime::FunctionForId(id), num_arguments); |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { | 331 void MacroAssembler::CallRuntime(const Runtime::Function* f, |
| 332 int num_arguments) { |
| 332 // If the expected number of arguments of the runtime function is | 333 // If the expected number of arguments of the runtime function is |
| 333 // constant, we check that the actual number of arguments match the | 334 // constant, we check that the actual number of arguments match the |
| 334 // expectation. | 335 // expectation. |
| 335 if (f->nargs >= 0 && f->nargs != num_arguments) { | 336 if (f->nargs >= 0 && f->nargs != num_arguments) { |
| 336 IllegalOperation(num_arguments); | 337 IllegalOperation(num_arguments); |
| 337 return; | 338 return; |
| 338 } | 339 } |
| 339 | 340 |
| 340 // TODO(1236192): Most runtime routines don't need the number of | 341 // TODO(1236192): Most runtime routines don't need the number of |
| 341 // arguments passed in because it is constant. At some point we | 342 // arguments passed in because it is constant. At some point we |
| (...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 // is the case when we invoke functions using call and apply. | 1922 // is the case when we invoke functions using call and apply. |
| 1922 cmpq(expected.reg(), actual.reg()); | 1923 cmpq(expected.reg(), actual.reg()); |
| 1923 j(equal, &invoke); | 1924 j(equal, &invoke); |
| 1924 ASSERT(actual.reg().is(rax)); | 1925 ASSERT(actual.reg().is(rax)); |
| 1925 ASSERT(expected.reg().is(rbx)); | 1926 ASSERT(expected.reg().is(rbx)); |
| 1926 } | 1927 } |
| 1927 } | 1928 } |
| 1928 | 1929 |
| 1929 if (!definitely_matches) { | 1930 if (!definitely_matches) { |
| 1930 Handle<Code> adaptor = | 1931 Handle<Code> adaptor = |
| 1931 Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); | 1932 Handle<Code>(Isolate::Current()->builtins()->builtin( |
| 1933 Builtins::ArgumentsAdaptorTrampoline)); |
| 1932 if (!code_constant.is_null()) { | 1934 if (!code_constant.is_null()) { |
| 1933 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); | 1935 movq(rdx, code_constant, RelocInfo::EMBEDDED_OBJECT); |
| 1934 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 1936 addq(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1935 } else if (!code_register.is(rdx)) { | 1937 } else if (!code_register.is(rdx)) { |
| 1936 movq(rdx, code_register); | 1938 movq(rdx, code_register); |
| 1937 } | 1939 } |
| 1938 | 1940 |
| 1939 if (flag == CALL_FUNCTION) { | 1941 if (flag == CALL_FUNCTION) { |
| 1940 Call(adaptor, RelocInfo::CODE_TARGET); | 1942 Call(adaptor, RelocInfo::CODE_TARGET); |
| 1941 jmp(done); | 1943 jmp(done); |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2713 CPU::FlushICache(address_, size_); | 2715 CPU::FlushICache(address_, size_); |
| 2714 | 2716 |
| 2715 // Check that the code was patched as expected. | 2717 // Check that the code was patched as expected. |
| 2716 ASSERT(masm_.pc_ == address_ + size_); | 2718 ASSERT(masm_.pc_ == address_ + size_); |
| 2717 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2719 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 2718 } | 2720 } |
| 2719 | 2721 |
| 2720 } } // namespace v8::internal | 2722 } } // namespace v8::internal |
| 2721 | 2723 |
| 2722 #endif // V8_TARGET_ARCH_X64 | 2724 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |