Chromium Code Reviews| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 | 532 |
| 533 Address ExitFrame::ComputeStackPointer(Address fp) { | 533 Address ExitFrame::ComputeStackPointer(Address fp) { |
| 534 return Memory::Address_at(fp + ExitFrameConstants::kSPOffset); | 534 return Memory::Address_at(fp + ExitFrameConstants::kSPOffset); |
| 535 } | 535 } |
| 536 | 536 |
| 537 | 537 |
| 538 void ExitFrame::FillState(Address fp, Address sp, State* state) { | 538 void ExitFrame::FillState(Address fp, Address sp, State* state) { |
| 539 state->sp = sp; | 539 state->sp = sp; |
| 540 state->fp = fp; | 540 state->fp = fp; |
| 541 state->pc_address = ResolveReturnAddressLocation( | 541 state->pc_address = ResolveReturnAddressLocation( |
| 542 #ifndef V8_TARGET_ARCH_X32 | |
| 542 reinterpret_cast<Address*>(sp - 1 * kPointerSize)); | 543 reinterpret_cast<Address*>(sp - 1 * kPointerSize)); |
|
danno
2013/07/17 13:33:21
Use kPCOnStackSize to make fully cross-platform
| |
| 544 #else | |
| 545 reinterpret_cast<Address*>(sp - 1 * kHWRegSize)); | |
| 546 #endif | |
| 543 } | 547 } |
| 544 | 548 |
| 545 | 549 |
| 546 Address StandardFrame::GetExpressionAddress(int n) const { | 550 Address StandardFrame::GetExpressionAddress(int n) const { |
| 547 const int offset = StandardFrameConstants::kExpressionsOffset; | 551 const int offset = StandardFrameConstants::kExpressionsOffset; |
| 548 return fp() + offset - n * kPointerSize; | 552 return fp() + offset - n * kPointerSize; |
| 549 } | 553 } |
| 550 | 554 |
| 551 | 555 |
| 552 Object* StandardFrame::GetExpression(Address fp, int index) { | 556 Object* StandardFrame::GetExpression(Address fp, int index) { |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1492 } | 1496 } |
| 1493 | 1497 |
| 1494 | 1498 |
| 1495 // ------------------------------------------------------------------------- | 1499 // ------------------------------------------------------------------------- |
| 1496 | 1500 |
| 1497 | 1501 |
| 1498 void StackHandler::Unwind(Isolate* isolate, | 1502 void StackHandler::Unwind(Isolate* isolate, |
| 1499 FixedArray* array, | 1503 FixedArray* array, |
| 1500 int offset, | 1504 int offset, |
| 1501 int previous_handler_offset) const { | 1505 int previous_handler_offset) const { |
| 1506 #ifndef V8_TARGET_ARCH_X32 | |
| 1502 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); | 1507 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); |
|
danno
2013/07/17 13:33:21
Compute using kPCOnStackSize to make fully cross-p
| |
| 1508 #else | |
| 1509 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 6); | |
| 1510 #endif | |
| 1503 ASSERT_LE(0, offset); | 1511 ASSERT_LE(0, offset); |
| 1504 ASSERT_GE(array->length(), offset + 5); | 1512 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount); |
| 1505 // Unwinding a stack handler into an array chains it in the opposite | 1513 // Unwinding a stack handler into an array chains it in the opposite |
| 1506 // direction, re-using the "next" slot as a "previous" link, so that stack | 1514 // direction, re-using the "next" slot as a "previous" link, so that stack |
| 1507 // handlers can be later re-wound in the correct order. Decode the "state" | 1515 // handlers can be later re-wound in the correct order. Decode the "state" |
| 1508 // slot into "index" and "kind" and store them separately, using the fp slot. | 1516 // slot into "index" and "kind" and store them separately, using the fp slot. |
| 1509 array->set(offset, Smi::FromInt(previous_handler_offset)); // next | 1517 array->set(offset, Smi::FromInt(previous_handler_offset)); // next |
| 1510 array->set(offset + 1, *code_address()); // code | 1518 array->set(offset + 1, *code_address()); // code |
| 1511 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state | 1519 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state |
| 1512 array->set(offset + 3, *context_address()); // context | 1520 array->set(offset + 3, *context_address()); // context |
| 1513 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp | 1521 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp |
| 1522 #if V8_TARGET_ARCH_X32 | |
| 1523 array->set(offset + 5, Smi::FromInt(0)); // high-32 bit of fp | |
| 1524 #endif | |
| 1514 | 1525 |
| 1515 *isolate->handler_address() = next()->address(); | 1526 *isolate->handler_address() = next()->address(); |
| 1516 } | 1527 } |
| 1517 | 1528 |
| 1518 | 1529 |
| 1519 int StackHandler::Rewind(Isolate* isolate, | 1530 int StackHandler::Rewind(Isolate* isolate, |
| 1520 FixedArray* array, | 1531 FixedArray* array, |
| 1521 int offset, | 1532 int offset, |
| 1522 Address fp) { | 1533 Address fp) { |
| 1534 #ifndef V8_TARGET_ARCH_X32 | |
| 1523 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); | 1535 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); |
| 1536 #else | |
| 1537 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 6); | |
| 1538 #endif | |
| 1524 ASSERT_LE(0, offset); | 1539 ASSERT_LE(0, offset); |
| 1525 ASSERT_GE(array->length(), offset + 5); | 1540 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount); |
| 1526 Smi* prev_handler_offset = Smi::cast(array->get(offset)); | 1541 Smi* prev_handler_offset = Smi::cast(array->get(offset)); |
| 1527 Code* code = Code::cast(array->get(offset + 1)); | 1542 Code* code = Code::cast(array->get(offset + 1)); |
| 1528 Smi* smi_index = Smi::cast(array->get(offset + 2)); | 1543 Smi* smi_index = Smi::cast(array->get(offset + 2)); |
| 1529 Object* context = array->get(offset + 3); | 1544 Object* context = array->get(offset + 3); |
| 1530 Smi* smi_kind = Smi::cast(array->get(offset + 4)); | 1545 Smi* smi_kind = Smi::cast(array->get(offset + 4)); |
| 1531 | 1546 |
| 1532 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | | 1547 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | |
| 1533 IndexField::encode(static_cast<unsigned>(smi_index->value())); | 1548 IndexField::encode(static_cast<unsigned>(smi_index->value())); |
| 1534 | 1549 |
| 1535 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = | 1550 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = |
| 1536 *isolate->handler_address(); | 1551 *isolate->handler_address(); |
| 1537 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code; | 1552 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code; |
| 1538 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; | 1553 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; |
| 1539 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = | 1554 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = |
| 1540 context; | 1555 context; |
| 1541 Memory::Address_at(address() + StackHandlerConstants::kFPOffset) = fp; | 1556 Memory::Address_at(address() + StackHandlerConstants::kFPOffset) = fp; |
| 1557 #if V8_TARGET_ARCH_X32 | |
| 1558 Memory::Address_at(address() + StackHandlerConstants::kFPOffset + 4) = 0; | |
| 1559 #endif | |
| 1542 | 1560 |
| 1543 *isolate->handler_address() = address(); | 1561 *isolate->handler_address() = address(); |
| 1544 | 1562 |
| 1545 return prev_handler_offset->value(); | 1563 return prev_handler_offset->value(); |
| 1546 } | 1564 } |
| 1547 | 1565 |
| 1548 | 1566 |
| 1549 // ------------------------------------------------------------------------- | 1567 // ------------------------------------------------------------------------- |
| 1550 | 1568 |
| 1551 int NumRegs(RegList reglist) { | 1569 int NumRegs(RegList reglist) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1604 ZoneList<StackFrame*> list(10, zone); | 1622 ZoneList<StackFrame*> list(10, zone); |
| 1605 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1623 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1606 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1624 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1607 list.Add(frame, zone); | 1625 list.Add(frame, zone); |
| 1608 } | 1626 } |
| 1609 return list.ToVector(); | 1627 return list.ToVector(); |
| 1610 } | 1628 } |
| 1611 | 1629 |
| 1612 | 1630 |
| 1613 } } // namespace v8::internal | 1631 } } // namespace v8::internal |
| OLD | NEW |