Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: src/frames.cc

Issue 991893003: Remove frame pointer from StackHandler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_stack-handler-1
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "src/frames.h" 5 #include "src/frames.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 } 1527 }
1528 1528
1529 1529
1530 // ------------------------------------------------------------------------- 1530 // -------------------------------------------------------------------------
1531 1531
1532 1532
1533 void StackHandler::Unwind(Isolate* isolate, 1533 void StackHandler::Unwind(Isolate* isolate,
1534 FixedArray* array, 1534 FixedArray* array,
1535 int offset, 1535 int offset,
1536 int previous_handler_offset) const { 1536 int previous_handler_offset) const {
1537 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 4); 1537 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 3);
1538 DCHECK_LE(0, offset); 1538 DCHECK_LE(0, offset);
1539 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount); 1539 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
1540 // Unwinding a stack handler into an array chains it in the opposite 1540 // Unwinding a stack handler into an array chains it in the opposite
1541 // direction, re-using the "next" slot as a "previous" link, so that stack 1541 // direction, re-using the "next" slot as a "previous" link, so that stack
1542 // handlers can be later re-wound in the correct order. Decode the "state" 1542 // handlers can be later re-wound in the correct order.
1543 // slot into "index" and "kind" and store them separately, using the fp slot. 1543 int s = Memory::int_at(address() + StackHandlerConstants::kStateIntOffset);
1544 array->set(offset, Smi::FromInt(previous_handler_offset)); // next 1544 array->set(offset, Smi::FromInt(previous_handler_offset)); // next
1545 array->set(offset + 1, Smi::FromInt(static_cast<int>(index()))); // state 1545 array->set(offset + 1, Smi::FromInt(static_cast<int>(s))); // state
1546 array->set(offset + 2, *context_address()); // context 1546 array->set(offset + 2, *context_address()); // context
1547 array->set(offset + 3, Smi::FromInt(static_cast<int>(kind()))); // fp
1548 1547
1549 *isolate->handler_address() = next()->address(); 1548 *isolate->handler_address() = next()->address();
1550 } 1549 }
1551 1550
1552 1551
1553 int StackHandler::Rewind(Isolate* isolate, 1552 int StackHandler::Rewind(Isolate* isolate,
1554 FixedArray* array, 1553 FixedArray* array,
1555 int offset, 1554 int offset,
1556 Address fp) { 1555 Address fp) {
1557 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 4); 1556 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 3);
1558 DCHECK_LE(0, offset); 1557 DCHECK_LE(0, offset);
1559 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount); 1558 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
1560 Smi* prev_handler_offset = Smi::cast(array->get(offset)); 1559 Smi* prev_handler_offset = Smi::cast(array->get(offset));
1561 Smi* smi_index = Smi::cast(array->get(offset + 1)); 1560 Smi* smi_state = Smi::cast(array->get(offset + 1));
1562 Object* context = array->get(offset + 2); 1561 Object* context = array->get(offset + 2);
1563 Smi* smi_kind = Smi::cast(array->get(offset + 3));
1564
1565 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) |
1566 IndexField::encode(static_cast<unsigned>(smi_index->value()));
1567 1562
1568 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = 1563 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) =
1569 *isolate->handler_address(); 1564 *isolate->handler_address();
1570 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; 1565 Memory::int_at(address() + StackHandlerConstants::kStateIntOffset) =
1566 smi_state->value();
1571 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = 1567 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) =
1572 context; 1568 context;
1573 SetFp(address() + StackHandlerConstants::kFPOffset, fp);
1574 1569
1575 *isolate->handler_address() = address(); 1570 *isolate->handler_address() = address();
1576 1571
1577 return prev_handler_offset->value(); 1572 return prev_handler_offset->value();
1578 } 1573 }
1579 1574
1580 1575
1581 // ------------------------------------------------------------------------- 1576 // -------------------------------------------------------------------------
1582 1577
1583 int NumRegs(RegList reglist) { return base::bits::CountPopulation32(reglist); } 1578 int NumRegs(RegList reglist) { return base::bits::CountPopulation32(reglist); }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 ZoneList<StackFrame*> list(10, zone); 1631 ZoneList<StackFrame*> list(10, zone);
1637 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1632 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1638 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1633 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1639 list.Add(frame, zone); 1634 list.Add(frame, zone);
1640 } 1635 }
1641 return list.ToVector(); 1636 return list.ToVector();
1642 } 1637 }
1643 1638
1644 1639
1645 } } // namespace v8::internal 1640 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698