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.cc

Issue 999273003: Revert of Debugger: deduplicate shared function info when setting script break points. (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/compiler.cc ('k') | src/liveedit.cc » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 if (!HasDebugInfo(shared)) { 1494 if (!HasDebugInfo(shared)) {
1495 return Handle<Object>(heap->undefined_value(), isolate); 1495 return Handle<Object>(heap->undefined_value(), isolate);
1496 } 1496 }
1497 Handle<DebugInfo> debug_info = GetDebugInfo(shared); 1497 Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1498 if (debug_info->GetBreakPointCount() == 0) { 1498 if (debug_info->GetBreakPointCount() == 0) {
1499 return Handle<Object>(heap->undefined_value(), isolate); 1499 return Handle<Object>(heap->undefined_value(), isolate);
1500 } 1500 }
1501 Handle<FixedArray> locations = 1501 Handle<FixedArray> locations =
1502 isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount()); 1502 isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
1503 int count = 0; 1503 int count = 0;
1504 for (int i = 0; i < debug_info->break_points()->length(); ++i) { 1504 for (int i = 0; i < debug_info->break_points()->length(); i++) {
1505 if (!debug_info->break_points()->get(i)->IsUndefined()) { 1505 if (!debug_info->break_points()->get(i)->IsUndefined()) {
1506 BreakPointInfo* break_point_info = 1506 BreakPointInfo* break_point_info =
1507 BreakPointInfo::cast(debug_info->break_points()->get(i)); 1507 BreakPointInfo::cast(debug_info->break_points()->get(i));
1508 int break_points = break_point_info->GetBreakPointCount(); 1508 if (break_point_info->GetBreakPointCount() > 0) {
1509 if (break_points == 0) continue; 1509 Smi* position = NULL;
1510 Smi* position = NULL; 1510 switch (position_alignment) {
1511 switch (position_alignment) { 1511 case STATEMENT_ALIGNED:
1512 case STATEMENT_ALIGNED: 1512 position = break_point_info->statement_position();
1513 position = break_point_info->statement_position(); 1513 break;
1514 break; 1514 case BREAK_POSITION_ALIGNED:
1515 case BREAK_POSITION_ALIGNED: 1515 position = break_point_info->source_position();
1516 position = break_point_info->source_position(); 1516 break;
1517 break; 1517 }
1518
1519 locations->set(count++, position);
1518 } 1520 }
1519 for (int j = 0; j < break_points; ++j) locations->set(count++, position);
1520 } 1521 }
1521 } 1522 }
1522 return locations; 1523 return locations;
1523 } 1524 }
1524 1525
1525 1526
1526 // Handle stepping into a function. 1527 // Handle stepping into a function.
1527 void Debug::HandleStepIn(Handle<Object> function_obj, Handle<Object> holder, 1528 void Debug::HandleStepIn(Handle<Object> function_obj, Handle<Object> holder,
1528 Address fp, bool is_constructor) { 1529 Address fp, bool is_constructor) {
1529 // Flood getter/setter if we either step in or step to another frame. 1530 // Flood getter/setter if we either step in or step to another frame.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 int code_offset = generators[i]->continuation(); 1810 int code_offset = generators[i]->continuation();
1810 int pc_offset = ComputePcOffsetFromCodeOffset(fun->code(), code_offset); 1811 int pc_offset = ComputePcOffsetFromCodeOffset(fun->code(), code_offset);
1811 generators[i]->set_continuation(pc_offset); 1812 generators[i]->set_continuation(pc_offset);
1812 } 1813 }
1813 } 1814 }
1814 1815
1815 1816
1816 static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared, 1817 static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared,
1817 Object* active_code_marker) { 1818 Object* active_code_marker) {
1818 if (!shared->allows_lazy_compilation()) return true; 1819 if (!shared->allows_lazy_compilation()) return true;
1820 if (!shared->script()->IsScript()) return true;
1819 Object* script = shared->script(); 1821 Object* script = shared->script();
1820 if (!script->IsScript()) return true; 1822 if (!script->IsScript()) return true;
1821 if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true; 1823 if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true;
1822 Code* shared_code = shared->code(); 1824 Code* shared_code = shared->code();
1823 return shared_code->gc_metadata() == active_code_marker; 1825 return shared_code->gc_metadata() == active_code_marker;
1824 } 1826 }
1825 1827
1826 1828
1827 static inline bool HasDebugBreakSlots(Code* code) { 1829 static inline bool HasDebugBreakSlots(Code* code) {
1828 return code->kind() == Code::FUNCTION && code->has_debug_break_slots(); 1830 return code->kind() == Code::FUNCTION && code->has_debug_break_slots();
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 // will compile all inner functions that cannot be compiled without a 2091 // will compile all inner functions that cannot be compiled without a
2090 // context, because Compiler::BuildFunctionInfo checks whether the 2092 // context, because Compiler::BuildFunctionInfo checks whether the
2091 // debugger is active. 2093 // debugger is active.
2092 MaybeHandle<Code> maybe_result = target_function.is_null() 2094 MaybeHandle<Code> maybe_result = target_function.is_null()
2093 ? Compiler::GetUnoptimizedCode(target) 2095 ? Compiler::GetUnoptimizedCode(target)
2094 : Compiler::GetUnoptimizedCode(target_function); 2096 : Compiler::GetUnoptimizedCode(target_function);
2095 if (maybe_result.is_null()) return isolate_->factory()->undefined_value(); 2097 if (maybe_result.is_null()) return isolate_->factory()->undefined_value();
2096 } 2098 }
2097 } // End while loop. 2099 } // End while loop.
2098 2100
2099 // JSFunctions from the same literal may not have the same shared function
2100 // info. Find those JSFunctions and deduplicate the shared function info.
2101 HeapIterator iterator(heap, FLAG_lazy ? HeapIterator::kNoFiltering
2102 : HeapIterator::kFilterUnreachable);
2103 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
2104 if (!obj->IsJSFunction()) continue;
2105 JSFunction* function = JSFunction::cast(obj);
2106 SharedFunctionInfo* shared = function->shared();
2107 if (shared != *target && shared->script() == target->script() &&
2108 shared->start_position_and_type() ==
2109 target->start_position_and_type()) {
2110 function->set_shared(*target);
2111 }
2112 }
2113
2114 return target; 2101 return target;
2115 } 2102 }
2116 2103
2117 2104
2118 // Ensures the debug information is present for shared. 2105 // Ensures the debug information is present for shared.
2119 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, 2106 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
2120 Handle<JSFunction> function) { 2107 Handle<JSFunction> function) {
2121 Isolate* isolate = shared->GetIsolate(); 2108 Isolate* isolate = shared->GetIsolate();
2122 2109
2123 // Return if we already have the debug info for shared. 2110 // Return if we already have the debug info for shared.
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 logger_->DebugEvent("Put", message.text()); 3390 logger_->DebugEvent("Put", message.text());
3404 } 3391 }
3405 3392
3406 3393
3407 void LockingCommandMessageQueue::Clear() { 3394 void LockingCommandMessageQueue::Clear() {
3408 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3395 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3409 queue_.Clear(); 3396 queue_.Clear();
3410 } 3397 }
3411 3398
3412 } } // namespace v8::internal 3399 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698