OLD | NEW |
---|---|
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 10709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10720 return Heap::undefined_value(); | 10720 return Heap::undefined_value(); |
10721 } | 10721 } |
10722 | 10722 |
10723 | 10723 |
10724 static MaybeObject* Runtime_IS_VAR(Arguments args) { | 10724 static MaybeObject* Runtime_IS_VAR(Arguments args) { |
10725 UNREACHABLE(); // implemented as macro in the parser | 10725 UNREACHABLE(); // implemented as macro in the parser |
10726 return NULL; | 10726 return NULL; |
10727 } | 10727 } |
10728 | 10728 |
10729 | 10729 |
10730 #ifdef ENABLE_DEBUGGER_SUPPORT | |
Søren Thygesen Gjesse
2011/01/03 08:56:07
I think there is a long section above guarded with
marklam
2011/01/04 20:12:13
Done.
| |
10731 // Sets a v8 flag. | |
10732 static MaybeObject* Runtime_SetFlag(Arguments args) { | |
Søren Thygesen Gjesse
2011/01/03 08:56:07
Please change name to plural.
marklam
2011/01/04 20:12:13
Done.
| |
10733 CONVERT_CHECKED(String, arg, args[0]); | |
10734 SmartPointer<char> flags = | |
10735 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | |
10736 FlagList::SetFlagsFromString(*flags, strlen(*flags)); | |
10737 return Heap::undefined_value(); | |
10738 } | |
10739 | |
10740 | |
10741 // Performs a GC. | |
10742 // Presently, it only does a full GC. | |
10743 static MaybeObject* Runtime_DoGC(Arguments args) { | |
Søren Thygesen Gjesse
2011/01/03 08:56:07
How about CollectGarbage (or just GC) instead of D
marklam
2011/01/04 20:12:13
Done.
| |
10744 Heap::CollectAllGarbage(true); | |
10745 return Heap::undefined_value(); | |
10746 } | |
10747 | |
10748 | |
10749 // Gets the current heap usage. | |
10750 static MaybeObject* Runtime_GetHeapUsage(Arguments args) { | |
10751 int usage = Heap::SizeOfObjects(); | |
10752 if (!Smi::IsValid(usage)) { | |
10753 return *Factory::NewNumberFromInt(usage); | |
10754 } | |
10755 return Smi::FromInt(usage); | |
10756 } | |
10757 #endif // ENABLE_DEBUGGER_SUPPORT | |
10758 | |
10759 | |
10730 // ---------------------------------------------------------------------------- | 10760 // ---------------------------------------------------------------------------- |
10731 // Implementation of Runtime | 10761 // Implementation of Runtime |
10732 | 10762 |
10733 #define F(name, number_of_args, result_size) \ | 10763 #define F(name, number_of_args, result_size) \ |
10734 { Runtime::k##name, Runtime::RUNTIME, #name, \ | 10764 { Runtime::k##name, Runtime::RUNTIME, #name, \ |
10735 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, | 10765 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size }, |
10736 | 10766 |
10737 | 10767 |
10738 #define I(name, number_of_args, result_size) \ | 10768 #define I(name, number_of_args, result_size) \ |
10739 { Runtime::kInline##name, Runtime::INLINE, \ | 10769 { Runtime::kInline##name, Runtime::INLINE, \ |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10796 } else { | 10826 } else { |
10797 // Handle last resort GC and make sure to allow future allocations | 10827 // Handle last resort GC and make sure to allow future allocations |
10798 // to grow the heap without causing GCs (if possible). | 10828 // to grow the heap without causing GCs (if possible). |
10799 Counters::gc_last_resort_from_js.Increment(); | 10829 Counters::gc_last_resort_from_js.Increment(); |
10800 Heap::CollectAllGarbage(false); | 10830 Heap::CollectAllGarbage(false); |
10801 } | 10831 } |
10802 } | 10832 } |
10803 | 10833 |
10804 | 10834 |
10805 } } // namespace v8::internal | 10835 } } // namespace v8::internal |
OLD | NEW |