| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 7141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7152 GenerateThrowOutOfMemory(masm); | 7152 GenerateThrowOutOfMemory(masm); |
| 7153 // control flow for generated will not return. | 7153 // control flow for generated will not return. |
| 7154 | 7154 |
| 7155 __ bind(&throw_normal_exception); | 7155 __ bind(&throw_normal_exception); |
| 7156 GenerateThrowTOS(masm); | 7156 GenerateThrowTOS(masm); |
| 7157 } | 7157 } |
| 7158 | 7158 |
| 7159 | 7159 |
| 7160 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 7160 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 7161 Label invoke, exit; | 7161 Label invoke, exit; |
| 7162 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 7163 Label not_outermost_js, not_outermost_js_2; |
| 7164 #endif |
| 7162 | 7165 |
| 7163 // Setup frame. | 7166 // Setup frame. |
| 7164 __ push(ebp); | 7167 __ push(ebp); |
| 7165 __ mov(ebp, Operand(esp)); | 7168 __ mov(ebp, Operand(esp)); |
| 7166 | 7169 |
| 7167 // Save callee-saved registers (C calling conventions). | 7170 // Save callee-saved registers (C calling conventions). |
| 7168 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 7171 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
| 7169 // Push something that is not an arguments adaptor. | 7172 // Push something that is not an arguments adaptor. |
| 7170 __ push(Immediate(~ArgumentsAdaptorFrame::SENTINEL)); | 7173 __ push(Immediate(~ArgumentsAdaptorFrame::SENTINEL)); |
| 7171 __ push(Immediate(Smi::FromInt(marker))); // @ function offset | 7174 __ push(Immediate(Smi::FromInt(marker))); // @ function offset |
| 7172 __ push(edi); | 7175 __ push(edi); |
| 7173 __ push(esi); | 7176 __ push(esi); |
| 7174 __ push(ebx); | 7177 __ push(ebx); |
| 7175 | 7178 |
| 7176 // Save copies of the top frame descriptor on the stack. | 7179 // Save copies of the top frame descriptor on the stack. |
| 7177 ExternalReference c_entry_fp(Top::k_c_entry_fp_address); | 7180 ExternalReference c_entry_fp(Top::k_c_entry_fp_address); |
| 7178 __ push(Operand::StaticVariable(c_entry_fp)); | 7181 __ push(Operand::StaticVariable(c_entry_fp)); |
| 7179 | 7182 |
| 7183 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 7184 // If this is the outermost JS call, set js_entry_sp value. |
| 7185 ExternalReference js_entry_sp(Top::k_js_entry_sp_address); |
| 7186 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 7187 __ j(NegateCondition(equal), ¬_outermost_js); |
| 7188 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
| 7189 __ bind(¬_outermost_js); |
| 7190 #endif |
| 7191 |
| 7180 // Call a faked try-block that does the invoke. | 7192 // Call a faked try-block that does the invoke. |
| 7181 __ call(&invoke); | 7193 __ call(&invoke); |
| 7182 | 7194 |
| 7183 // Caught exception: Store result (exception) in the pending | 7195 // Caught exception: Store result (exception) in the pending |
| 7184 // exception field in the JSEnv and return a failure sentinel. | 7196 // exception field in the JSEnv and return a failure sentinel. |
| 7185 ExternalReference pending_exception(Top::k_pending_exception_address); | 7197 ExternalReference pending_exception(Top::k_pending_exception_address); |
| 7186 __ mov(Operand::StaticVariable(pending_exception), eax); | 7198 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 7187 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 7199 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
| 7188 __ jmp(&exit); | 7200 __ jmp(&exit); |
| 7189 | 7201 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 7213 } | 7225 } |
| 7214 __ mov(edx, Operand(edx, 0)); // deref address | 7226 __ mov(edx, Operand(edx, 0)); // deref address |
| 7215 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 7227 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 7216 __ call(Operand(edx)); | 7228 __ call(Operand(edx)); |
| 7217 | 7229 |
| 7218 // Unlink this frame from the handler chain. | 7230 // Unlink this frame from the handler chain. |
| 7219 __ pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); | 7231 __ pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); |
| 7220 // Pop next_sp. | 7232 // Pop next_sp. |
| 7221 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); | 7233 __ add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); |
| 7222 | 7234 |
| 7235 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 7236 // If current EBP value is the same as js_entry_sp value, it means that |
| 7237 // the current function is the outermost. |
| 7238 __ cmp(ebp, Operand::StaticVariable(js_entry_sp)); |
| 7239 __ j(NegateCondition(equal), ¬_outermost_js_2); |
| 7240 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 7241 __ bind(¬_outermost_js_2); |
| 7242 #endif |
| 7243 |
| 7223 // Restore the top frame descriptor from the stack. | 7244 // Restore the top frame descriptor from the stack. |
| 7224 __ bind(&exit); | 7245 __ bind(&exit); |
| 7225 __ pop(Operand::StaticVariable(ExternalReference(Top::k_c_entry_fp_address))); | 7246 __ pop(Operand::StaticVariable(ExternalReference(Top::k_c_entry_fp_address))); |
| 7226 | 7247 |
| 7227 // Restore callee-saved registers (C calling conventions). | 7248 // Restore callee-saved registers (C calling conventions). |
| 7228 __ pop(ebx); | 7249 __ pop(ebx); |
| 7229 __ pop(esi); | 7250 __ pop(esi); |
| 7230 __ pop(edi); | 7251 __ pop(edi); |
| 7231 __ add(Operand(esp), Immediate(2 * kPointerSize)); // remove markers | 7252 __ add(Operand(esp), Immediate(2 * kPointerSize)); // remove markers |
| 7232 | 7253 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7289 | 7310 |
| 7290 // Slow-case: Go through the JavaScript implementation. | 7311 // Slow-case: Go through the JavaScript implementation. |
| 7291 __ bind(&slow); | 7312 __ bind(&slow); |
| 7292 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 7313 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 7293 } | 7314 } |
| 7294 | 7315 |
| 7295 | 7316 |
| 7296 #undef __ | 7317 #undef __ |
| 7297 | 7318 |
| 7298 } } // namespace v8::internal | 7319 } } // namespace v8::internal |
| OLD | NEW |