| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 class ExternalReferenceTable; | 68 class ExternalReferenceTable; |
| 69 class Factory; | 69 class Factory; |
| 70 class FunctionInfoListener; | 70 class FunctionInfoListener; |
| 71 class HandleScopeImplementer; | 71 class HandleScopeImplementer; |
| 72 class HeapProfiler; | 72 class HeapProfiler; |
| 73 class HStatistics; | 73 class HStatistics; |
| 74 class HTracer; | 74 class HTracer; |
| 75 class InlineRuntimeFunctionsTable; | 75 class InlineRuntimeFunctionsTable; |
| 76 class NoAllocationStringAllocator; | 76 class NoAllocationStringAllocator; |
| 77 class InnerPointerToCodeCache; | 77 class InnerPointerToCodeCache; |
| 78 class MarkingThread; | |
| 79 class PreallocatedMemoryThread; | 78 class PreallocatedMemoryThread; |
| 80 class RandomNumberGenerator; | 79 class RandomNumberGenerator; |
| 81 class RegExpStack; | 80 class RegExpStack; |
| 82 class SaveContext; | 81 class SaveContext; |
| 83 class UnicodeCache; | 82 class UnicodeCache; |
| 84 class ConsStringIteratorOp; | 83 class ConsStringIteratorOp; |
| 85 class StringTracker; | 84 class StringTracker; |
| 86 class StubCache; | 85 class StubCache; |
| 87 class SweeperThread; | 86 class SweeperThread; |
| 88 class ThreadManager; | 87 class ThreadManager; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 MaybeObject* scheduled_exception_; | 267 MaybeObject* scheduled_exception_; |
| 269 bool external_caught_exception_; | 268 bool external_caught_exception_; |
| 270 SaveContext* save_context_; | 269 SaveContext* save_context_; |
| 271 v8::TryCatch* catcher_; | 270 v8::TryCatch* catcher_; |
| 272 | 271 |
| 273 // Stack. | 272 // Stack. |
| 274 Address c_entry_fp_; // the frame pointer of the top c entry frame | 273 Address c_entry_fp_; // the frame pointer of the top c entry frame |
| 275 Address handler_; // try-blocks are chained through the stack | 274 Address handler_; // try-blocks are chained through the stack |
| 276 | 275 |
| 277 #ifdef USE_SIMULATOR | 276 #ifdef USE_SIMULATOR |
| 278 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_A64 || V8_TARGET_ARCH_MIPS | |
| 279 Simulator* simulator_; | 277 Simulator* simulator_; |
| 280 #endif | 278 #endif |
| 281 #endif // USE_SIMULATOR | |
| 282 | 279 |
| 283 Address js_entry_sp_; // the stack pointer of the bottom JS entry frame | 280 Address js_entry_sp_; // the stack pointer of the bottom JS entry frame |
| 284 // the external callback we're currently in | 281 // the external callback we're currently in |
| 285 ExternalCallbackScope* external_callback_scope_; | 282 ExternalCallbackScope* external_callback_scope_; |
| 286 StateTag current_vm_state_; | 283 StateTag current_vm_state_; |
| 287 | 284 |
| 288 // Generated code scratch locations. | 285 // Generated code scratch locations. |
| 289 int32_t formal_count_; | 286 int32_t formal_count_; |
| 290 | 287 |
| 291 // Call back function to report unsafe JS accesses. | 288 // Call back function to report unsafe JS accesses. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 302 | 299 |
| 303 Address try_catch_handler_address_; | 300 Address try_catch_handler_address_; |
| 304 }; | 301 }; |
| 305 | 302 |
| 306 | 303 |
| 307 class SystemThreadManager { | 304 class SystemThreadManager { |
| 308 public: | 305 public: |
| 309 enum ParallelSystemComponent { | 306 enum ParallelSystemComponent { |
| 310 PARALLEL_SWEEPING, | 307 PARALLEL_SWEEPING, |
| 311 CONCURRENT_SWEEPING, | 308 CONCURRENT_SWEEPING, |
| 312 PARALLEL_MARKING, | |
| 313 PARALLEL_RECOMPILATION | 309 PARALLEL_RECOMPILATION |
| 314 }; | 310 }; |
| 315 | 311 |
| 316 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); | 312 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); |
| 317 | 313 |
| 318 static const int kMaxThreads = 4; | 314 static const int kMaxThreads = 4; |
| 319 }; | 315 }; |
| 320 | 316 |
| 321 | 317 |
| 322 #ifdef ENABLE_DEBUGGER_SUPPORT | 318 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 StackTrace::StackTraceOptions options); | 747 StackTrace::StackTraceOptions options); |
| 752 | 748 |
| 753 Handle<JSArray> CaptureSimpleStackTrace(Handle<JSObject> error_object, | 749 Handle<JSArray> CaptureSimpleStackTrace(Handle<JSObject> error_object, |
| 754 Handle<Object> caller, | 750 Handle<Object> caller, |
| 755 int limit); | 751 int limit); |
| 756 void CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object); | 752 void CaptureAndSetDetailedStackTrace(Handle<JSObject> error_object); |
| 757 | 753 |
| 758 // Returns if the top context may access the given global object. If | 754 // Returns if the top context may access the given global object. If |
| 759 // the result is false, the pending exception is guaranteed to be | 755 // the result is false, the pending exception is guaranteed to be |
| 760 // set. | 756 // set. |
| 757 |
| 758 // TODO(yangguo): temporary wrappers |
| 759 bool MayNamedAccessWrapper(Handle<JSObject> receiver, |
| 760 Handle<Object> key, |
| 761 v8::AccessType type) { |
| 762 return MayNamedAccess(*receiver, *key, type); |
| 763 } |
| 764 bool MayIndexedAccessWrapper(Handle<JSObject> receiver, |
| 765 uint32_t index, |
| 766 v8::AccessType type) { |
| 767 return MayIndexedAccess(*receiver, index, type); |
| 768 } |
| 769 |
| 761 bool MayNamedAccess(JSObject* receiver, | 770 bool MayNamedAccess(JSObject* receiver, |
| 762 Object* key, | 771 Object* key, |
| 763 v8::AccessType type); | 772 v8::AccessType type); |
| 764 bool MayIndexedAccess(JSObject* receiver, | 773 bool MayIndexedAccess(JSObject* receiver, |
| 765 uint32_t index, | 774 uint32_t index, |
| 766 v8::AccessType type); | 775 v8::AccessType type); |
| 767 | 776 |
| 768 void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback); | 777 void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback); |
| 769 void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type); | 778 void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type); |
| 770 | 779 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1114 |
| 1106 OptimizingCompilerThread* optimizing_compiler_thread() { | 1115 OptimizingCompilerThread* optimizing_compiler_thread() { |
| 1107 return optimizing_compiler_thread_; | 1116 return optimizing_compiler_thread_; |
| 1108 } | 1117 } |
| 1109 | 1118 |
| 1110 // PreInits and returns a default isolate. Needed when a new thread tries | 1119 // PreInits and returns a default isolate. Needed when a new thread tries |
| 1111 // to create a Locker for the first time (the lock itself is in the isolate). | 1120 // to create a Locker for the first time (the lock itself is in the isolate). |
| 1112 // TODO(svenpanne) This method is on death row... | 1121 // TODO(svenpanne) This method is on death row... |
| 1113 static v8::Isolate* GetDefaultIsolateForLocking(); | 1122 static v8::Isolate* GetDefaultIsolateForLocking(); |
| 1114 | 1123 |
| 1115 MarkingThread** marking_threads() { | |
| 1116 return marking_thread_; | |
| 1117 } | |
| 1118 | |
| 1119 SweeperThread** sweeper_threads() { | 1124 SweeperThread** sweeper_threads() { |
| 1120 return sweeper_thread_; | 1125 return sweeper_thread_; |
| 1121 } | 1126 } |
| 1122 | 1127 |
| 1123 int id() const { return static_cast<int>(id_); } | 1128 int id() const { return static_cast<int>(id_); } |
| 1124 | 1129 |
| 1125 HStatistics* GetHStatistics(); | 1130 HStatistics* GetHStatistics(); |
| 1126 HTracer* GetHTracer(); | 1131 HTracer* GetHTracer(); |
| 1127 | 1132 |
| 1128 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } | 1133 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 // between compilation units. | 1366 // between compilation units. |
| 1362 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1367 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 1363 static const intptr_t name##_debug_offset_; | 1368 static const intptr_t name##_debug_offset_; |
| 1364 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1369 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 1365 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1370 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 1366 #undef ISOLATE_FIELD_OFFSET | 1371 #undef ISOLATE_FIELD_OFFSET |
| 1367 #endif | 1372 #endif |
| 1368 | 1373 |
| 1369 DeferredHandles* deferred_handles_head_; | 1374 DeferredHandles* deferred_handles_head_; |
| 1370 OptimizingCompilerThread* optimizing_compiler_thread_; | 1375 OptimizingCompilerThread* optimizing_compiler_thread_; |
| 1371 MarkingThread** marking_thread_; | |
| 1372 SweeperThread** sweeper_thread_; | 1376 SweeperThread** sweeper_thread_; |
| 1373 | 1377 |
| 1374 // Counts deopt points if deopt_every_n_times is enabled. | 1378 // Counts deopt points if deopt_every_n_times is enabled. |
| 1375 unsigned int stress_deopt_count_; | 1379 unsigned int stress_deopt_count_; |
| 1376 | 1380 |
| 1377 friend class ExecutionAccess; | 1381 friend class ExecutionAccess; |
| 1378 friend class HandleScopeImplementer; | 1382 friend class HandleScopeImplementer; |
| 1379 friend class IsolateInitializer; | 1383 friend class IsolateInitializer; |
| 1380 friend class MarkingThread; | |
| 1381 friend class OptimizingCompilerThread; | 1384 friend class OptimizingCompilerThread; |
| 1382 friend class SweeperThread; | 1385 friend class SweeperThread; |
| 1383 friend class ThreadManager; | 1386 friend class ThreadManager; |
| 1384 friend class Simulator; | 1387 friend class Simulator; |
| 1385 friend class StackGuard; | 1388 friend class StackGuard; |
| 1386 friend class ThreadId; | 1389 friend class ThreadId; |
| 1387 friend class TestMemoryAllocatorScope; | 1390 friend class TestMemoryAllocatorScope; |
| 1388 friend class TestCodeRangeScope; | 1391 friend class TestCodeRangeScope; |
| 1389 friend class v8::Isolate; | 1392 friend class v8::Isolate; |
| 1390 friend class v8::Locker; | 1393 friend class v8::Locker; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1418 Isolate* isolate_; | 1421 Isolate* isolate_; |
| 1419 Handle<Context> context_; | 1422 Handle<Context> context_; |
| 1420 SaveContext* prev_; | 1423 SaveContext* prev_; |
| 1421 Address c_entry_fp_; | 1424 Address c_entry_fp_; |
| 1422 }; | 1425 }; |
| 1423 | 1426 |
| 1424 | 1427 |
| 1425 class AssertNoContextChange BASE_EMBEDDED { | 1428 class AssertNoContextChange BASE_EMBEDDED { |
| 1426 #ifdef DEBUG | 1429 #ifdef DEBUG |
| 1427 public: | 1430 public: |
| 1428 AssertNoContextChange() | 1431 explicit AssertNoContextChange(Isolate* isolate) |
| 1429 : isolate_(Isolate::Current()), | 1432 : isolate_(isolate), |
| 1430 context_(isolate_->context()) { } | 1433 context_(isolate->context(), isolate) { } |
| 1431 ~AssertNoContextChange() { | 1434 ~AssertNoContextChange() { |
| 1432 ASSERT(isolate_->context() == *context_); | 1435 ASSERT(isolate_->context() == *context_); |
| 1433 } | 1436 } |
| 1434 | 1437 |
| 1435 private: | 1438 private: |
| 1436 Isolate* isolate_; | 1439 Isolate* isolate_; |
| 1437 Handle<Context> context_; | 1440 Handle<Context> context_; |
| 1438 #else | 1441 #else |
| 1439 public: | 1442 public: |
| 1440 AssertNoContextChange() { } | 1443 explicit AssertNoContextChange(Isolate* isolate) { } |
| 1441 #endif | 1444 #endif |
| 1442 }; | 1445 }; |
| 1443 | 1446 |
| 1444 | |
| 1445 // TODO(mstarzinger): Depracate as soon as everything is handlified. | |
| 1446 class AssertNoContextChangeWithHandleScope BASE_EMBEDDED { | |
| 1447 #ifdef DEBUG | |
| 1448 public: | |
| 1449 AssertNoContextChangeWithHandleScope() : | |
| 1450 isolate_(Isolate::Current()), | |
| 1451 scope_(isolate_), | |
| 1452 context_(isolate_->context(), isolate_) { | |
| 1453 } | |
| 1454 | |
| 1455 ~AssertNoContextChangeWithHandleScope() { | |
| 1456 ASSERT(isolate_->context() == *context_); | |
| 1457 } | |
| 1458 | |
| 1459 private: | |
| 1460 Isolate* isolate_; | |
| 1461 HandleScope scope_; | |
| 1462 Handle<Context> context_; | |
| 1463 #else | |
| 1464 public: | |
| 1465 AssertNoContextChangeWithHandleScope() { } | |
| 1466 #endif | |
| 1467 }; | |
| 1468 | |
| 1469 | 1447 |
| 1470 class ExecutionAccess BASE_EMBEDDED { | 1448 class ExecutionAccess BASE_EMBEDDED { |
| 1471 public: | 1449 public: |
| 1472 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) { | 1450 explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) { |
| 1473 Lock(isolate); | 1451 Lock(isolate); |
| 1474 } | 1452 } |
| 1475 ~ExecutionAccess() { Unlock(isolate_); } | 1453 ~ExecutionAccess() { Unlock(isolate_); } |
| 1476 | 1454 |
| 1477 static void Lock(Isolate* isolate) { isolate->break_access()->Lock(); } | 1455 static void Lock(Isolate* isolate) { isolate->break_access()->Lock(); } |
| 1478 static void Unlock(Isolate* isolate) { isolate->break_access()->Unlock(); } | 1456 static void Unlock(Isolate* isolate) { isolate->break_access()->Unlock(); } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 | 1508 |
| 1531 // Mark the native context with out of memory. | 1509 // Mark the native context with out of memory. |
| 1532 inline void Context::mark_out_of_memory() { | 1510 inline void Context::mark_out_of_memory() { |
| 1533 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); | 1511 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); |
| 1534 } | 1512 } |
| 1535 | 1513 |
| 1536 | 1514 |
| 1537 } } // namespace v8::internal | 1515 } } // namespace v8::internal |
| 1538 | 1516 |
| 1539 #endif // V8_ISOLATE_H_ | 1517 #endif // V8_ISOLATE_H_ |
| OLD | NEW |