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

Side by Side Diff: src/runtime.cc

Issue 6816038: Do not rely on uniquiness of pthread_t Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ThreadRef -> ThreadId Created 9 years, 8 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
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 10135 matching lines...) Expand 10 before | Expand all | Expand 10 after
10146 Handle<FixedArray> details = 10146 Handle<FixedArray> details =
10147 isolate->factory()->NewFixedArray(kThreadDetailsSize); 10147 isolate->factory()->NewFixedArray(kThreadDetailsSize);
10148 10148
10149 // Thread index 0 is current thread. 10149 // Thread index 0 is current thread.
10150 if (index == 0) { 10150 if (index == 0) {
10151 // Fill the details. 10151 // Fill the details.
10152 details->set(kThreadDetailsCurrentThreadIndex, 10152 details->set(kThreadDetailsCurrentThreadIndex,
10153 isolate->heap()->true_value()); 10153 isolate->heap()->true_value());
10154 details->set(kThreadDetailsThreadIdIndex, 10154 details->set(kThreadDetailsThreadIdIndex,
10155 Smi::FromInt( 10155 Smi::FromInt(
10156 isolate->thread_manager()->CurrentId())); 10156 ThreadId::Current().ToInteger()));
Vitaly Repeshko 2011/04/11 19:28:52 Fits on the line above?
Dmitry Lomov 2011/04/11 21:41:14 Done.
10157 } else { 10157 } else {
10158 // Find the thread with the requested index. 10158 // Find the thread with the requested index.
10159 int n = 1; 10159 int n = 1;
10160 ThreadState* thread = 10160 ThreadState* thread =
10161 isolate->thread_manager()->FirstThreadStateInUse(); 10161 isolate->thread_manager()->FirstThreadStateInUse();
10162 while (index != n && thread != NULL) { 10162 while (index != n && thread != NULL) {
10163 thread = thread->Next(); 10163 thread = thread->Next();
10164 n++; 10164 n++;
10165 } 10165 }
10166 if (thread == NULL) { 10166 if (thread == NULL) {
10167 return isolate->heap()->undefined_value(); 10167 return isolate->heap()->undefined_value();
10168 } 10168 }
10169 10169
10170 // Fill the details. 10170 // Fill the details.
10171 details->set(kThreadDetailsCurrentThreadIndex, 10171 details->set(kThreadDetailsCurrentThreadIndex,
10172 isolate->heap()->false_value()); 10172 isolate->heap()->false_value());
10173 details->set(kThreadDetailsThreadIdIndex, Smi::FromInt(thread->id())); 10173 details->set(kThreadDetailsThreadIdIndex,
10174 Smi::FromInt(thread->id().ToInteger()));
10174 } 10175 }
10175 10176
10176 // Convert to JS array and return. 10177 // Convert to JS array and return.
10177 return *isolate->factory()->NewJSArrayWithElements(details); 10178 return *isolate->factory()->NewJSArrayWithElements(details);
10178 } 10179 }
10179 10180
10180 10181
10181 // Sets the disable break state 10182 // Sets the disable break state
10182 // args[0]: disable break state 10183 // args[0]: disable break state
10183 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) { 10184 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDisableBreak) {
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
11943 } else { 11944 } else {
11944 // Handle last resort GC and make sure to allow future allocations 11945 // Handle last resort GC and make sure to allow future allocations
11945 // to grow the heap without causing GCs (if possible). 11946 // to grow the heap without causing GCs (if possible).
11946 isolate->counters()->gc_last_resort_from_js()->Increment(); 11947 isolate->counters()->gc_last_resort_from_js()->Increment();
11947 isolate->heap()->CollectAllGarbage(false); 11948 isolate->heap()->CollectAllGarbage(false);
11948 } 11949 }
11949 } 11950 }
11950 11951
11951 11952
11952 } } // namespace v8::internal 11953 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698