| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 __ bind(&entry); | 336 __ bind(&entry); |
| 337 __ decq(rcx); | 337 __ decq(rcx); |
| 338 __ j(greater_equal, &loop); | 338 __ j(greater_equal, &loop); |
| 339 | 339 |
| 340 // Call the function. | 340 // Call the function. |
| 341 if (is_api_function) { | 341 if (is_api_function) { |
| 342 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 342 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 343 Handle<Code> code = | 343 Handle<Code> code = |
| 344 masm->isolate()->builtins()->HandleApiCallConstruct(); | 344 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 345 ParameterCount expected(0); | 345 ParameterCount expected(0); |
| 346 __ InvokeCode(code, expected, expected, | 346 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, |
| 347 RelocInfo::CODE_TARGET, CALL_FUNCTION); | 347 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 348 } else { | 348 } else { |
| 349 ParameterCount actual(rax); | 349 ParameterCount actual(rax); |
| 350 __ InvokeFunction(rdi, actual, CALL_FUNCTION); | 350 __ InvokeFunction(rdi, actual, CALL_FUNCTION, |
| 351 NullCallWrapper(), CALL_AS_METHOD); |
| 351 } | 352 } |
| 352 | 353 |
| 353 // Restore context from the frame. | 354 // Restore context from the frame. |
| 354 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 355 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 355 | 356 |
| 356 // If the result is an object (in the ECMA sense), we should get rid | 357 // If the result is an object (in the ECMA sense), we should get rid |
| 357 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 358 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 358 // on page 74. | 359 // on page 74. |
| 359 Label use_receiver, exit; | 360 Label use_receiver, exit; |
| 360 // If the result is a smi, it is *not* an object in the ECMA sense. | 361 // If the result is a smi, it is *not* an object in the ECMA sense. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 __ j(not_equal, &loop); | 493 __ j(not_equal, &loop); |
| 493 | 494 |
| 494 // Invoke the code. | 495 // Invoke the code. |
| 495 if (is_construct) { | 496 if (is_construct) { |
| 496 // Expects rdi to hold function pointer. | 497 // Expects rdi to hold function pointer. |
| 497 __ Call(masm->isolate()->builtins()->JSConstructCall(), | 498 __ Call(masm->isolate()->builtins()->JSConstructCall(), |
| 498 RelocInfo::CODE_TARGET); | 499 RelocInfo::CODE_TARGET); |
| 499 } else { | 500 } else { |
| 500 ParameterCount actual(rax); | 501 ParameterCount actual(rax); |
| 501 // Function must be in rdi. | 502 // Function must be in rdi. |
| 502 __ InvokeFunction(rdi, actual, CALL_FUNCTION); | 503 __ InvokeFunction(rdi, actual, CALL_FUNCTION, |
| 504 NullCallWrapper(), CALL_AS_METHOD); |
| 503 } | 505 } |
| 504 | 506 |
| 505 // Exit the JS frame. Notice that this also removes the empty | 507 // Exit the JS frame. Notice that this also removes the empty |
| 506 // context and the function left on the stack by the code | 508 // context and the function left on the stack by the code |
| 507 // invocation. | 509 // invocation. |
| 508 __ LeaveInternalFrame(); | 510 __ LeaveInternalFrame(); |
| 509 // TODO(X64): Is argument correct? Is there a receiver to remove? | 511 // TODO(X64): Is argument correct? Is there a receiver to remove? |
| 510 __ ret(1 * kPointerSize); // remove receiver | 512 __ ret(1 * kPointerSize); // remove receiver |
| 511 } | 513 } |
| 512 | 514 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 FieldOperand(rdx, | 769 FieldOperand(rdx, |
| 768 SharedFunctionInfo::kFormalParameterCountOffset)); | 770 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 769 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); | 771 __ movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset)); |
| 770 __ SetCallKind(rcx, CALL_AS_METHOD); | 772 __ SetCallKind(rcx, CALL_AS_METHOD); |
| 771 __ cmpq(rax, rbx); | 773 __ cmpq(rax, rbx); |
| 772 __ j(not_equal, | 774 __ j(not_equal, |
| 773 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 775 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 774 RelocInfo::CODE_TARGET); | 776 RelocInfo::CODE_TARGET); |
| 775 | 777 |
| 776 ParameterCount expected(0); | 778 ParameterCount expected(0); |
| 777 __ InvokeCode(rdx, expected, expected, JUMP_FUNCTION); | 779 __ InvokeCode(rdx, expected, expected, JUMP_FUNCTION, |
| 780 NullCallWrapper(), CALL_AS_METHOD); |
| 778 } | 781 } |
| 779 | 782 |
| 780 | 783 |
| 781 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 784 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 782 // Stack at entry: | 785 // Stack at entry: |
| 783 // rsp: return address | 786 // rsp: return address |
| 784 // rsp+8: arguments | 787 // rsp+8: arguments |
| 785 // rsp+16: receiver ("this") | 788 // rsp+16: receiver ("this") |
| 786 // rsp+24: function | 789 // rsp+24: function |
| 787 __ EnterInternalFrame(); | 790 __ EnterInternalFrame(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 __ movq(Operand(rbp, kIndexOffset), rax); | 910 __ movq(Operand(rbp, kIndexOffset), rax); |
| 908 | 911 |
| 909 __ bind(&entry); | 912 __ bind(&entry); |
| 910 __ cmpq(rax, Operand(rbp, kLimitOffset)); | 913 __ cmpq(rax, Operand(rbp, kLimitOffset)); |
| 911 __ j(not_equal, &loop); | 914 __ j(not_equal, &loop); |
| 912 | 915 |
| 913 // Invoke the function. | 916 // Invoke the function. |
| 914 ParameterCount actual(rax); | 917 ParameterCount actual(rax); |
| 915 __ SmiToInteger32(rax, rax); | 918 __ SmiToInteger32(rax, rax); |
| 916 __ movq(rdi, Operand(rbp, kFunctionOffset)); | 919 __ movq(rdi, Operand(rbp, kFunctionOffset)); |
| 917 __ InvokeFunction(rdi, actual, CALL_FUNCTION); | 920 __ InvokeFunction(rdi, actual, CALL_FUNCTION, |
| 921 NullCallWrapper(), CALL_AS_METHOD); |
| 918 | 922 |
| 919 __ LeaveInternalFrame(); | 923 __ LeaveInternalFrame(); |
| 920 __ ret(3 * kPointerSize); // remove function, receiver, and arguments | 924 __ ret(3 * kPointerSize); // remove function, receiver, and arguments |
| 921 } | 925 } |
| 922 | 926 |
| 923 | 927 |
| 924 // Number of empty elements to allocate for an empty array. | 928 // Number of empty elements to allocate for an empty array. |
| 925 static const int kPreallocatedArrayElements = 4; | 929 static const int kPreallocatedArrayElements = 4; |
| 926 | 930 |
| 927 | 931 |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1515 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1512 generator.Generate(); | 1516 generator.Generate(); |
| 1513 } | 1517 } |
| 1514 | 1518 |
| 1515 | 1519 |
| 1516 #undef __ | 1520 #undef __ |
| 1517 | 1521 |
| 1518 } } // namespace v8::internal | 1522 } } // namespace v8::internal |
| 1519 | 1523 |
| 1520 #endif // V8_TARGET_ARCH_X64 | 1524 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |