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 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 | 2502 |
2503 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type, | 2503 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type, |
2504 Register value) { | 2504 Register value) { |
2505 // Adjust this code if not the case. | 2505 // Adjust this code if not the case. |
2506 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | 2506 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); |
2507 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | 2507 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); |
2508 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 1 * kPointerSize); | 2508 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 1 * kPointerSize); |
2509 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); | 2509 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 2 * kPointerSize); |
2510 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 3 * kPointerSize); | 2510 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 3 * kPointerSize); |
2511 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); | 2511 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 4 * kPointerSize); |
2512 // Keep thrown value in rax. | |
2513 if (!value.is(rax)) { | |
2514 movq(rax, value); | |
2515 } | |
2516 // Fetch top stack handler. | |
2517 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | |
2518 Load(rsp, handler_address); | |
2519 | 2512 |
2520 // Unwind the handlers until the ENTRY handler is found. | 2513 // The exception is expected in rax. |
2521 Label loop, done; | |
2522 bind(&loop); | |
2523 // Load the type of the current stack handler. | |
2524 const int kStateOffset = StackHandlerConstants::kStateOffset; | |
2525 cmpq(Operand(rsp, kStateOffset), Immediate(StackHandler::ENTRY)); | |
2526 j(equal, &done, Label::kNear); | |
2527 // Fetch the next handler in the list. | |
2528 const int kNextOffset = StackHandlerConstants::kNextOffset; | |
2529 movq(rsp, Operand(rsp, kNextOffset)); | |
2530 jmp(&loop); | |
2531 bind(&done); | |
2532 | |
2533 // Set the top handler address to next handler past the current ENTRY handler. | |
2534 Operand handler_operand = ExternalOperand(handler_address); | |
2535 pop(handler_operand); | |
2536 | |
2537 if (type == OUT_OF_MEMORY) { | 2514 if (type == OUT_OF_MEMORY) { |
2538 // Set external caught exception to false. | 2515 // Set external caught exception to false. |
2539 ExternalReference external_caught( | 2516 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, |
2540 Isolate::kExternalCaughtExceptionAddress, isolate()); | 2517 isolate()); |
2541 Set(rax, static_cast<int64_t>(false)); | 2518 Set(rax, static_cast<int64_t>(false)); |
2542 Store(external_caught, rax); | 2519 Store(external_caught, rax); |
2543 | 2520 |
2544 // Set pending exception and rax to out of memory exception. | 2521 // Set pending exception and rax to out of memory exception. |
2545 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, | 2522 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
2546 isolate()); | 2523 isolate()); |
2547 movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); | 2524 movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE); |
2548 Store(pending_exception, rax); | 2525 Store(pending_exception, rax); |
| 2526 } else if (!value.is(rax)) { |
| 2527 movq(rax, value); |
2549 } | 2528 } |
2550 | 2529 |
2551 // Discard the context saved in the handler and clear the context pointer. | 2530 // Drop the stack pointer to the top of the top stack handler. |
2552 pop(rdx); | 2531 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
2553 Set(rsi, 0); | 2532 Load(rsp, handler_address); |
2554 | 2533 |
2555 pop(rbp); // Restore frame pointer. | 2534 // Unwind the handlers until the top ENTRY handler is found. |
2556 pop(rdx); // Discard state. | 2535 Label fetch_next, check_kind; |
| 2536 jmp(&check_kind, Label::kNear); |
| 2537 bind(&fetch_next); |
| 2538 movq(rsp, Operand(rsp, kNextOffset)); |
| 2539 |
| 2540 bind(&check_kind); |
| 2541 cmpq(Operand(rsp, StackHandlerConstants::kStateOffset), |
| 2542 Immediate(StackHandler::ENTRY)); |
| 2543 j(not_equal, &fetch_next); |
| 2544 |
| 2545 // Set the top handler address to next handler past the top ENTRY handler. |
| 2546 pop(ExternalOperand(handler_address)); |
| 2547 |
| 2548 // Clear the context and frame pointer (0 was saved in the handler), and |
| 2549 // discard the state. |
| 2550 pop(rsi); |
| 2551 pop(rbp); |
| 2552 pop(rdx); // State. |
2557 | 2553 |
2558 ret(0); | 2554 ret(0); |
2559 } | 2555 } |
2560 | 2556 |
2561 | 2557 |
2562 void MacroAssembler::Ret() { | 2558 void MacroAssembler::Ret() { |
2563 ret(0); | 2559 ret(0); |
2564 } | 2560 } |
2565 | 2561 |
2566 | 2562 |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4224 | 4220 |
4225 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4221 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4226 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4222 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4227 | 4223 |
4228 bind(&done); | 4224 bind(&done); |
4229 } | 4225 } |
4230 | 4226 |
4231 } } // namespace v8::internal | 4227 } } // namespace v8::internal |
4232 | 4228 |
4233 #endif // V8_TARGET_ARCH_X64 | 4229 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |