OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1514 } | 1514 } |
1515 | 1515 |
1516 | 1516 |
1517 // ------------------------------------------------------------------------- | 1517 // ------------------------------------------------------------------------- |
1518 | 1518 |
1519 | 1519 |
1520 void StackHandler::Unwind(Isolate* isolate, | 1520 void StackHandler::Unwind(Isolate* isolate, |
1521 FixedArray* array, | 1521 FixedArray* array, |
1522 int offset, | 1522 int offset, |
1523 int previous_handler_offset) const { | 1523 int previous_handler_offset) const { |
1524 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); | 1524 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5 || |
1525 StackHandlerConstants::kSlotCount == 6); | |
danno
2013/07/24 13:28:57
I think this assert needs to be:
STATIC_ASSERT(St
haitao.feng
2013/07/24 13:44:17
Done.
haitao.feng
2013/07/24 13:44:17
Done.
| |
1525 ASSERT_LE(0, offset); | 1526 ASSERT_LE(0, offset); |
1526 ASSERT_GE(array->length(), offset + 5); | 1527 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount); |
1527 // Unwinding a stack handler into an array chains it in the opposite | 1528 // Unwinding a stack handler into an array chains it in the opposite |
1528 // direction, re-using the "next" slot as a "previous" link, so that stack | 1529 // direction, re-using the "next" slot as a "previous" link, so that stack |
1529 // handlers can be later re-wound in the correct order. Decode the "state" | 1530 // handlers can be later re-wound in the correct order. Decode the "state" |
1530 // slot into "index" and "kind" and store them separately, using the fp slot. | 1531 // slot into "index" and "kind" and store them separately, using the fp slot. |
1531 array->set(offset, Smi::FromInt(previous_handler_offset)); // next | 1532 array->set(offset, Smi::FromInt(previous_handler_offset)); // next |
1532 array->set(offset + 1, *code_address()); // code | 1533 array->set(offset + 1, *code_address()); // code |
1533 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state | 1534 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state |
1534 array->set(offset + 3, *context_address()); // context | 1535 array->set(offset + 3, *context_address()); // context |
1535 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp | 1536 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp |
1536 | 1537 |
1537 *isolate->handler_address() = next()->address(); | 1538 *isolate->handler_address() = next()->address(); |
1538 } | 1539 } |
1539 | 1540 |
1540 | 1541 |
1541 int StackHandler::Rewind(Isolate* isolate, | 1542 int StackHandler::Rewind(Isolate* isolate, |
1542 FixedArray* array, | 1543 FixedArray* array, |
1543 int offset, | 1544 int offset, |
1544 Address fp) { | 1545 Address fp) { |
1545 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); | 1546 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5 || |
1547 StackHandlerConstants::kSlotCount == 6); | |
danno
2013/07/24 13:28:57
See comment above
haitao.feng
2013/07/24 13:44:17
Done.
| |
1546 ASSERT_LE(0, offset); | 1548 ASSERT_LE(0, offset); |
1547 ASSERT_GE(array->length(), offset + 5); | 1549 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount); |
1548 Smi* prev_handler_offset = Smi::cast(array->get(offset)); | 1550 Smi* prev_handler_offset = Smi::cast(array->get(offset)); |
1549 Code* code = Code::cast(array->get(offset + 1)); | 1551 Code* code = Code::cast(array->get(offset + 1)); |
1550 Smi* smi_index = Smi::cast(array->get(offset + 2)); | 1552 Smi* smi_index = Smi::cast(array->get(offset + 2)); |
1551 Object* context = array->get(offset + 3); | 1553 Object* context = array->get(offset + 3); |
1552 Smi* smi_kind = Smi::cast(array->get(offset + 4)); | 1554 Smi* smi_kind = Smi::cast(array->get(offset + 4)); |
1553 | 1555 |
1554 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | | 1556 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | |
1555 IndexField::encode(static_cast<unsigned>(smi_index->value())); | 1557 IndexField::encode(static_cast<unsigned>(smi_index->value())); |
1556 | 1558 |
1557 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = | 1559 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = |
1558 *isolate->handler_address(); | 1560 *isolate->handler_address(); |
1559 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code; | 1561 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code; |
1560 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; | 1562 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; |
1561 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = | 1563 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = |
1562 context; | 1564 context; |
1563 Memory::Address_at(address() + StackHandlerConstants::kFPOffset) = fp; | 1565 SetFp(address() + StackHandlerConstants::kFPOffset, fp); |
1564 | 1566 |
1565 *isolate->handler_address() = address(); | 1567 *isolate->handler_address() = address(); |
1566 | 1568 |
1567 return prev_handler_offset->value(); | 1569 return prev_handler_offset->value(); |
1568 } | 1570 } |
1569 | 1571 |
1570 | 1572 |
1571 // ------------------------------------------------------------------------- | 1573 // ------------------------------------------------------------------------- |
1572 | 1574 |
1573 int NumRegs(RegList reglist) { | 1575 int NumRegs(RegList reglist) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 ZoneList<StackFrame*> list(10, zone); | 1630 ZoneList<StackFrame*> list(10, zone); |
1629 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1631 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1630 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1632 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1631 list.Add(frame, zone); | 1633 list.Add(frame, zone); |
1632 } | 1634 } |
1633 return list.ToVector(); | 1635 return list.ToVector(); |
1634 } | 1636 } |
1635 | 1637 |
1636 | 1638 |
1637 } } // namespace v8::internal | 1639 } } // namespace v8::internal |
OLD | NEW |