| 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 10153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10164 // Allocate array for result. | 10164 // Allocate array for result. |
| 10165 Handle<FixedArray> details = | 10165 Handle<FixedArray> details = |
| 10166 isolate->factory()->NewFixedArray(kThreadDetailsSize); | 10166 isolate->factory()->NewFixedArray(kThreadDetailsSize); |
| 10167 | 10167 |
| 10168 // Thread index 0 is current thread. | 10168 // Thread index 0 is current thread. |
| 10169 if (index == 0) { | 10169 if (index == 0) { |
| 10170 // Fill the details. | 10170 // Fill the details. |
| 10171 details->set(kThreadDetailsCurrentThreadIndex, | 10171 details->set(kThreadDetailsCurrentThreadIndex, |
| 10172 isolate->heap()->true_value()); | 10172 isolate->heap()->true_value()); |
| 10173 details->set(kThreadDetailsThreadIdIndex, | 10173 details->set(kThreadDetailsThreadIdIndex, |
| 10174 Smi::FromInt( | 10174 Smi::FromInt(ThreadId::Current().ToInteger())); |
| 10175 isolate->thread_manager()->CurrentId())); | |
| 10176 } else { | 10175 } else { |
| 10177 // Find the thread with the requested index. | 10176 // Find the thread with the requested index. |
| 10178 int n = 1; | 10177 int n = 1; |
| 10179 ThreadState* thread = | 10178 ThreadState* thread = |
| 10180 isolate->thread_manager()->FirstThreadStateInUse(); | 10179 isolate->thread_manager()->FirstThreadStateInUse(); |
| 10181 while (index != n && thread != NULL) { | 10180 while (index != n && thread != NULL) { |
| 10182 thread = thread->Next(); | 10181 thread = thread->Next(); |
| 10183 n++; | 10182 n++; |
| 10184 } | 10183 } |
| 10185 if (thread == NULL) { | 10184 if (thread == NULL) { |
| 10186 return isolate->heap()->undefined_value(); | 10185 return isolate->heap()->undefined_value(); |
| 10187 } | 10186 } |
| 10188 | 10187 |
| 10189 // Fill the details. | 10188 // Fill the details. |
| 10190 details->set(kThreadDetailsCurrentThreadIndex, | 10189 details->set(kThreadDetailsCurrentThreadIndex, |
| 10191 isolate->heap()->false_value()); | 10190 isolate->heap()->false_value()); |
| 10192 details->set(kThreadDetailsThreadIdIndex, Smi::FromInt(thread->id())); | 10191 details->set(kThreadDetailsThreadIdIndex, |
| 10192 Smi::FromInt(thread->id().ToInteger())); |
| 10193 } | 10193 } |
| 10194 | 10194 |
| 10195 // Convert to JS array and return. | 10195 // Convert to JS array and return. |
| 10196 return *isolate->factory()->NewJSArrayWithElements(details); | 10196 return *isolate->factory()->NewJSArrayWithElements(details); |
| 10197 } | 10197 } |
| 10198 | 10198 |
| 10199 | 10199 |
| 10200 // Sets the disable break state | 10200 // Sets the disable break state |
| 10201 // args[0]: disable break state | 10201 // args[0]: disable break state |
| 10202 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { | 10202 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11962 } else { | 11962 } else { |
| 11963 // Handle last resort GC and make sure to allow future allocations | 11963 // Handle last resort GC and make sure to allow future allocations |
| 11964 // to grow the heap without causing GCs (if possible). | 11964 // to grow the heap without causing GCs (if possible). |
| 11965 isolate->counters()->gc_last_resort_from_js()->Increment(); | 11965 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 11966 isolate->heap()->CollectAllGarbage(false); | 11966 isolate->heap()->CollectAllGarbage(false); |
| 11967 } | 11967 } |
| 11968 } | 11968 } |
| 11969 | 11969 |
| 11970 | 11970 |
| 11971 } } // namespace v8::internal | 11971 } } // namespace v8::internal |
| OLD | NEW |