| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 __ j(greater_equal, &exit, not_taken); | 291 __ j(greater_equal, &exit, not_taken); |
| 292 | 292 |
| 293 // Throw away the result of the constructor invocation and use the | 293 // Throw away the result of the constructor invocation and use the |
| 294 // on-stack receiver as the result. | 294 // on-stack receiver as the result. |
| 295 __ bind(&use_receiver); | 295 __ bind(&use_receiver); |
| 296 __ mov(eax, Operand(esp, 0)); | 296 __ mov(eax, Operand(esp, 0)); |
| 297 | 297 |
| 298 // Restore the arguments count and exit the internal frame. | 298 // Restore the arguments count and exit the internal frame. |
| 299 __ bind(&exit); | 299 __ bind(&exit); |
| 300 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count | 300 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count |
| 301 __ ExitInternalFrame(); | 301 __ LeaveInternalFrame(); |
| 302 | 302 |
| 303 // Remove caller arguments from the stack and return. | 303 // Remove caller arguments from the stack and return. |
| 304 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | 304 ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
| 305 __ pop(ecx); | 305 __ pop(ecx); |
| 306 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver | 306 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver |
| 307 __ push(ecx); | 307 __ push(ecx); |
| 308 __ ret(0); | 308 __ ret(0); |
| 309 | 309 |
| 310 // Compute the offset from the beginning of the JSConstructCall | 310 // Compute the offset from the beginning of the JSConstructCall |
| 311 // builtin code object to the return address after the call. | 311 // builtin code object to the return address after the call. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 __ call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), | 357 __ call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), |
| 358 code_target); | 358 code_target); |
| 359 } else { | 359 } else { |
| 360 ParameterCount actual(eax); | 360 ParameterCount actual(eax); |
| 361 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 361 __ InvokeFunction(edi, actual, CALL_FUNCTION); |
| 362 } | 362 } |
| 363 | 363 |
| 364 // Exit the JS frame. Notice that this also removes the empty | 364 // Exit the JS frame. Notice that this also removes the empty |
| 365 // context and the function left on the stack by the code | 365 // context and the function left on the stack by the code |
| 366 // invocation. | 366 // invocation. |
| 367 __ ExitInternalFrame(); | 367 __ LeaveInternalFrame(); |
| 368 __ ret(1 * kPointerSize); // remove receiver | 368 __ ret(1 * kPointerSize); // remove receiver |
| 369 } | 369 } |
| 370 | 370 |
| 371 | 371 |
| 372 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 372 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
| 373 Generate_JSEntryTrampolineHelper(masm, false); | 373 Generate_JSEntryTrampolineHelper(masm, false); |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 377 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 __ push(edi); // save edi across the call | 444 __ push(edi); // save edi across the call |
| 445 __ push(ebx); | 445 __ push(ebx); |
| 446 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 446 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 447 __ mov(Operand(ebx), eax); | 447 __ mov(Operand(ebx), eax); |
| 448 __ pop(edi); // restore edi after the call | 448 __ pop(edi); // restore edi after the call |
| 449 | 449 |
| 450 // Get the arguments count and untag it. | 450 // Get the arguments count and untag it. |
| 451 __ pop(eax); | 451 __ pop(eax); |
| 452 __ shr(eax, kSmiTagSize); | 452 __ shr(eax, kSmiTagSize); |
| 453 | 453 |
| 454 __ ExitInternalFrame(); | 454 __ LeaveInternalFrame(); |
| 455 __ jmp(&patch_receiver); | 455 __ jmp(&patch_receiver); |
| 456 | 456 |
| 457 // Use the global object from the called function as the receiver. | 457 // Use the global object from the called function as the receiver. |
| 458 __ bind(&use_global_receiver); | 458 __ bind(&use_global_receiver); |
| 459 const int kGlobalIndex = | 459 const int kGlobalIndex = |
| 460 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 460 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 461 __ mov(ebx, FieldOperand(esi, kGlobalIndex)); | 461 __ mov(ebx, FieldOperand(esi, kGlobalIndex)); |
| 462 | 462 |
| 463 __ bind(&patch_receiver); | 463 __ bind(&patch_receiver); |
| 464 __ mov(Operand(esp, eax, times_4, 0), ebx); | 464 __ mov(Operand(esp, eax, times_4, 0), ebx); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 __ bind(&entry); | 606 __ bind(&entry); |
| 607 __ cmp(eax, Operand(ebp, kLimitOffset)); | 607 __ cmp(eax, Operand(ebp, kLimitOffset)); |
| 608 __ j(not_equal, &loop); | 608 __ j(not_equal, &loop); |
| 609 | 609 |
| 610 // Invoke the function. | 610 // Invoke the function. |
| 611 ParameterCount actual(eax); | 611 ParameterCount actual(eax); |
| 612 __ shr(eax, kSmiTagSize); | 612 __ shr(eax, kSmiTagSize); |
| 613 __ mov(edi, Operand(ebp, 4 * kPointerSize)); | 613 __ mov(edi, Operand(ebp, 4 * kPointerSize)); |
| 614 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 614 __ InvokeFunction(edi, actual, CALL_FUNCTION); |
| 615 | 615 |
| 616 __ ExitInternalFrame(); | 616 __ LeaveInternalFrame(); |
| 617 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 617 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
| 618 } | 618 } |
| 619 | 619 |
| 620 | 620 |
| 621 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 621 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 622 __ push(ebp); | 622 __ push(ebp); |
| 623 __ mov(ebp, Operand(esp)); | 623 __ mov(ebp, Operand(esp)); |
| 624 | 624 |
| 625 // Store the arguments adaptor context sentinel. | 625 // Store the arguments adaptor context sentinel. |
| 626 __ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); | 626 __ push(Immediate(ArgumentsAdaptorFrame::SENTINEL)); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 __ mov(Operand(ebx), Immediate(ExternalReference::debug_break())); | 764 __ mov(Operand(ebx), Immediate(ExternalReference::debug_break())); |
| 765 | 765 |
| 766 CEntryDebugBreakStub ceb; | 766 CEntryDebugBreakStub ceb; |
| 767 __ CallStub(&ceb); | 767 __ CallStub(&ceb); |
| 768 | 768 |
| 769 // Restore the register values containing object pointers from the expression | 769 // Restore the register values containing object pointers from the expression |
| 770 // stack in the reverse order as they where pushed. | 770 // stack in the reverse order as they where pushed. |
| 771 __ PopRegistersToMemory(pointer_regs); | 771 __ PopRegistersToMemory(pointer_regs); |
| 772 | 772 |
| 773 // Get rid of the internal frame. | 773 // Get rid of the internal frame. |
| 774 __ ExitInternalFrame(); | 774 __ LeaveInternalFrame(); |
| 775 | 775 |
| 776 // If this call did not replace a call but patched other code then there will | 776 // If this call did not replace a call but patched other code then there will |
| 777 // be an unwanted return address left on the stack. Here we get rid of that. | 777 // be an unwanted return address left on the stack. Here we get rid of that. |
| 778 if (convert_call_to_jmp) { | 778 if (convert_call_to_jmp) { |
| 779 __ pop(eax); | 779 __ pop(eax); |
| 780 } | 780 } |
| 781 | 781 |
| 782 // Finally restore all registers. | 782 // Finally restore all registers. |
| 783 __ RestoreRegistersFromMemory(kJSCallerSaved); | 783 __ RestoreRegistersFromMemory(kJSCallerSaved); |
| 784 | 784 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). | 876 // Register state for stub CallFunction (from CallFunctionStub in ic-ia32.cc). |
| 877 // ----------- S t a t e ------------- | 877 // ----------- S t a t e ------------- |
| 878 // No registers used on entry. | 878 // No registers used on entry. |
| 879 // ----------------------------------- | 879 // ----------------------------------- |
| 880 Generate_DebugBreakCallHelper(masm, 0, false); | 880 Generate_DebugBreakCallHelper(masm, 0, false); |
| 881 } | 881 } |
| 882 | 882 |
| 883 #undef __ | 883 #undef __ |
| 884 | 884 |
| 885 } } // namespace v8::internal | 885 } } // namespace v8::internal |
| OLD | NEW |