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

Side by Side Diff: src/runtime.cc

Issue 6351007: Adding debugger interface and runtime functions hooks for supporting... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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/debug-debugger.js ('K') | « src/runtime.h ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 24 matching lines...) Expand all
35 #include "codegen.h" 35 #include "codegen.h"
36 #include "compilation-cache.h" 36 #include "compilation-cache.h"
37 #include "compiler.h" 37 #include "compiler.h"
38 #include "cpu.h" 38 #include "cpu.h"
39 #include "dateparser-inl.h" 39 #include "dateparser-inl.h"
40 #include "debug.h" 40 #include "debug.h"
41 #include "deoptimizer.h" 41 #include "deoptimizer.h"
42 #include "execution.h" 42 #include "execution.h"
43 #include "jsregexp.h" 43 #include "jsregexp.h"
44 #include "liveedit.h" 44 #include "liveedit.h"
45 #include "liveobjectlist.h"
Søren Thygesen Gjesse 2011/01/19 08:36:40 This suggests that the actual lol implementation l
marklam 2011/01/19 09:04:02 Mikhail's suggested division of the commits was to
45 #include "parser.h" 46 #include "parser.h"
46 #include "platform.h" 47 #include "platform.h"
47 #include "runtime.h" 48 #include "runtime.h"
48 #include "runtime-profiler.h" 49 #include "runtime-profiler.h"
49 #include "scopeinfo.h" 50 #include "scopeinfo.h"
50 #include "smart-pointer.h" 51 #include "smart-pointer.h"
51 #include "stub-cache.h" 52 #include "stub-cache.h"
52 #include "v8threads.h" 53 #include "v8threads.h"
53 #include "string-search.h" 54 #include "string-search.h"
54 55
(...skipping 10411 matching lines...) Expand 10 before | Expand all | Expand 10 after
10466 10467
10467 10468
10468 // Gets the current heap usage. 10469 // Gets the current heap usage.
10469 static MaybeObject* Runtime_GetHeapUsage(Arguments args) { 10470 static MaybeObject* Runtime_GetHeapUsage(Arguments args) {
10470 int usage = static_cast<int>(Heap::SizeOfObjects()); 10471 int usage = static_cast<int>(Heap::SizeOfObjects());
10471 if (!Smi::IsValid(usage)) { 10472 if (!Smi::IsValid(usage)) {
10472 return *Factory::NewNumberFromInt(usage); 10473 return *Factory::NewNumberFromInt(usage);
10473 } 10474 }
10474 return Smi::FromInt(usage); 10475 return Smi::FromInt(usage);
10475 } 10476 }
10477
10478
10479 // Captures a live object list from the present heap.
10480 static MaybeObject* Runtime_HasLOLEnabled(Arguments args) {
10481 #ifdef LIVE_OBJECT_LIST
10482 return Heap::true_value();
10483 #else
10484 return Heap::false_value();
10485 #endif
10486 }
10487
10488
10489 // Captures a live object list from the present heap.
10490 static MaybeObject* Runtime_CaptureLOL(Arguments args) {
10491 #ifdef LIVE_OBJECT_LIST
10492 return LiveObjectList::Capture();
10493 #else
10494 return Heap::undefined_value();
10495 #endif
10496 }
10497
10498
10499 // Deletes the specified live object list.
10500 static MaybeObject* Runtime_DeleteLOL(Arguments args) {
10501 #ifdef LIVE_OBJECT_LIST
10502 CONVERT_SMI_CHECKED(id, args[0]);
10503 bool success = LiveObjectList::Delete(id);
10504 return success ? Heap::true_value() : Heap::false_value();
10505 #else
10506 return Heap::undefined_value();
10507 #endif
10508 }
10509
10510
10511 // Generates the response to a debugger request for a dump of the objects
10512 // contained in the difference between the captured live object lists
10513 // specified by id1 and id2.
10514 // If id1 is 0 (i.e. not a valid lol), then the whole of lol id2 will be
10515 // dumped.
10516 static MaybeObject* Runtime_DumpLOL(Arguments args) {
10517 #ifdef LIVE_OBJECT_LIST
10518 HandleScope scope;
10519 CONVERT_SMI_CHECKED(id1, args[0]);
10520 CONVERT_SMI_CHECKED(id2, args[1]);
10521 CONVERT_SMI_CHECKED(start, args[2]);
10522 CONVERT_SMI_CHECKED(count, args[3]);
10523 CONVERT_ARG_CHECKED(JSObject, filter_obj, 4);
10524 EnterDebugger enter_debugger;
10525 return LiveObjectList::Dump(id1, id2, start, count, filter_obj);
10526 #else
10527 return Heap::undefined_value();
10528 #endif
10529 }
10530
10531
10532 // Gets the specified object as requested by the debugger.
10533 // This is only used for obj ids shown in live object lists.
10534 static MaybeObject* Runtime_GetLOLObj(Arguments args) {
10535 #ifdef LIVE_OBJECT_LIST
10536 CONVERT_SMI_CHECKED(obj_id, args[0]);
10537 Object* result = LiveObjectList::GetObj(obj_id);
10538 return result;
10539 #else
10540 return Heap::undefined_value();
10541 #endif
10542 }
10543
10544
10545 // Gets the obj id for the specified address if valid.
10546 // This is only used for obj ids shown in live object lists.
10547 static MaybeObject* Runtime_GetLOLObjId(Arguments args) {
10548 #ifdef LIVE_OBJECT_LIST
10549 HandleScope scope;
10550 CONVERT_ARG_CHECKED(String, address, 0);
10551 Object* result = LiveObjectList::GetObjId(address);
10552 return result;
10553 #else
10554 return Heap::undefined_value();
10555 #endif
10556 }
10557
10558
10559 // Gets the retainers that references the specified object alive.
10560 static MaybeObject* Runtime_GetLOLObjRetainers(Arguments args) {
10561 #ifdef LIVE_OBJECT_LIST
10562 HandleScope scope;
10563 CONVERT_SMI_CHECKED(obj_id, args[0]);
10564 RUNTIME_ASSERT(args[1]->IsUndefined() || args[1]->IsJSObject());
10565 RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsBoolean());
10566 RUNTIME_ASSERT(args[3]->IsUndefined() || args[3]->IsSmi());
10567 RUNTIME_ASSERT(args[4]->IsUndefined() || args[4]->IsSmi());
10568 CONVERT_ARG_CHECKED(JSObject, filter_obj, 5);
10569
10570 Handle<JSObject> instance_filter;
10571 if (args[1]->IsJSObject()) {
10572 instance_filter = args.at<JSObject>(1);
10573 }
10574 bool verbose = false;
10575 if (args[2]->IsBoolean()) {
10576 verbose = args[2]->IsTrue();
10577 }
10578 int start = 0;
10579 if (args[3]->IsSmi()) {
10580 start = Smi::cast(args[3])->value();
10581 }
10582 int limit = Smi::kMaxValue;
10583 if (args[4]->IsSmi()) {
10584 limit = Smi::cast(args[4])->value();
10585 }
10586
10587 return LiveObjectList::GetObjRetainers(obj_id,
10588 instance_filter,
10589 verbose,
10590 start,
10591 limit,
10592 filter_obj);
10593 #else
10594 return Heap::undefined_value();
10595 #endif
10596 }
10597
10598
10599 // Gets the reference path between 2 objects.
10600 static MaybeObject* Runtime_GetLOLPath(Arguments args) {
10601 #ifdef LIVE_OBJECT_LIST
10602 HandleScope scope;
10603 CONVERT_SMI_CHECKED(obj_id1, args[0]);
10604 CONVERT_SMI_CHECKED(obj_id2, args[1]);
10605 RUNTIME_ASSERT(args[2]->IsUndefined() || args[2]->IsJSObject());
10606
10607 Handle<JSObject> instance_filter;
10608 if (args[2]->IsJSObject()) {
10609 instance_filter = args.at<JSObject>(2);
10610 }
10611
10612 Object* result =
10613 LiveObjectList::GetPath(obj_id1, obj_id2, instance_filter);
10614 return result;
10615 #else
10616 return Heap::undefined_value();
10617 #endif
10618 }
10619
10620
10621 // Generates the response to a debugger request for a list of all
10622 // previously captured live object lists.
10623 static MaybeObject* Runtime_InfoLOL(Arguments args) {
10624 #ifdef LIVE_OBJECT_LIST
10625 CONVERT_SMI_CHECKED(start, args[0]);
10626 CONVERT_SMI_CHECKED(count, args[1]);
10627 return LiveObjectList::Info(start, count);
10628 #else
10629 return Heap::undefined_value();
10630 #endif
10631 }
10632
10633
10634 // Gets a dump of the specified object as requested by the debugger.
10635 // This is only used for obj ids shown in live object lists.
10636 static MaybeObject* Runtime_PrintLOLObj(Arguments args) {
10637 #ifdef LIVE_OBJECT_LIST
10638 HandleScope scope;
10639 CONVERT_SMI_CHECKED(obj_id, args[0]);
10640 Object* result = LiveObjectList::PrintObj(obj_id);
10641 return result;
10642 #else
10643 return Heap::undefined_value();
10644 #endif
10645 }
10646
10647
10648 // Resets and releases all previously captured live object lists.
10649 static MaybeObject* Runtime_ResetLOL(Arguments args) {
10650 #ifdef LIVE_OBJECT_LIST
10651 LiveObjectList::Reset();
10652 return Heap::undefined_value();
10653 #else
10654 return Heap::undefined_value();
10655 #endif
10656 }
10657
10658
10659 // Generates the response to a debugger request for a summary of the types
10660 // of objects in the difference between the captured live object lists
10661 // specified by id1 and id2.
10662 // If id1 is 0 (i.e. not a valid lol), then the whole of lol id2 will be
10663 // summarized.
10664 static MaybeObject* Runtime_SummarizeLOL(Arguments args) {
10665 #ifdef LIVE_OBJECT_LIST
10666 HandleScope scope;
10667 CONVERT_SMI_CHECKED(id1, args[0]);
10668 CONVERT_SMI_CHECKED(id2, args[1]);
10669 CONVERT_ARG_CHECKED(JSObject, filter_obj, 2);
10670
10671 EnterDebugger enter_debugger;
10672 return LiveObjectList::Summarize(id1, id2, filter_obj);
10673 #else
10674 return Heap::undefined_value();
10675 #endif
10676 }
10677
10476 #endif // ENABLE_DEBUGGER_SUPPORT 10678 #endif // ENABLE_DEBUGGER_SUPPORT
10477 10679
10478 10680
10479 #ifdef ENABLE_LOGGING_AND_PROFILING 10681 #ifdef ENABLE_LOGGING_AND_PROFILING
10480 static MaybeObject* Runtime_ProfilerResume(Arguments args) { 10682 static MaybeObject* Runtime_ProfilerResume(Arguments args) {
10481 NoHandleAllocation ha; 10683 NoHandleAllocation ha;
10482 ASSERT(args.length() == 2); 10684 ASSERT(args.length() == 2);
10483 10685
10484 CONVERT_CHECKED(Smi, smi_modules, args[0]); 10686 CONVERT_CHECKED(Smi, smi_modules, args[0]);
10485 CONVERT_CHECKED(Smi, smi_tag, args[1]); 10687 CONVERT_CHECKED(Smi, smi_tag, args[1]);
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
10867 } else { 11069 } else {
10868 // Handle last resort GC and make sure to allow future allocations 11070 // Handle last resort GC and make sure to allow future allocations
10869 // to grow the heap without causing GCs (if possible). 11071 // to grow the heap without causing GCs (if possible).
10870 Counters::gc_last_resort_from_js.Increment(); 11072 Counters::gc_last_resort_from_js.Increment();
10871 Heap::CollectAllGarbage(false); 11073 Heap::CollectAllGarbage(false);
10872 } 11074 }
10873 } 11075 }
10874 11076
10875 11077
10876 } } // namespace v8::internal 11078 } } // namespace v8::internal
OLDNEW
« src/debug-debugger.js ('K') | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698