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

Side by Side Diff: src/isolate.h

Issue 7060010: Merge bleeding edge into the GC branch up to 7948. The asserts (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 7 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
« no previous file with comments | « src/ic.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 inline void set_try_catch_handler_address(Address address) { 217 inline void set_try_catch_handler_address(Address address) {
218 try_catch_handler_address_ = address; 218 try_catch_handler_address_ = address;
219 } 219 }
220 220
221 void Free() { 221 void Free() {
222 ASSERT(!has_pending_message_); 222 ASSERT(!has_pending_message_);
223 ASSERT(!external_caught_exception_); 223 ASSERT(!external_caught_exception_);
224 ASSERT(try_catch_handler_address_ == NULL); 224 ASSERT(try_catch_handler_address_ == NULL);
225 } 225 }
226 226
227 Isolate* isolate_;
227 // The context where the current execution method is created and for variable 228 // The context where the current execution method is created and for variable
228 // lookups. 229 // lookups.
229 Context* context_; 230 Context* context_;
230 ThreadId thread_id_; 231 ThreadId thread_id_;
231 MaybeObject* pending_exception_; 232 MaybeObject* pending_exception_;
232 bool has_pending_message_; 233 bool has_pending_message_;
233 Object* pending_message_obj_; 234 Object* pending_message_obj_;
234 Script* pending_message_script_; 235 Script* pending_message_script_;
235 int pending_message_start_pos_; 236 int pending_message_start_pos_;
236 int pending_message_end_pos_; 237 int pending_message_end_pos_;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 void TearDown(); 481 void TearDown();
481 482
482 bool IsDefaultIsolate() const { return this == default_isolate_; } 483 bool IsDefaultIsolate() const { return this == default_isolate_; }
483 484
484 // Ensures that process-wide resources and the default isolate have been 485 // Ensures that process-wide resources and the default isolate have been
485 // allocated. It is only necessary to call this method in rare casses, for 486 // allocated. It is only necessary to call this method in rare casses, for
486 // example if you are using V8 from within the body of a static initializer. 487 // example if you are using V8 from within the body of a static initializer.
487 // Safe to call multiple times. 488 // Safe to call multiple times.
488 static void EnsureDefaultIsolate(); 489 static void EnsureDefaultIsolate();
489 490
491 // Find the PerThread for this particular (isolate, thread) combination
492 // If one does not yet exist, return null.
493 PerIsolateThreadData* FindPerThreadDataForThisThread();
494
490 #ifdef ENABLE_DEBUGGER_SUPPORT 495 #ifdef ENABLE_DEBUGGER_SUPPORT
491 // Get the debugger from the default isolate. Preinitializes the 496 // Get the debugger from the default isolate. Preinitializes the
492 // default isolate if needed. 497 // default isolate if needed.
493 static Debugger* GetDefaultIsolateDebugger(); 498 static Debugger* GetDefaultIsolateDebugger();
494 #endif 499 #endif
495 500
496 // Get the stack guard from the default isolate. Preinitializes the 501 // Get the stack guard from the default isolate. Preinitializes the
497 // default isolate if needed. 502 // default isolate if needed.
498 static StackGuard* GetDefaultIsolateStackGuard(); 503 static StackGuard* GetDefaultIsolateStackGuard();
499 504
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // in JS or not. 987 // in JS or not.
983 ASSERT((current_state == JS) == (state == JS)); 988 ASSERT((current_state == JS) == (state == JS));
984 } 989 }
985 } 990 }
986 thread_local_top_.current_vm_state_ = state; 991 thread_local_top_.current_vm_state_ = state;
987 } 992 }
988 #endif 993 #endif
989 994
990 void ResetEagerOptimizingData(); 995 void ResetEagerOptimizingData();
991 996
997 void SetData(void* data) { embedder_data_ = data; }
998 void* GetData() { return embedder_data_; }
999
992 private: 1000 private:
993 Isolate(); 1001 Isolate();
994 1002
995 // The per-process lock should be acquired before the ThreadDataTable is 1003 // The per-process lock should be acquired before the ThreadDataTable is
996 // modified. 1004 // modified.
997 class ThreadDataTable { 1005 class ThreadDataTable {
998 public: 1006 public:
999 ThreadDataTable(); 1007 ThreadDataTable();
1000 ~ThreadDataTable(); 1008 ~ThreadDataTable();
1001 1009
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 EntryStackItem* entry_stack_; 1067 EntryStackItem* entry_stack_;
1060 1068
1061 // Allocate and insert PerIsolateThreadData into the ThreadDataTable 1069 // Allocate and insert PerIsolateThreadData into the ThreadDataTable
1062 // (regardless of whether such data already exists). 1070 // (regardless of whether such data already exists).
1063 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); 1071 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id);
1064 1072
1065 // Find the PerThread for this particular (isolate, thread) combination. 1073 // Find the PerThread for this particular (isolate, thread) combination.
1066 // If one does not yet exist, allocate a new one. 1074 // If one does not yet exist, allocate a new one.
1067 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); 1075 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();
1068 1076
1069 // PreInits and returns a default isolate. Needed when a new thread tries 1077 // PreInits and returns a default isolate. Needed when a new thread tries
1070 // to create a Locker for the first time (the lock itself is in the isolate). 1078 // to create a Locker for the first time (the lock itself is in the isolate).
1071 static Isolate* GetDefaultIsolateForLocking(); 1079 static Isolate* GetDefaultIsolateForLocking();
1072 1080
1073 // Initializes the current thread to run this Isolate. 1081 // Initializes the current thread to run this Isolate.
1074 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate 1082 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate
1075 // at the same time, this should be prevented using external locking. 1083 // at the same time, this should be prevented using external locking.
1076 void Enter(); 1084 void Enter();
1077 1085
1078 // Exits the current thread. The previosuly entered Isolate is restored 1086 // Exits the current thread. The previosuly entered Isolate is restored
1079 // for the thread. 1087 // for the thread.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; 1152 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_;
1145 StringInputBuffer objects_string_compare_buffer_a_; 1153 StringInputBuffer objects_string_compare_buffer_a_;
1146 StringInputBuffer objects_string_compare_buffer_b_; 1154 StringInputBuffer objects_string_compare_buffer_b_;
1147 StaticResource<StringInputBuffer> objects_string_input_buffer_; 1155 StaticResource<StringInputBuffer> objects_string_input_buffer_;
1148 unibrow::Mapping<unibrow::Ecma262Canonicalize> 1156 unibrow::Mapping<unibrow::Ecma262Canonicalize>
1149 regexp_macro_assembler_canonicalize_; 1157 regexp_macro_assembler_canonicalize_;
1150 RegExpStack* regexp_stack_; 1158 RegExpStack* regexp_stack_;
1151 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; 1159 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_;
1152 ZoneObjectList frame_element_constant_list_; 1160 ZoneObjectList frame_element_constant_list_;
1153 ZoneObjectList result_constant_list_; 1161 ZoneObjectList result_constant_list_;
1162 void* embedder_data_;
1154 1163
1155 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ 1164 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
1156 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) 1165 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
1157 bool simulator_initialized_; 1166 bool simulator_initialized_;
1158 HashMap* simulator_i_cache_; 1167 HashMap* simulator_i_cache_;
1159 Redirection* simulator_redirection_; 1168 Redirection* simulator_redirection_;
1160 #endif 1169 #endif
1161 1170
1162 #ifdef DEBUG 1171 #ifdef DEBUG
1163 // A static array of histogram info for each type. 1172 // A static array of histogram info for each type.
(...skipping 27 matching lines...) Expand all
1191 // between compilation units. 1200 // between compilation units.
1192 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 1201 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
1193 static const intptr_t name##_debug_offset_; 1202 static const intptr_t name##_debug_offset_;
1194 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 1203 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
1195 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 1204 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
1196 #undef ISOLATE_FIELD_OFFSET 1205 #undef ISOLATE_FIELD_OFFSET
1197 #endif 1206 #endif
1198 1207
1199 friend class ExecutionAccess; 1208 friend class ExecutionAccess;
1200 friend class IsolateInitializer; 1209 friend class IsolateInitializer;
1210 friend class ThreadManager;
1211 friend class Simulator;
1212 friend class StackGuard;
1201 friend class ThreadId; 1213 friend class ThreadId;
1202 friend class v8::Isolate; 1214 friend class v8::Isolate;
1203 friend class v8::Locker; 1215 friend class v8::Locker;
1216 friend class v8::Unlocker;
1204 1217
1205 DISALLOW_COPY_AND_ASSIGN(Isolate); 1218 DISALLOW_COPY_AND_ASSIGN(Isolate);
1206 }; 1219 };
1207 1220
1208 1221
1209 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the 1222 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the
1210 // class as a work around for a bug in the generated code found with these 1223 // class as a work around for a bug in the generated code found with these
1211 // versions of GCC. See V8 issue 122 for details. 1224 // versions of GCC. See V8 issue 122 for details.
1212 class SaveContext BASE_EMBEDDED { 1225 class SaveContext BASE_EMBEDDED {
1213 public: 1226 public:
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 1387
1375 } } // namespace v8::internal 1388 } } // namespace v8::internal
1376 1389
1377 // TODO(isolates): Get rid of these -inl.h includes and place them only where 1390 // TODO(isolates): Get rid of these -inl.h includes and place them only where
1378 // they're needed. 1391 // they're needed.
1379 #include "allocation-inl.h" 1392 #include "allocation-inl.h"
1380 #include "zone-inl.h" 1393 #include "zone-inl.h"
1381 #include "frames-inl.h" 1394 #include "frames-inl.h"
1382 1395
1383 #endif // V8_ISOLATE_H_ 1396 #endif // V8_ISOLATE_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698