| 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 10399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10410 return Failure::Exception(); | 10410 return Failure::Exception(); |
| 10411 } | 10411 } |
| 10412 } | 10412 } |
| 10413 | 10413 |
| 10414 | 10414 |
| 10415 // Sets a v8 flag. | 10415 // Sets a v8 flag. |
| 10416 static MaybeObject* Runtime_SetFlags(Arguments args) { | 10416 static MaybeObject* Runtime_SetFlags(Arguments args) { |
| 10417 CONVERT_CHECKED(String, arg, args[0]); | 10417 CONVERT_CHECKED(String, arg, args[0]); |
| 10418 SmartPointer<char> flags = | 10418 SmartPointer<char> flags = |
| 10419 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 10419 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
| 10420 FlagList::SetFlagsFromString(*flags, strlen(*flags)); | 10420 FlagList::SetFlagsFromString(*flags, StrLength(*flags)); |
| 10421 return Heap::undefined_value(); | 10421 return Heap::undefined_value(); |
| 10422 } | 10422 } |
| 10423 | 10423 |
| 10424 | 10424 |
| 10425 // Performs a GC. | 10425 // Performs a GC. |
| 10426 // Presently, it only does a full GC. | 10426 // Presently, it only does a full GC. |
| 10427 static MaybeObject* Runtime_CollectGarbage(Arguments args) { | 10427 static MaybeObject* Runtime_CollectGarbage(Arguments args) { |
| 10428 Heap::CollectAllGarbage(true); | 10428 Heap::CollectAllGarbage(true); |
| 10429 return Heap::undefined_value(); | 10429 return Heap::undefined_value(); |
| 10430 } | 10430 } |
| 10431 | 10431 |
| 10432 | 10432 |
| 10433 // Gets the current heap usage. | 10433 // Gets the current heap usage. |
| 10434 static MaybeObject* Runtime_GetHeapUsage(Arguments args) { | 10434 static MaybeObject* Runtime_GetHeapUsage(Arguments args) { |
| 10435 int usage = Heap::SizeOfObjects(); | 10435 int usage = static_cast<int>(Heap::SizeOfObjects()); |
| 10436 if (!Smi::IsValid(usage)) { | 10436 if (!Smi::IsValid(usage)) { |
| 10437 return *Factory::NewNumberFromInt(usage); | 10437 return *Factory::NewNumberFromInt(usage); |
| 10438 } | 10438 } |
| 10439 return Smi::FromInt(usage); | 10439 return Smi::FromInt(usage); |
| 10440 } | 10440 } |
| 10441 #endif // ENABLE_DEBUGGER_SUPPORT | 10441 #endif // ENABLE_DEBUGGER_SUPPORT |
| 10442 | 10442 |
| 10443 | 10443 |
| 10444 #ifdef ENABLE_LOGGING_AND_PROFILING | 10444 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 10445 static MaybeObject* Runtime_ProfilerResume(Arguments args) { | 10445 static MaybeObject* Runtime_ProfilerResume(Arguments args) { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10828 } else { | 10828 } else { |
| 10829 // Handle last resort GC and make sure to allow future allocations | 10829 // Handle last resort GC and make sure to allow future allocations |
| 10830 // to grow the heap without causing GCs (if possible). | 10830 // to grow the heap without causing GCs (if possible). |
| 10831 Counters::gc_last_resort_from_js.Increment(); | 10831 Counters::gc_last_resort_from_js.Increment(); |
| 10832 Heap::CollectAllGarbage(false); | 10832 Heap::CollectAllGarbage(false); |
| 10833 } | 10833 } |
| 10834 } | 10834 } |
| 10835 | 10835 |
| 10836 | 10836 |
| 10837 } } // namespace v8::internal | 10837 } } // namespace v8::internal |
| OLD | NEW |