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

Side by Side Diff: src/debug/liveedit.cc

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks Created 4 years, 10 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
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/debug/liveedit.h" 5 #include "src/debug/liveedit.h"
6 6
7 #include "src/ast/scopeinfo.h" 7 #include "src/ast/scopeinfo.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 pointer_address = &Memory::Address_at(*pointer_address); 1478 pointer_address = &Memory::Address_at(*pointer_address);
1479 } 1479 }
1480 bool change = *above_frame_address != *pointer_address; 1480 bool change = *above_frame_address != *pointer_address;
1481 *above_frame_address = *pointer_address; 1481 *above_frame_address = *pointer_address;
1482 return change; 1482 return change;
1483 } 1483 }
1484 1484
1485 1485
1486 // Initializes an artificial stack frame. The data it contains is used for: 1486 // Initializes an artificial stack frame. The data it contains is used for:
1487 // a. successful work of frame dropper code which eventually gets control, 1487 // a. successful work of frame dropper code which eventually gets control,
1488 // b. being compatible with regular stack structure for various stack 1488 // b. being compatible with a typed frame structure for various stack
1489 // iterators. 1489 // iterators.
1490 // Frame structure (conforms InternalFrame structure): 1490 // Frame structure (conforms to InternalFrame structure):
1491 // -- function
1491 // -- code 1492 // -- code
1492 // -- SMI maker 1493 // -- SMI marker
1493 // -- function (slot is called "context")
1494 // -- frame base 1494 // -- frame base
1495 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, 1495 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
1496 Handle<Code> code) { 1496 Handle<Code> code) {
1497 DCHECK(bottom_js_frame->is_java_script()); 1497 DCHECK(bottom_js_frame->is_java_script());
1498
1499 Address fp = bottom_js_frame->fp(); 1498 Address fp = bottom_js_frame->fp();
1500 1499 Memory::Object_at(fp + FrameDropperFrameConstants::kFunctionOffset) =
1501 // Move function pointer into "context" slot. 1500 Memory::Object_at(fp + StandardFrameConstants::kFunctionOffset);
1502 Memory::Object_at(fp + StandardFrameConstants::kContextOffset) = 1501 Memory::Object_at(fp + FrameDropperFrameConstants::kFrameTypeOffset) =
1503 Memory::Object_at(fp + JavaScriptFrameConstants::kFunctionOffset);
1504
1505 Memory::Object_at(fp + InternalFrameConstants::kCodeOffset) = *code;
1506 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) =
1507 Smi::FromInt(StackFrame::INTERNAL); 1502 Smi::FromInt(StackFrame::INTERNAL);
1503 Memory::Object_at(fp + FrameDropperFrameConstants::kCodeOffset) = *code;
1508 } 1504 }
1509 1505
1510 1506
1511 // Removes specified range of frames from stack. There may be 1 or more 1507 // Removes specified range of frames from stack. There may be 1 or more
1512 // frames in range. Anyway the bottom frame is restarted rather than dropped, 1508 // frames in range. Anyway the bottom frame is restarted rather than dropped,
1513 // and therefore has to be a JavaScript frame. 1509 // and therefore has to be a JavaScript frame.
1514 // Returns error message or NULL. 1510 // Returns error message or NULL.
1515 static const char* DropFrames(Vector<StackFrame*> frames, int top_frame_index, 1511 static const char* DropFrames(Vector<StackFrame*> frames, int top_frame_index,
1516 int bottom_js_frame_index, 1512 int bottom_js_frame_index,
1517 LiveEdit::FrameDropMode* mode) { 1513 LiveEdit::FrameDropMode* mode) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit)); 1555 isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit));
1560 pre_top_frame = frames[top_frame_index - 3]; 1556 pre_top_frame = frames[top_frame_index - 3];
1561 top_frame = frames[top_frame_index - 2]; 1557 top_frame = frames[top_frame_index - 2];
1562 *mode = LiveEdit::CURRENTLY_SET_MODE; 1558 *mode = LiveEdit::CURRENTLY_SET_MODE;
1563 frame_has_padding = false; 1559 frame_has_padding = false;
1564 } else { 1560 } else {
1565 return "Unknown structure of stack above changing function"; 1561 return "Unknown structure of stack above changing function";
1566 } 1562 }
1567 1563
1568 Address unused_stack_top = top_frame->sp(); 1564 Address unused_stack_top = top_frame->sp();
1569 int new_frame_size = LiveEdit::kFrameDropperFrameSize * kPointerSize; 1565 // int new_frame_size = LiveEdit::kFrameDropperFrameSize * kPointerSize;
Michael Starzinger 2016/02/23 10:57:33 nit: Looks like left-over code. Can we drop this l
danno 2016/03/07 09:33:38 Done.
1570 Address unused_stack_bottom = bottom_js_frame->fp() 1566 Address unused_stack_bottom =
1571 - new_frame_size + kPointerSize; // Bigger address end is exclusive. 1567 bottom_js_frame->fp() - FrameDropperFrameConstants::kFixedFrameSize +
1568 2 * kPointerSize; // Bigger address end is exclusive.
1572 1569
1573 Address* top_frame_pc_address = top_frame->pc_address(); 1570 Address* top_frame_pc_address = top_frame->pc_address();
1574 1571
1575 // top_frame may be damaged below this point. Do not used it. 1572 // top_frame may be damaged below this point. Do not used it.
1576 DCHECK(!(top_frame = NULL)); 1573 DCHECK(!(top_frame = NULL));
1577 1574
1578 if (unused_stack_top > unused_stack_bottom) { 1575 if (unused_stack_top > unused_stack_bottom) {
1579 if (frame_has_padding) { 1576 if (frame_has_padding) {
1580 int shortage_bytes = 1577 int shortage_bytes =
1581 static_cast<int>(unused_stack_top - unused_stack_bottom); 1578 static_cast<int>(unused_stack_top - unused_stack_bottom);
1582 1579
1583 Address padding_start = pre_top_frame->fp() - 1580 Address padding_start =
1584 LiveEdit::kFrameDropperFrameSize * kPointerSize; 1581 pre_top_frame->fp() -
1582 (FrameDropperFrameConstants::kFixedFrameSize - kPointerSize);
1585 1583
1586 Address padding_pointer = padding_start; 1584 Address padding_pointer = padding_start;
1587 Smi* padding_object = Smi::FromInt(LiveEdit::kFramePaddingValue); 1585 Smi* padding_object = Smi::FromInt(LiveEdit::kFramePaddingValue);
1588 while (Memory::Object_at(padding_pointer) == padding_object) { 1586 while (Memory::Object_at(padding_pointer) == padding_object) {
1589 padding_pointer -= kPointerSize; 1587 padding_pointer -= kPointerSize;
1590 } 1588 }
1591 int padding_counter = 1589 int padding_counter =
1592 Smi::cast(Memory::Object_at(padding_pointer))->value(); 1590 Smi::cast(Memory::Object_at(padding_pointer))->value();
1593 if (padding_counter * kPointerSize < shortage_bytes) { 1591 if (padding_counter * kPointerSize < shortage_bytes) {
1594 return "Not enough space for frame dropper frame " 1592 return "Not enough space for frame dropper frame "
1595 "(even with padding frame)"; 1593 "(even with padding frame)";
1596 } 1594 }
1597 Memory::Object_at(padding_pointer) = 1595 Memory::Object_at(padding_pointer) =
1598 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize); 1596 Smi::FromInt(padding_counter - shortage_bytes / kPointerSize);
1599 1597
1600 StackFrame* pre_pre_frame = frames[top_frame_index - 2]; 1598 StackFrame* pre_pre_frame = frames[top_frame_index - 2];
1601 1599
1602 MemMove(padding_start + kPointerSize - shortage_bytes, 1600 MemMove(padding_start + kPointerSize - shortage_bytes,
1603 padding_start + kPointerSize, 1601 padding_start + kPointerSize,
1604 LiveEdit::kFrameDropperFrameSize * kPointerSize); 1602 FrameDropperFrameConstants::kFixedFrameSize - kPointerSize);
1605 1603
1606 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes); 1604 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes);
1607 pre_pre_frame->SetCallerFp(pre_top_frame->fp()); 1605 pre_pre_frame->SetCallerFp(pre_top_frame->fp());
1608 unused_stack_top -= shortage_bytes; 1606 unused_stack_top -= shortage_bytes;
1609 1607
1610 STATIC_ASSERT(sizeof(Address) == kPointerSize); 1608 STATIC_ASSERT(sizeof(Address) == kPointerSize);
1611 top_frame_pc_address -= shortage_bytes / kPointerSize; 1609 top_frame_pc_address -= shortage_bytes / kPointerSize;
1612 } else { 1610 } else {
1613 return "Not enough space for frame dropper frame"; 1611 return "Not enough space for frame dropper frame";
1614 } 1612 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 isolate_->active_function_info_listener()->FunctionCode(code); 2035 isolate_->active_function_info_listener()->FunctionCode(code);
2038 } 2036 }
2039 2037
2040 2038
2041 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2039 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2042 return isolate->active_function_info_listener() != NULL; 2040 return isolate->active_function_info_listener() != NULL;
2043 } 2041 }
2044 2042
2045 } // namespace internal 2043 } // namespace internal
2046 } // namespace v8 2044 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698