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

Side by Side Diff: src/frames.cc

Issue 985803002: Remove code object from StackHandler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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 >= 5); 1537 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 4);
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. Decode the "state"
1543 // slot into "index" and "kind" and store them separately, using the fp slot. 1543 // slot into "index" and "kind" and store them separately, using the fp slot.
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, *code_address()); // code 1545 array->set(offset + 1, Smi::FromInt(static_cast<int>(index()))); // state
1546 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state 1546 array->set(offset + 2, *context_address()); // context
1547 array->set(offset + 3, *context_address()); // context 1547 array->set(offset + 3, Smi::FromInt(static_cast<int>(kind()))); // fp
1548 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp
1549 1548
1550 *isolate->handler_address() = next()->address(); 1549 *isolate->handler_address() = next()->address();
1551 } 1550 }
1552 1551
1553 1552
1554 int StackHandler::Rewind(Isolate* isolate, 1553 int StackHandler::Rewind(Isolate* isolate,
1555 FixedArray* array, 1554 FixedArray* array,
1556 int offset, 1555 int offset,
1557 Address fp) { 1556 Address fp) {
1558 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 5); 1557 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 4);
1559 DCHECK_LE(0, offset); 1558 DCHECK_LE(0, offset);
1560 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount); 1559 DCHECK_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
1561 Smi* prev_handler_offset = Smi::cast(array->get(offset)); 1560 Smi* prev_handler_offset = Smi::cast(array->get(offset));
1562 Code* code = Code::cast(array->get(offset + 1)); 1561 Smi* smi_index = Smi::cast(array->get(offset + 1));
1563 Smi* smi_index = Smi::cast(array->get(offset + 2)); 1562 Object* context = array->get(offset + 2);
1564 Object* context = array->get(offset + 3); 1563 Smi* smi_kind = Smi::cast(array->get(offset + 3));
1565 Smi* smi_kind = Smi::cast(array->get(offset + 4));
1566 1564
1567 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | 1565 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) |
1568 IndexField::encode(static_cast<unsigned>(smi_index->value())); 1566 IndexField::encode(static_cast<unsigned>(smi_index->value()));
1569 1567
1570 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = 1568 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) =
1571 *isolate->handler_address(); 1569 *isolate->handler_address();
1572 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code;
1573 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; 1570 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state;
1574 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = 1571 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) =
1575 context; 1572 context;
1576 SetFp(address() + StackHandlerConstants::kFPOffset, fp); 1573 SetFp(address() + StackHandlerConstants::kFPOffset, fp);
1577 1574
1578 *isolate->handler_address() = address(); 1575 *isolate->handler_address() = address();
1579 1576
1580 return prev_handler_offset->value(); 1577 return prev_handler_offset->value();
1581 } 1578 }
1582 1579
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 ZoneList<StackFrame*> list(10, zone); 1636 ZoneList<StackFrame*> list(10, zone);
1640 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1637 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1641 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1638 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1642 list.Add(frame, zone); 1639 list.Add(frame, zone);
1643 } 1640 }
1644 return list.ToVector(); 1641 return list.ToVector();
1645 } 1642 }
1646 1643
1647 1644
1648 } } // namespace v8::internal 1645 } } // 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