| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 __ bind(&entry); | 333 __ bind(&entry); |
| 334 __ dec(ecx); | 334 __ dec(ecx); |
| 335 __ j(greater_equal, &loop); | 335 __ j(greater_equal, &loop); |
| 336 | 336 |
| 337 // Call the function. | 337 // Call the function. |
| 338 if (is_api_function) { | 338 if (is_api_function) { |
| 339 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 339 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 340 Handle<Code> code = | 340 Handle<Code> code = |
| 341 masm->isolate()->builtins()->HandleApiCallConstruct(); | 341 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 342 ParameterCount expected(0); | 342 ParameterCount expected(0); |
| 343 __ InvokeCode(code, expected, expected, | 343 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, |
| 344 RelocInfo::CODE_TARGET, CALL_FUNCTION); | 344 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 345 } else { | 345 } else { |
| 346 ParameterCount actual(eax); | 346 ParameterCount actual(eax); |
| 347 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 347 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 348 NullCallWrapper(), CALL_AS_METHOD); |
| 348 } | 349 } |
| 349 | 350 |
| 350 // Restore context from the frame. | 351 // Restore context from the frame. |
| 351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 352 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 352 | 353 |
| 353 // If the result is an object (in the ECMA sense), we should get rid | 354 // If the result is an object (in the ECMA sense), we should get rid |
| 354 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 355 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 355 // on page 74. | 356 // on page 74. |
| 356 Label use_receiver, exit; | 357 Label use_receiver, exit; |
| 357 | 358 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 437 |
| 437 // Get the function from the stack and call it. | 438 // Get the function from the stack and call it. |
| 438 __ mov(edi, Operand(esp, eax, times_4, +1 * kPointerSize)); // +1 ~ receiver | 439 __ mov(edi, Operand(esp, eax, times_4, +1 * kPointerSize)); // +1 ~ receiver |
| 439 | 440 |
| 440 // Invoke the code. | 441 // Invoke the code. |
| 441 if (is_construct) { | 442 if (is_construct) { |
| 442 __ call(masm->isolate()->builtins()->JSConstructCall(), | 443 __ call(masm->isolate()->builtins()->JSConstructCall(), |
| 443 RelocInfo::CODE_TARGET); | 444 RelocInfo::CODE_TARGET); |
| 444 } else { | 445 } else { |
| 445 ParameterCount actual(eax); | 446 ParameterCount actual(eax); |
| 446 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 447 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 448 NullCallWrapper(), CALL_AS_METHOD); |
| 447 } | 449 } |
| 448 | 450 |
| 449 // Exit the JS frame. Notice that this also removes the empty | 451 // Exit the JS frame. Notice that this also removes the empty |
| 450 // context and the function left on the stack by the code | 452 // context and the function left on the stack by the code |
| 451 // invocation. | 453 // invocation. |
| 452 __ LeaveInternalFrame(); | 454 __ LeaveInternalFrame(); |
| 453 __ ret(1 * kPointerSize); // remove receiver | 455 __ ret(1 * kPointerSize); // remove receiver |
| 454 } | 456 } |
| 455 | 457 |
| 456 | 458 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 __ mov(ebx, | 710 __ mov(ebx, |
| 709 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); | 711 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 710 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); | 712 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
| 711 __ SmiUntag(ebx); | 713 __ SmiUntag(ebx); |
| 712 __ SetCallKind(ecx, CALL_AS_METHOD); | 714 __ SetCallKind(ecx, CALL_AS_METHOD); |
| 713 __ cmp(eax, Operand(ebx)); | 715 __ cmp(eax, Operand(ebx)); |
| 714 __ j(not_equal, | 716 __ j(not_equal, |
| 715 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); | 717 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); |
| 716 | 718 |
| 717 ParameterCount expected(0); | 719 ParameterCount expected(0); |
| 718 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION); | 720 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION, |
| 721 NullCallWrapper(), CALL_AS_METHOD); |
| 719 } | 722 } |
| 720 | 723 |
| 721 | 724 |
| 722 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 725 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 723 __ EnterInternalFrame(); | 726 __ EnterInternalFrame(); |
| 724 | 727 |
| 725 __ push(Operand(ebp, 4 * kPointerSize)); // push this | 728 __ push(Operand(ebp, 4 * kPointerSize)); // push this |
| 726 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments | 729 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments |
| 727 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 730 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); |
| 728 | 731 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 __ mov(Operand(ebp, kIndexOffset), eax); | 841 __ mov(Operand(ebp, kIndexOffset), eax); |
| 839 | 842 |
| 840 __ bind(&entry); | 843 __ bind(&entry); |
| 841 __ cmp(eax, Operand(ebp, kLimitOffset)); | 844 __ cmp(eax, Operand(ebp, kLimitOffset)); |
| 842 __ j(not_equal, &loop); | 845 __ j(not_equal, &loop); |
| 843 | 846 |
| 844 // Invoke the function. | 847 // Invoke the function. |
| 845 ParameterCount actual(eax); | 848 ParameterCount actual(eax); |
| 846 __ SmiUntag(eax); | 849 __ SmiUntag(eax); |
| 847 __ mov(edi, Operand(ebp, 4 * kPointerSize)); | 850 __ mov(edi, Operand(ebp, 4 * kPointerSize)); |
| 848 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 851 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 852 NullCallWrapper(), CALL_AS_METHOD); |
| 849 | 853 |
| 850 __ LeaveInternalFrame(); | 854 __ LeaveInternalFrame(); |
| 851 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 855 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
| 852 } | 856 } |
| 853 | 857 |
| 854 | 858 |
| 855 // Number of empty elements to allocate for an empty array. | 859 // Number of empty elements to allocate for an empty array. |
| 856 static const int kPreallocatedArrayElements = 4; | 860 static const int kPreallocatedArrayElements = 4; |
| 857 | 861 |
| 858 | 862 |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1616 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1613 generator.Generate(); | 1617 generator.Generate(); |
| 1614 } | 1618 } |
| 1615 | 1619 |
| 1616 | 1620 |
| 1617 #undef __ | 1621 #undef __ |
| 1618 } | 1622 } |
| 1619 } // namespace v8::internal | 1623 } // namespace v8::internal |
| 1620 | 1624 |
| 1621 #endif // V8_TARGET_ARCH_IA32 | 1625 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |