OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 | 1434 |
1435 void MacroAssembler::PopTryHandler() { | 1435 void MacroAssembler::PopTryHandler() { |
1436 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1436 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1437 pop(r1); | 1437 pop(r1); |
1438 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 1438 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
1439 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); | 1439 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
1440 str(r1, MemOperand(ip)); | 1440 str(r1, MemOperand(ip)); |
1441 } | 1441 } |
1442 | 1442 |
1443 | 1443 |
1444 void MacroAssembler::JumpToHandlerEntry() { | |
1445 // Compute the handler entry address and jump to it. The handler table is | |
1446 // a fixed array of (smi-tagged) code offsets. | |
1447 // r0 = exception, r1 = code object, r2 = state. | |
1448 | |
1449 ConstantPoolUnavailableScope constant_pool_unavailable(this); | |
1450 if (FLAG_enable_ool_constant_pool) { | |
1451 ldr(pp, FieldMemOperand(r1, Code::kConstantPoolOffset)); // Constant pool. | |
1452 } | |
1453 ldr(r3, FieldMemOperand(r1, Code::kHandlerTableOffset)); // Handler table. | |
1454 add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
1455 mov(r2, Operand(r2, LSR, StackHandler::kKindWidth)); // Handler index. | |
1456 ldr(r2, MemOperand(r3, r2, LSL, kPointerSizeLog2)); // Smi-tagged offset. | |
1457 add(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start. | |
1458 add(pc, r1, Operand::SmiUntag(r2)); // Jump | |
1459 } | |
1460 | |
1461 | |
1462 void MacroAssembler::Throw(Register value) { | |
1463 // Adjust this code if not the case. | |
1464 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | |
1465 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | |
1466 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | |
1467 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | |
1468 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | |
1469 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | |
1470 | |
1471 // The exception is expected in r0. | |
1472 if (!value.is(r0)) { | |
1473 mov(r0, value); | |
1474 } | |
1475 // Drop the stack pointer to the top of the top handler. | |
1476 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | |
1477 ldr(sp, MemOperand(r3)); | |
1478 // Restore the next handler. | |
1479 pop(r2); | |
1480 str(r2, MemOperand(r3)); | |
1481 | |
1482 // Get the code object (r1) and state (r2). Restore the context and frame | |
1483 // pointer. | |
1484 ldm(ia_w, sp, r1.bit() | r2.bit() | cp.bit() | fp.bit()); | |
1485 | |
1486 // If the handler is a JS frame, restore the context to the frame. | |
1487 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | |
1488 // or cp. | |
1489 tst(cp, cp); | |
1490 str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | |
1491 | |
1492 JumpToHandlerEntry(); | |
1493 } | |
1494 | |
1495 | |
1496 void MacroAssembler::ThrowUncatchable(Register value) { | |
1497 // Adjust this code if not the case. | |
1498 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize); | |
1499 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize); | |
1500 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | |
1501 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | |
1502 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | |
1503 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | |
1504 | |
1505 // The exception is expected in r0. | |
1506 if (!value.is(r0)) { | |
1507 mov(r0, value); | |
1508 } | |
1509 // Drop the stack pointer to the top of the top stack handler. | |
1510 mov(r3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | |
1511 ldr(sp, MemOperand(r3)); | |
1512 | |
1513 // Unwind the handlers until the ENTRY handler is found. | |
1514 Label fetch_next, check_kind; | |
1515 jmp(&check_kind); | |
1516 bind(&fetch_next); | |
1517 ldr(sp, MemOperand(sp, StackHandlerConstants::kNextOffset)); | |
1518 | |
1519 bind(&check_kind); | |
1520 STATIC_ASSERT(StackHandler::JS_ENTRY == 0); | |
1521 ldr(r2, MemOperand(sp, StackHandlerConstants::kStateOffset)); | |
1522 tst(r2, Operand(StackHandler::KindField::kMask)); | |
1523 b(ne, &fetch_next); | |
1524 | |
1525 // Set the top handler address to next handler past the top ENTRY handler. | |
1526 pop(r2); | |
1527 str(r2, MemOperand(r3)); | |
1528 // Get the code object (r1) and state (r2). Clear the context and frame | |
1529 // pointer (0 was saved in the handler). | |
1530 ldm(ia_w, sp, r1.bit() | r2.bit() | cp.bit() | fp.bit()); | |
1531 | |
1532 JumpToHandlerEntry(); | |
1533 } | |
1534 | |
1535 | |
1536 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | 1444 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, |
1537 Register scratch, | 1445 Register scratch, |
1538 Label* miss) { | 1446 Label* miss) { |
1539 Label same_contexts; | 1447 Label same_contexts; |
1540 | 1448 |
1541 DCHECK(!holder_reg.is(scratch)); | 1449 DCHECK(!holder_reg.is(scratch)); |
1542 DCHECK(!holder_reg.is(ip)); | 1450 DCHECK(!holder_reg.is(ip)); |
1543 DCHECK(!scratch.is(ip)); | 1451 DCHECK(!scratch.is(ip)); |
1544 | 1452 |
1545 // Load current lexical context from the stack frame. | 1453 // Load current lexical context from the stack frame. |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3989 } | 3897 } |
3990 } | 3898 } |
3991 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3899 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3992 add(result, result, Operand(dividend, LSR, 31)); | 3900 add(result, result, Operand(dividend, LSR, 31)); |
3993 } | 3901 } |
3994 | 3902 |
3995 } // namespace internal | 3903 } // namespace internal |
3996 } // namespace v8 | 3904 } // namespace v8 |
3997 | 3905 |
3998 #endif // V8_TARGET_ARCH_ARM | 3906 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |