| 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 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3544 Label failure; | 3544 Label failure; |
| 3545 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); | 3545 __ cmp(eax, NativeRegExpMacroAssembler::FAILURE); |
| 3546 __ j(equal, &failure); | 3546 __ j(equal, &failure); |
| 3547 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); | 3547 __ cmp(eax, NativeRegExpMacroAssembler::EXCEPTION); |
| 3548 // If not exception it can only be retry. Handle that in the runtime system. | 3548 // If not exception it can only be retry. Handle that in the runtime system. |
| 3549 __ j(not_equal, &runtime); | 3549 __ j(not_equal, &runtime); |
| 3550 // Result must now be exception. If there is no pending exception already a | 3550 // Result must now be exception. If there is no pending exception already a |
| 3551 // stack overflow (on the backtrack stack) was detected in RegExp code but | 3551 // stack overflow (on the backtrack stack) was detected in RegExp code but |
| 3552 // haven't created the exception yet. Handle that in the runtime system. | 3552 // haven't created the exception yet. Handle that in the runtime system. |
| 3553 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 3553 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
| 3554 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 3554 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 3555 masm->isolate()); | 3555 masm->isolate()); |
| 3556 __ mov(edx, | 3556 __ mov(edx, |
| 3557 Operand::StaticVariable(ExternalReference::the_hole_value_location( | 3557 Operand::StaticVariable(ExternalReference::the_hole_value_location( |
| 3558 masm->isolate()))); | 3558 masm->isolate()))); |
| 3559 __ mov(eax, Operand::StaticVariable(pending_exception)); | 3559 __ mov(eax, Operand::StaticVariable(pending_exception)); |
| 3560 __ cmp(edx, Operand(eax)); | 3560 __ cmp(edx, Operand(eax)); |
| 3561 __ j(equal, &runtime); | 3561 __ j(equal, &runtime); |
| 3562 // For exception, throw the exception again. | 3562 // For exception, throw the exception again. |
| 3563 | 3563 |
| 3564 // Clear the pending exception variable. | 3564 // Clear the pending exception variable. |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4334 | 4334 |
| 4335 // Check for failure result. | 4335 // Check for failure result. |
| 4336 Label failure_returned; | 4336 Label failure_returned; |
| 4337 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 4337 STATIC_ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
| 4338 __ lea(ecx, Operand(eax, 1)); | 4338 __ lea(ecx, Operand(eax, 1)); |
| 4339 // Lower 2 bits of ecx are 0 iff eax has failure tag. | 4339 // Lower 2 bits of ecx are 0 iff eax has failure tag. |
| 4340 __ test(ecx, Immediate(kFailureTagMask)); | 4340 __ test(ecx, Immediate(kFailureTagMask)); |
| 4341 __ j(zero, &failure_returned); | 4341 __ j(zero, &failure_returned); |
| 4342 | 4342 |
| 4343 ExternalReference pending_exception_address( | 4343 ExternalReference pending_exception_address( |
| 4344 Isolate::k_pending_exception_address, masm->isolate()); | 4344 Isolate::kPendingExceptionAddress, masm->isolate()); |
| 4345 | 4345 |
| 4346 // Check that there is no pending exception, otherwise we | 4346 // Check that there is no pending exception, otherwise we |
| 4347 // should have returned some failure value. | 4347 // should have returned some failure value. |
| 4348 if (FLAG_debug_code) { | 4348 if (FLAG_debug_code) { |
| 4349 __ push(edx); | 4349 __ push(edx); |
| 4350 __ mov(edx, Operand::StaticVariable( | 4350 __ mov(edx, Operand::StaticVariable( |
| 4351 ExternalReference::the_hole_value_location(masm->isolate()))); | 4351 ExternalReference::the_hole_value_location(masm->isolate()))); |
| 4352 Label okay; | 4352 Label okay; |
| 4353 __ cmp(edx, Operand::StaticVariable(pending_exception_address)); | 4353 __ cmp(edx, Operand::StaticVariable(pending_exception_address)); |
| 4354 // Cannot use check here as it attempts to generate call into runtime. | 4354 // Cannot use check here as it attempts to generate call into runtime. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4475 // Push marker in two places. | 4475 // Push marker in two places. |
| 4476 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 4476 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
| 4477 __ push(Immediate(Smi::FromInt(marker))); // context slot | 4477 __ push(Immediate(Smi::FromInt(marker))); // context slot |
| 4478 __ push(Immediate(Smi::FromInt(marker))); // function slot | 4478 __ push(Immediate(Smi::FromInt(marker))); // function slot |
| 4479 // Save callee-saved registers (C calling conventions). | 4479 // Save callee-saved registers (C calling conventions). |
| 4480 __ push(edi); | 4480 __ push(edi); |
| 4481 __ push(esi); | 4481 __ push(esi); |
| 4482 __ push(ebx); | 4482 __ push(ebx); |
| 4483 | 4483 |
| 4484 // Save copies of the top frame descriptor on the stack. | 4484 // Save copies of the top frame descriptor on the stack. |
| 4485 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, masm->isolate()); | 4485 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, masm->isolate()); |
| 4486 __ push(Operand::StaticVariable(c_entry_fp)); | 4486 __ push(Operand::StaticVariable(c_entry_fp)); |
| 4487 | 4487 |
| 4488 // If this is the outermost JS call, set js_entry_sp value. | 4488 // If this is the outermost JS call, set js_entry_sp value. |
| 4489 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, | 4489 ExternalReference js_entry_sp(Isolate::kJSEntrySPAddress, |
| 4490 masm->isolate()); | 4490 masm->isolate()); |
| 4491 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 4491 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 4492 __ j(not_equal, ¬_outermost_js, Label::kNear); | 4492 __ j(not_equal, ¬_outermost_js, Label::kNear); |
| 4493 __ mov(Operand::StaticVariable(js_entry_sp), ebp); | 4493 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
| 4494 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 4494 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 4495 Label cont; | 4495 Label cont; |
| 4496 __ jmp(&cont, Label::kNear); | 4496 __ jmp(&cont, Label::kNear); |
| 4497 __ bind(¬_outermost_js); | 4497 __ bind(¬_outermost_js); |
| 4498 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); | 4498 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); |
| 4499 __ bind(&cont); | 4499 __ bind(&cont); |
| 4500 | 4500 |
| 4501 // Call a faked try-block that does the invoke. | 4501 // Call a faked try-block that does the invoke. |
| 4502 __ call(&invoke); | 4502 __ call(&invoke); |
| 4503 | 4503 |
| 4504 // Caught exception: Store result (exception) in the pending | 4504 // Caught exception: Store result (exception) in the pending |
| 4505 // exception field in the JSEnv and return a failure sentinel. | 4505 // exception field in the JSEnv and return a failure sentinel. |
| 4506 ExternalReference pending_exception(Isolate::k_pending_exception_address, | 4506 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
| 4507 masm->isolate()); | 4507 masm->isolate()); |
| 4508 __ mov(Operand::StaticVariable(pending_exception), eax); | 4508 __ mov(Operand::StaticVariable(pending_exception), eax); |
| 4509 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4509 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
| 4510 __ jmp(&exit); | 4510 __ jmp(&exit); |
| 4511 | 4511 |
| 4512 // Invoke: Link this frame into the handler chain. | 4512 // Invoke: Link this frame into the handler chain. |
| 4513 __ bind(&invoke); | 4513 __ bind(&invoke); |
| 4514 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 4514 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); |
| 4515 | 4515 |
| 4516 // Clear any pending exceptions. | 4516 // Clear any pending exceptions. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 4547 // Check if the current stack frame is marked as the outermost JS frame. | 4547 // Check if the current stack frame is marked as the outermost JS frame. |
| 4548 __ pop(ebx); | 4548 __ pop(ebx); |
| 4549 __ cmp(Operand(ebx), | 4549 __ cmp(Operand(ebx), |
| 4550 Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 4550 Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 4551 __ j(not_equal, ¬_outermost_js_2); | 4551 __ j(not_equal, ¬_outermost_js_2); |
| 4552 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 4552 __ mov(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
| 4553 __ bind(¬_outermost_js_2); | 4553 __ bind(¬_outermost_js_2); |
| 4554 | 4554 |
| 4555 // Restore the top frame descriptor from the stack. | 4555 // Restore the top frame descriptor from the stack. |
| 4556 __ pop(Operand::StaticVariable(ExternalReference( | 4556 __ pop(Operand::StaticVariable(ExternalReference( |
| 4557 Isolate::k_c_entry_fp_address, | 4557 Isolate::kCEntryFPAddress, |
| 4558 masm->isolate()))); | 4558 masm->isolate()))); |
| 4559 | 4559 |
| 4560 // Restore callee-saved registers (C calling conventions). | 4560 // Restore callee-saved registers (C calling conventions). |
| 4561 __ pop(ebx); | 4561 __ pop(ebx); |
| 4562 __ pop(esi); | 4562 __ pop(esi); |
| 4563 __ pop(edi); | 4563 __ pop(edi); |
| 4564 __ add(Operand(esp), Immediate(2 * kPointerSize)); // remove markers | 4564 __ add(Operand(esp), Immediate(2 * kPointerSize)); // remove markers |
| 4565 | 4565 |
| 4566 // Restore frame pointer and return. | 4566 // Restore frame pointer and return. |
| 4567 __ pop(ebp); | 4567 __ pop(ebp); |
| (...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6491 __ Drop(1); | 6491 __ Drop(1); |
| 6492 __ ret(2 * kPointerSize); | 6492 __ ret(2 * kPointerSize); |
| 6493 } | 6493 } |
| 6494 | 6494 |
| 6495 | 6495 |
| 6496 #undef __ | 6496 #undef __ |
| 6497 | 6497 |
| 6498 } } // namespace v8::internal | 6498 } } // namespace v8::internal |
| 6499 | 6499 |
| 6500 #endif // V8_TARGET_ARCH_IA32 | 6500 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |