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

Side by Side Diff: src/frames.cc

Issue 20073004: Introduce the SetFp function in StackHandler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/frames.h ('k') | src/ia32/frames-ia32.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 // 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
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 ASSERT_LE(0, offset); 1525 ASSERT_LE(0, offset);
1526 ASSERT_GE(array->length(), offset + 5); 1526 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
1527 // Unwinding a stack handler into an array chains it in the opposite 1527 // 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 1528 // 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" 1529 // 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. 1530 // slot into "index" and "kind" and store them separately, using the fp slot.
1531 array->set(offset, Smi::FromInt(previous_handler_offset)); // next 1531 array->set(offset, Smi::FromInt(previous_handler_offset)); // next
1532 array->set(offset + 1, *code_address()); // code 1532 array->set(offset + 1, *code_address()); // code
1533 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state 1533 array->set(offset + 2, Smi::FromInt(static_cast<int>(index()))); // state
1534 array->set(offset + 3, *context_address()); // context 1534 array->set(offset + 3, *context_address()); // context
1535 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp 1535 array->set(offset + 4, Smi::FromInt(static_cast<int>(kind()))); // fp
1536 1536
1537 *isolate->handler_address() = next()->address(); 1537 *isolate->handler_address() = next()->address();
1538 } 1538 }
1539 1539
1540 1540
1541 int StackHandler::Rewind(Isolate* isolate, 1541 int StackHandler::Rewind(Isolate* isolate,
1542 FixedArray* array, 1542 FixedArray* array,
1543 int offset, 1543 int offset,
1544 Address fp) { 1544 Address fp) {
1545 STATIC_ASSERT(StackHandlerConstants::kSlotCount == 5); 1545 STATIC_ASSERT(StackHandlerConstants::kSlotCount >= 5);
1546 ASSERT_LE(0, offset); 1546 ASSERT_LE(0, offset);
1547 ASSERT_GE(array->length(), offset + 5); 1547 ASSERT_GE(array->length(), offset + StackHandlerConstants::kSlotCount);
1548 Smi* prev_handler_offset = Smi::cast(array->get(offset)); 1548 Smi* prev_handler_offset = Smi::cast(array->get(offset));
1549 Code* code = Code::cast(array->get(offset + 1)); 1549 Code* code = Code::cast(array->get(offset + 1));
1550 Smi* smi_index = Smi::cast(array->get(offset + 2)); 1550 Smi* smi_index = Smi::cast(array->get(offset + 2));
1551 Object* context = array->get(offset + 3); 1551 Object* context = array->get(offset + 3);
1552 Smi* smi_kind = Smi::cast(array->get(offset + 4)); 1552 Smi* smi_kind = Smi::cast(array->get(offset + 4));
1553 1553
1554 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) | 1554 unsigned state = KindField::encode(static_cast<Kind>(smi_kind->value())) |
1555 IndexField::encode(static_cast<unsigned>(smi_index->value())); 1555 IndexField::encode(static_cast<unsigned>(smi_index->value()));
1556 1556
1557 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) = 1557 Memory::Address_at(address() + StackHandlerConstants::kNextOffset) =
1558 *isolate->handler_address(); 1558 *isolate->handler_address();
1559 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code; 1559 Memory::Object_at(address() + StackHandlerConstants::kCodeOffset) = code;
1560 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state; 1560 Memory::uintptr_at(address() + StackHandlerConstants::kStateOffset) = state;
1561 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) = 1561 Memory::Object_at(address() + StackHandlerConstants::kContextOffset) =
1562 context; 1562 context;
1563 Memory::Address_at(address() + StackHandlerConstants::kFPOffset) = fp; 1563 SetFp(address() + StackHandlerConstants::kFPOffset, fp);
1564 1564
1565 *isolate->handler_address() = address(); 1565 *isolate->handler_address() = address();
1566 1566
1567 return prev_handler_offset->value(); 1567 return prev_handler_offset->value();
1568 } 1568 }
1569 1569
1570 1570
1571 // ------------------------------------------------------------------------- 1571 // -------------------------------------------------------------------------
1572 1572
1573 int NumRegs(RegList reglist) { 1573 int NumRegs(RegList reglist) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 ZoneList<StackFrame*> list(10, zone); 1628 ZoneList<StackFrame*> list(10, zone);
1629 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1629 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1630 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1630 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1631 list.Add(frame, zone); 1631 list.Add(frame, zone);
1632 } 1632 }
1633 return list.ToVector(); 1633 return list.ToVector();
1634 } 1634 }
1635 1635
1636 1636
1637 } } // namespace v8::internal 1637 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/ia32/frames-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698