| 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 4362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4373 __ bind(&throw_termination_exception); | 4373 __ bind(&throw_termination_exception); |
| 4374 GenerateThrowUncatchable(masm, TERMINATION); | 4374 GenerateThrowUncatchable(masm, TERMINATION); |
| 4375 | 4375 |
| 4376 __ bind(&throw_normal_exception); | 4376 __ bind(&throw_normal_exception); |
| 4377 GenerateThrowTOS(masm); | 4377 GenerateThrowTOS(masm); |
| 4378 } | 4378 } |
| 4379 | 4379 |
| 4380 | 4380 |
| 4381 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 4381 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 4382 Label invoke, exit; | 4382 Label invoke, exit; |
| 4383 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 4384 Label not_outermost_js, not_outermost_js_2; | 4383 Label not_outermost_js, not_outermost_js_2; |
| 4385 #endif | |
| 4386 | 4384 |
| 4387 // Setup frame. | 4385 // Setup frame. |
| 4388 __ push(ebp); | 4386 __ push(ebp); |
| 4389 __ mov(ebp, Operand(esp)); | 4387 __ mov(ebp, Operand(esp)); |
| 4390 | 4388 |
| 4391 // Push marker in two places. | 4389 // Push marker in two places. |
| 4392 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 4390 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
| 4393 __ push(Immediate(Smi::FromInt(marker))); // context slot | 4391 __ push(Immediate(Smi::FromInt(marker))); // context slot |
| 4394 __ push(Immediate(Smi::FromInt(marker))); // function slot | 4392 __ push(Immediate(Smi::FromInt(marker))); // function slot |
| 4395 // Save callee-saved registers (C calling conventions). | 4393 // Save callee-saved registers (C calling conventions). |
| 4396 __ push(edi); | 4394 __ push(edi); |
| 4397 __ push(esi); | 4395 __ push(esi); |
| 4398 __ push(ebx); | 4396 __ push(ebx); |
| 4399 | 4397 |
| 4400 // Save copies of the top frame descriptor on the stack. | 4398 // Save copies of the top frame descriptor on the stack. |
| 4401 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, masm->isolate()); | 4399 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, masm->isolate()); |
| 4402 __ push(Operand::StaticVariable(c_entry_fp)); | 4400 __ push(Operand::StaticVariable(c_entry_fp)); |
| 4403 | 4401 |
| 4404 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 4405 // If this is the outermost JS call, set js_entry_sp value. | 4402 // If this is the outermost JS call, set js_entry_sp value. |
| 4406 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, | 4403 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, |
| 4407 masm->isolate()); | 4404 masm->isolate()); |
| 4408 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 4405 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 4409 __ j(not_equal, ¬_outermost_js); | 4406 __ j(not_equal, ¬_outermost_js); |
| 4410 __ mov(Operand::StaticVariable(js_entry_sp), ebp); | 4407 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
| 4411 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 4408 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 4412 Label cont; | 4409 Label cont; |
| 4413 __ jmp(&cont); | 4410 __ jmp(&cont); |
| 4414 __ bind(¬_outermost_js); | 4411 __ bind(¬_outermost_js); |
| 4415 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); | 4412 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); |
| 4416 __ bind(&cont); | 4413 __ bind(&cont); |
| 4417 #endif | |
| 4418 | 4414 |
| 4419 // Call a faked try-block that does the invoke. | 4415 // Call a faked try-block that does the invoke. |
| 4420 __ call(&invoke); | 4416 __ call(&invoke); |
| 4421 | 4417 |
| 4422 // Caught exception: Store result (exception) in the pending | 4418 // Caught exception: Store result (exception) in the pending |
| 4423 // exception field in the JSEnv and return a failure sentinel. | 4419 // exception field in the JSEnv and return a failure sentinel. |
| 4424 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 4420 ExternalReference pending_exception(Isolate::k_pending_exception_address, |
| 4425 masm->isolate()); | 4421 masm->isolate()); |
| 4426 __ mov(Operand::StaticVariable(pending_exception), eax); | 4422 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 4427 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4423 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4455 __ mov(edx, Immediate(entry)); | 4451 __ mov(edx, Immediate(entry)); |
| 4456 } | 4452 } |
| 4457 __ mov(edx, Operand(edx, 0)); // deref address | 4453 __ mov(edx, Operand(edx, 0)); // deref address |
| 4458 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 4454 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
| 4459 __ call(Operand(edx)); | 4455 __ call(Operand(edx)); |
| 4460 | 4456 |
| 4461 // Unlink this frame from the handler chain. | 4457 // Unlink this frame from the handler chain. |
| 4462 __ PopTryHandler(); | 4458 __ PopTryHandler(); |
| 4463 | 4459 |
| 4464 __ bind(&exit); | 4460 __ bind(&exit); |
| 4465 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 4466 // Check if the current stack frame is marked as the outermost JS frame. | 4461 // Check if the current stack frame is marked as the outermost JS frame. |
| 4467 __ pop(ebx); | 4462 __ pop(ebx); |
| 4468 __ cmp(Operand(ebx), | 4463 __ cmp(Operand(ebx), |
| 4469 Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 4464 Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 4470 __ j(not_equal, ¬_outermost_js_2); | 4465 __ j(not_equal, ¬_outermost_js_2); |
| 4471 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 4466 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 4472 __ bind(¬_outermost_js_2); | 4467 __ bind(¬_outermost_js_2); |
| 4473 #endif | |
| 4474 | 4468 |
| 4475 // Restore the top frame descriptor from the stack. | 4469 // Restore the top frame descriptor from the stack. |
| 4476 __ pop(Operand::StaticVariable(ExternalReference( | 4470 __ pop(Operand::StaticVariable(ExternalReference( |
| 4477 Isolate::k_c_entry_fp_address, | 4471 Isolate::k_c_entry_fp_address, |
| 4478 masm->isolate()))); | 4472 masm->isolate()))); |
| 4479 | 4473 |
| 4480 // Restore callee-saved registers (C calling conventions). | 4474 // Restore callee-saved registers (C calling conventions). |
| 4481 __ pop(ebx); | 4475 __ pop(ebx); |
| 4482 __ pop(esi); | 4476 __ pop(esi); |
| 4483 __ pop(edi); | 4477 __ pop(edi); |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6344 __ Drop(1); | 6338 __ Drop(1); |
| 6345 __ ret(2 * kPointerSize); | 6339 __ ret(2 * kPointerSize); |
| 6346 } | 6340 } |
| 6347 | 6341 |
| 6348 | 6342 |
| 6349 #undef __ | 6343 #undef __ |
| 6350 | 6344 |
| 6351 } } // namespace v8::internal | 6345 } } // namespace v8::internal |
| 6352 | 6346 |
| 6353 #endif // V8_TARGET_ARCH_IA32 | 6347 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |