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

Side by Side Diff: src/liveedit.cc

Issue 10263002: Fix issue 825 (LiveEdit vs. function with no locals) in core and for ia32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: style Created 8 years, 7 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
« src/ia32/debug-ia32.cc ('K') | « src/ia32/debug-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1468
1469 StackFrame* pre_top_frame = frames[top_frame_index - 1]; 1469 StackFrame* pre_top_frame = frames[top_frame_index - 1];
1470 StackFrame* top_frame = frames[top_frame_index]; 1470 StackFrame* top_frame = frames[top_frame_index];
1471 StackFrame* bottom_js_frame = frames[bottom_js_frame_index]; 1471 StackFrame* bottom_js_frame = frames[bottom_js_frame_index];
1472 1472
1473 ASSERT(bottom_js_frame->is_java_script()); 1473 ASSERT(bottom_js_frame->is_java_script());
1474 1474
1475 // Check the nature of the top frame. 1475 // Check the nature of the top frame.
1476 Isolate* isolate = Isolate::Current(); 1476 Isolate* isolate = Isolate::Current();
1477 Code* pre_top_frame_code = pre_top_frame->LookupCode(); 1477 Code* pre_top_frame_code = pre_top_frame->LookupCode();
1478 bool frame_has_padding;
1478 if (pre_top_frame_code->is_inline_cache_stub() && 1479 if (pre_top_frame_code->is_inline_cache_stub() &&
1479 pre_top_frame_code->ic_state() == DEBUG_BREAK) { 1480 pre_top_frame_code->ic_state() == DEBUG_BREAK) {
1480 // OK, we can drop inline cache calls. 1481 // OK, we can drop inline cache calls.
1481 *mode = Debug::FRAME_DROPPED_IN_IC_CALL; 1482 *mode = Debug::FRAME_DROPPED_IN_IC_CALL;
1483 frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
1482 } else if (pre_top_frame_code == 1484 } else if (pre_top_frame_code ==
1483 isolate->debug()->debug_break_slot()) { 1485 isolate->debug()->debug_break_slot()) {
1484 // OK, we can drop debug break slot. 1486 // OK, we can drop debug break slot.
1485 *mode = Debug::FRAME_DROPPED_IN_DEBUG_SLOT_CALL; 1487 *mode = Debug::FRAME_DROPPED_IN_DEBUG_SLOT_CALL;
1488 frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
1486 } else if (pre_top_frame_code == 1489 } else if (pre_top_frame_code ==
1487 isolate->builtins()->builtin( 1490 isolate->builtins()->builtin(
1488 Builtins::kFrameDropper_LiveEdit)) { 1491 Builtins::kFrameDropper_LiveEdit)) {
1489 // OK, we can drop our own code. 1492 // OK, we can drop our own code.
1490 *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL; 1493 *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
1494 frame_has_padding = false;
1491 } else if (pre_top_frame_code == 1495 } else if (pre_top_frame_code ==
1492 isolate->builtins()->builtin(Builtins::kReturn_DebugBreak)) { 1496 isolate->builtins()->builtin(Builtins::kReturn_DebugBreak)) {
1493 *mode = Debug::FRAME_DROPPED_IN_RETURN_CALL; 1497 *mode = Debug::FRAME_DROPPED_IN_RETURN_CALL;
1498 frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
1494 } else if (pre_top_frame_code->kind() == Code::STUB && 1499 } else if (pre_top_frame_code->kind() == Code::STUB &&
1495 pre_top_frame_code->major_key()) { 1500 pre_top_frame_code->major_key()) {
1496 // Entry from our unit tests, it's fine, we support this case. 1501 // Entry from our unit tests, it's fine, we support this case.
1497 *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL; 1502 *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
1503 frame_has_padding = false;
1498 } else { 1504 } else {
1499 return "Unknown structure of stack above changing function"; 1505 return "Unknown structure of stack above changing function";
1500 } 1506 }
1501 1507
1502 Address unused_stack_top = top_frame->sp(); 1508 Address unused_stack_top = top_frame->sp();
1503 Address unused_stack_bottom = bottom_js_frame->fp() 1509 Address unused_stack_bottom = bottom_js_frame->fp()
1504 - Debug::kFrameDropperFrameSize * kPointerSize // Size of the new frame. 1510 - Debug::kFrameDropperFrameSize * kPointerSize // Size of the new frame.
1505 + kPointerSize; // Bigger address end is exclusive. 1511 + kPointerSize; // Bigger address end is exclusive.
1506 1512
1513 Address* top_frame_pc_address = top_frame->pc_address();
1514
1515 // top_frame may be damaged below this point. Do not used it.
1516 ASSERT(!(top_frame = NULL));
1517
1507 if (unused_stack_top > unused_stack_bottom) { 1518 if (unused_stack_top > unused_stack_bottom) {
1508 return "Not enough space for frame dropper frame"; 1519 if (frame_has_padding) {
1520 int shortage_bytes = unused_stack_top - unused_stack_bottom;
1521
1522 Address padding_start = pre_top_frame->fp() -
1523 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize;
1524
1525 Address padding_pointer = padding_start;
1526 while (Memory::int_at(padding_pointer) ==
1527 Debug::FramePaddingLayout::kPaddingValue) {
1528 padding_pointer -= kPointerSize;
1529 }
1530 if (Memory::int_at(padding_pointer) / 2 * kPointerSize < shortage_bytes) {
Yang 2012/05/02 11:38:34 I suppose this is a Smi-untagging. Use Smi::cast(
Peter Rybin 2012/05/02 23:46:33 Done.
1531 return "Not enough space for frame dropper frame "
1532 "(even with padding frame)";
1533 }
1534 Memory::int_at(padding_pointer) -= shortage_bytes / kPointerSize * 2;
Yang 2012/05/02 11:38:34 Same here.
Peter Rybin 2012/05/02 23:46:33 Done.
1535
1536 StackFrame* pre_pre_frame = frames[top_frame_index - 2];
1537
1538 memmove(padding_start + kPointerSize - shortage_bytes,
1539 padding_start + kPointerSize,
1540 Debug::FramePaddingLayout::kFrameBaseSize * kPointerSize);
1541
1542 pre_top_frame->UpdateFp(pre_top_frame->fp() - shortage_bytes);
1543 pre_pre_frame->SetCallerFp(pre_top_frame->fp());
1544 unused_stack_top -= shortage_bytes;
1545
1546 STATIC_ASSERT(sizeof(Address) == kPointerSize);
1547 top_frame_pc_address -= shortage_bytes / kPointerSize;
1548 } else {
1549 return "Not enough space for frame dropper frame";
1550 }
1509 } 1551 }
1510 1552
1511 // Committing now. After this point we should return only NULL value. 1553 // Committing now. After this point we should return only NULL value.
1512 1554
1513 FixTryCatchHandler(pre_top_frame, bottom_js_frame); 1555 FixTryCatchHandler(pre_top_frame, bottom_js_frame);
1514 // Make sure FixTryCatchHandler is idempotent. 1556 // Make sure FixTryCatchHandler is idempotent.
1515 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); 1557 ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame));
1516 1558
1517 Handle<Code> code = Isolate::Current()->builtins()->FrameDropper_LiveEdit(); 1559 Handle<Code> code = Isolate::Current()->builtins()->FrameDropper_LiveEdit();
1518 top_frame->set_pc(code->entry()); 1560 *top_frame_pc_address = code->entry();
1519 pre_top_frame->SetCallerFp(bottom_js_frame->fp()); 1561 pre_top_frame->SetCallerFp(bottom_js_frame->fp());
1520 1562
1521 *restarter_frame_function_pointer = 1563 *restarter_frame_function_pointer =
1522 Debug::SetUpFrameDropperFrame(bottom_js_frame, code); 1564 Debug::SetUpFrameDropperFrame(bottom_js_frame, code);
1523 1565
1524 ASSERT((**restarter_frame_function_pointer)->IsJSFunction()); 1566 ASSERT((**restarter_frame_function_pointer)->IsJSFunction());
1525 1567
1526 for (Address a = unused_stack_top; 1568 for (Address a = unused_stack_top;
1527 a < unused_stack_bottom; 1569 a < unused_stack_bottom;
1528 a += kPointerSize) { 1570 a += kPointerSize) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 1807
1766 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 1808 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
1767 return false; 1809 return false;
1768 } 1810 }
1769 1811
1770 #endif // ENABLE_DEBUGGER_SUPPORT 1812 #endif // ENABLE_DEBUGGER_SUPPORT
1771 1813
1772 1814
1773 1815
1774 } } // namespace v8::internal 1816 } } // namespace v8::internal
OLDNEW
« src/ia32/debug-ia32.cc ('K') | « src/ia32/debug-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698