| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5219 | 5219 |
| 5220 | 5220 |
| 5221 void CEntryStub::Generate(MacroAssembler* masm) { | 5221 void CEntryStub::Generate(MacroAssembler* masm) { |
| 5222 // eax: number of arguments including receiver | 5222 // eax: number of arguments including receiver |
| 5223 // ebx: pointer to C function (C callee-saved) | 5223 // ebx: pointer to C function (C callee-saved) |
| 5224 // ebp: frame pointer (restored after C call) | 5224 // ebp: frame pointer (restored after C call) |
| 5225 // esp: stack pointer (restored after C call) | 5225 // esp: stack pointer (restored after C call) |
| 5226 // esi: current context (C callee-saved) | 5226 // esi: current context (C callee-saved) |
| 5227 // edi: JS function of the caller (C callee-saved) | 5227 // edi: JS function of the caller (C callee-saved) |
| 5228 | 5228 |
| 5229 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 5230 |
| 5229 // NOTE: Invocations of builtins may return failure objects instead | 5231 // NOTE: Invocations of builtins may return failure objects instead |
| 5230 // of a proper result. The builtin entry handles this by performing | 5232 // of a proper result. The builtin entry handles this by performing |
| 5231 // a garbage collection and retrying the builtin (twice). | 5233 // a garbage collection and retrying the builtin (twice). |
| 5232 | 5234 |
| 5233 // Enter the exit frame that transitions from JavaScript to C++. | 5235 // Enter the exit frame that transitions from JavaScript to C++. |
| 5234 __ EnterExitFrame(save_doubles_ == kSaveFPRegs); | 5236 __ EnterExitFrame(save_doubles_ == kSaveFPRegs); |
| 5235 | 5237 |
| 5236 // eax: result parameter for PerformGC, if any (setup below) | 5238 // eax: result parameter for PerformGC, if any (setup below) |
| 5237 // ebx: pointer to builtin function (C callee-saved) | 5239 // ebx: pointer to builtin function (C callee-saved) |
| 5238 // ebp: frame pointer (restored after C call) | 5240 // ebp: frame pointer (restored after C call) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5292 | 5294 |
| 5293 __ bind(&throw_normal_exception); | 5295 __ bind(&throw_normal_exception); |
| 5294 __ Throw(eax); | 5296 __ Throw(eax); |
| 5295 } | 5297 } |
| 5296 | 5298 |
| 5297 | 5299 |
| 5298 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 5300 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 5299 Label invoke, handler_entry, exit; | 5301 Label invoke, handler_entry, exit; |
| 5300 Label not_outermost_js, not_outermost_js_2; | 5302 Label not_outermost_js, not_outermost_js_2; |
| 5301 | 5303 |
| 5304 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 5305 |
| 5302 // Set up frame. | 5306 // Set up frame. |
| 5303 __ push(ebp); | 5307 __ push(ebp); |
| 5304 __ mov(ebp, esp); | 5308 __ mov(ebp, esp); |
| 5305 | 5309 |
| 5306 // Push marker in two places. | 5310 // Push marker in two places. |
| 5307 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 5311 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
| 5308 __ push(Immediate(Smi::FromInt(marker))); // context slot | 5312 __ push(Immediate(Smi::FromInt(marker))); // context slot |
| 5309 __ push(Immediate(Smi::FromInt(marker))); // function slot | 5313 __ push(Immediate(Smi::FromInt(marker))); // function slot |
| 5310 // Save callee-saved registers (C calling conventions). | 5314 // Save callee-saved registers (C calling conventions). |
| 5311 __ push(edi); | 5315 __ push(edi); |
| (...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7852 | 7856 |
| 7853 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 7857 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 7854 if (entry_hook_ != NULL) { | 7858 if (entry_hook_ != NULL) { |
| 7855 ProfileEntryHookStub stub; | 7859 ProfileEntryHookStub stub; |
| 7856 masm->CallStub(&stub); | 7860 masm->CallStub(&stub); |
| 7857 } | 7861 } |
| 7858 } | 7862 } |
| 7859 | 7863 |
| 7860 | 7864 |
| 7861 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | 7865 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
| 7862 // Ecx is the only volatile register we must save. | 7866 // Save volatile registers. |
| 7863 const int kNumSavedRegisters = 1; | 7867 const int kNumSavedRegisters = 3; |
| 7868 __ push(eax); |
| 7864 __ push(ecx); | 7869 __ push(ecx); |
| 7870 __ push(edx); |
| 7865 | 7871 |
| 7866 // Calculate and push the original stack pointer. | 7872 // Calculate and push the original stack pointer. |
| 7867 __ lea(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); | 7873 __ lea(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); |
| 7868 __ push(eax); | 7874 __ push(eax); |
| 7869 | 7875 |
| 7870 // Retrieve our return address and use it to calculate the calling | 7876 // Retrieve our return address and use it to calculate the calling |
| 7871 // function's address. | 7877 // function's address. |
| 7872 __ mov(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); | 7878 __ mov(eax, Operand(esp, (kNumSavedRegisters + 1) * kPointerSize)); |
| 7873 __ sub(eax, Immediate(Assembler::kCallInstructionLength)); | 7879 __ sub(eax, Immediate(Assembler::kCallInstructionLength)); |
| 7874 __ push(eax); | 7880 __ push(eax); |
| 7875 | 7881 |
| 7876 // Call the entry hook. | 7882 // Call the entry hook. |
| 7877 int32_t hook_location = reinterpret_cast<int32_t>(&entry_hook_); | 7883 int32_t hook_location = |
| 7884 reinterpret_cast<int32_t>(&ProfileEntryHookStub::entry_hook_); |
| 7878 __ call(Operand(hook_location, RelocInfo::NONE32)); | 7885 __ call(Operand(hook_location, RelocInfo::NONE32)); |
| 7879 __ add(esp, Immediate(2 * kPointerSize)); | 7886 __ add(esp, Immediate(2 * kPointerSize)); |
| 7880 | 7887 |
| 7881 // Restore ecx. | 7888 // Restore ecx. |
| 7889 __ pop(edx); |
| 7882 __ pop(ecx); | 7890 __ pop(ecx); |
| 7891 __ pop(eax); |
| 7892 |
| 7883 __ ret(0); | 7893 __ ret(0); |
| 7884 } | 7894 } |
| 7885 | 7895 |
| 7886 | 7896 |
| 7887 template<class T> | 7897 template<class T> |
| 7888 static void CreateArrayDispatch(MacroAssembler* masm) { | 7898 static void CreateArrayDispatch(MacroAssembler* masm) { |
| 7889 int last_index = GetSequenceIndexFromFastElementsKind( | 7899 int last_index = GetSequenceIndexFromFastElementsKind( |
| 7890 TERMINAL_FAST_ELEMENTS_KIND); | 7900 TERMINAL_FAST_ELEMENTS_KIND); |
| 7891 for (int i = 0; i <= last_index; ++i) { | 7901 for (int i = 0; i <= last_index; ++i) { |
| 7892 Label next; | 7902 Label next; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8065 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 8075 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 8066 } | 8076 } |
| 8067 } | 8077 } |
| 8068 | 8078 |
| 8069 | 8079 |
| 8070 #undef __ | 8080 #undef __ |
| 8071 | 8081 |
| 8072 } } // namespace v8::internal | 8082 } } // namespace v8::internal |
| 8073 | 8083 |
| 8074 #endif // V8_TARGET_ARCH_IA32 | 8084 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |