| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "runtime.h" | 48 #include "runtime.h" |
| 49 #include "zone.h" | 49 #include "zone.h" |
| 50 | 50 |
| 51 namespace v8 { | 51 namespace v8 { |
| 52 namespace internal { | 52 namespace internal { |
| 53 | 53 |
| 54 class Bootstrapper; | 54 class Bootstrapper; |
| 55 class CodeGenerator; | 55 class CodeGenerator; |
| 56 class CodeRange; | 56 class CodeRange; |
| 57 struct CodeStubInterfaceDescriptor; | 57 struct CodeStubInterfaceDescriptor; |
| 58 class CodeTracer; |
| 58 class CompilationCache; | 59 class CompilationCache; |
| 59 class ContextSlotCache; | 60 class ContextSlotCache; |
| 60 class ContextSwitcher; | 61 class ContextSwitcher; |
| 61 class Counters; | 62 class Counters; |
| 62 class CpuFeatures; | 63 class CpuFeatures; |
| 63 class CpuProfiler; | 64 class CpuProfiler; |
| 64 class DeoptimizerData; | 65 class DeoptimizerData; |
| 65 class Deserializer; | 66 class Deserializer; |
| 66 class EmptyStatement; | 67 class EmptyStatement; |
| 67 class ExternalCallbackScope; | 68 class ExternalCallbackScope; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 299 |
| 299 Address try_catch_handler_address_; | 300 Address try_catch_handler_address_; |
| 300 }; | 301 }; |
| 301 | 302 |
| 302 | 303 |
| 303 class SystemThreadManager { | 304 class SystemThreadManager { |
| 304 public: | 305 public: |
| 305 enum ParallelSystemComponent { | 306 enum ParallelSystemComponent { |
| 306 PARALLEL_SWEEPING, | 307 PARALLEL_SWEEPING, |
| 307 CONCURRENT_SWEEPING, | 308 CONCURRENT_SWEEPING, |
| 308 PARALLEL_RECOMPILATION | 309 CONCURRENT_RECOMPILATION |
| 309 }; | 310 }; |
| 310 | 311 |
| 311 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); | 312 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); |
| 312 | 313 |
| 313 static const int kMaxThreads = 4; | 314 static const int kMaxThreads = 4; |
| 314 }; | 315 }; |
| 315 | 316 |
| 316 | 317 |
| 317 #ifdef ENABLE_DEBUGGER_SUPPORT | 318 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 318 | 319 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 /* TODO(isolates): Release this on destruction? */ \ | 371 /* TODO(isolates): Release this on destruction? */ \ |
| 371 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ | 372 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ |
| 372 /* Serializer state. */ \ | 373 /* Serializer state. */ \ |
| 373 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 374 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
| 374 /* AstNode state. */ \ | 375 /* AstNode state. */ \ |
| 375 V(int, ast_node_id, 0) \ | 376 V(int, ast_node_id, 0) \ |
| 376 V(unsigned, ast_node_count, 0) \ | 377 V(unsigned, ast_node_count, 0) \ |
| 377 V(bool, observer_delivery_pending, false) \ | 378 V(bool, observer_delivery_pending, false) \ |
| 378 V(HStatistics*, hstatistics, NULL) \ | 379 V(HStatistics*, hstatistics, NULL) \ |
| 379 V(HTracer*, htracer, NULL) \ | 380 V(HTracer*, htracer, NULL) \ |
| 381 V(CodeTracer*, code_tracer, NULL) \ |
| 380 ISOLATE_DEBUGGER_INIT_LIST(V) | 382 ISOLATE_DEBUGGER_INIT_LIST(V) |
| 381 | 383 |
| 382 class Isolate { | 384 class Isolate { |
| 383 // These forward declarations are required to make the friend declarations in | 385 // These forward declarations are required to make the friend declarations in |
| 384 // PerIsolateThreadData work on some older versions of gcc. | 386 // PerIsolateThreadData work on some older versions of gcc. |
| 385 class ThreadDataTable; | 387 class ThreadDataTable; |
| 386 class EntryStackItem; | 388 class EntryStackItem; |
| 387 public: | 389 public: |
| 388 ~Isolate(); | 390 ~Isolate(); |
| 389 | 391 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 989 |
| 988 unibrow::Mapping<unibrow::Ecma262Canonicalize>* | 990 unibrow::Mapping<unibrow::Ecma262Canonicalize>* |
| 989 interp_canonicalize_mapping() { | 991 interp_canonicalize_mapping() { |
| 990 return &interp_canonicalize_mapping_; | 992 return &interp_canonicalize_mapping_; |
| 991 } | 993 } |
| 992 | 994 |
| 993 void* PreallocatedStorageNew(size_t size); | 995 void* PreallocatedStorageNew(size_t size); |
| 994 void PreallocatedStorageDelete(void* p); | 996 void PreallocatedStorageDelete(void* p); |
| 995 void PreallocatedStorageInit(size_t size); | 997 void PreallocatedStorageInit(size_t size); |
| 996 | 998 |
| 999 inline bool IsCodePreAgingActive(); |
| 1000 |
| 997 #ifdef ENABLE_DEBUGGER_SUPPORT | 1001 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 998 Debugger* debugger() { | 1002 Debugger* debugger() { |
| 999 if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger(); | 1003 if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger(); |
| 1000 return debugger_; | 1004 return debugger_; |
| 1001 } | 1005 } |
| 1002 Debug* debug() { | 1006 Debug* debug() { |
| 1003 if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger(); | 1007 if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger(); |
| 1004 return debug_; | 1008 return debug_; |
| 1005 } | 1009 } |
| 1006 #endif | 1010 #endif |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 static v8::Isolate* GetDefaultIsolateForLocking(); | 1121 static v8::Isolate* GetDefaultIsolateForLocking(); |
| 1118 | 1122 |
| 1119 SweeperThread** sweeper_threads() { | 1123 SweeperThread** sweeper_threads() { |
| 1120 return sweeper_thread_; | 1124 return sweeper_thread_; |
| 1121 } | 1125 } |
| 1122 | 1126 |
| 1123 int id() const { return static_cast<int>(id_); } | 1127 int id() const { return static_cast<int>(id_); } |
| 1124 | 1128 |
| 1125 HStatistics* GetHStatistics(); | 1129 HStatistics* GetHStatistics(); |
| 1126 HTracer* GetHTracer(); | 1130 HTracer* GetHTracer(); |
| 1131 CodeTracer* GetCodeTracer(); |
| 1127 | 1132 |
| 1128 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } | 1133 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } |
| 1129 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { | 1134 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { |
| 1130 function_entry_hook_ = function_entry_hook; | 1135 function_entry_hook_ = function_entry_hook; |
| 1131 } | 1136 } |
| 1132 | 1137 |
| 1133 void* stress_deopt_count_address() { return &stress_deopt_count_; } | 1138 void* stress_deopt_count_address() { return &stress_deopt_count_; } |
| 1134 | 1139 |
| 1135 inline RandomNumberGenerator* random_number_generator(); | 1140 inline RandomNumberGenerator* random_number_generator(); |
| 1136 | 1141 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 inline bool Context::has_out_of_memory() { | 1503 inline bool Context::has_out_of_memory() { |
| 1499 return native_context()->out_of_memory()->IsTrue(); | 1504 return native_context()->out_of_memory()->IsTrue(); |
| 1500 } | 1505 } |
| 1501 | 1506 |
| 1502 | 1507 |
| 1503 // Mark the native context with out of memory. | 1508 // Mark the native context with out of memory. |
| 1504 inline void Context::mark_out_of_memory() { | 1509 inline void Context::mark_out_of_memory() { |
| 1505 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); | 1510 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); |
| 1506 } | 1511 } |
| 1507 | 1512 |
| 1513 class CodeTracer V8_FINAL : public Malloced { |
| 1514 public: |
| 1515 explicit CodeTracer(int isolate_id) |
| 1516 : file_(NULL), |
| 1517 scope_depth_(0) { |
| 1518 if (!ShouldRedirect()) { |
| 1519 file_ = stdout; |
| 1520 return; |
| 1521 } |
| 1522 |
| 1523 if (FLAG_redirect_code_traces_to == NULL) { |
| 1524 OS::SNPrintF(filename_, |
| 1525 "code-%d-%d.asm", |
| 1526 OS::GetCurrentProcessId(), |
| 1527 isolate_id); |
| 1528 } else { |
| 1529 OS::StrNCpy(filename_, FLAG_redirect_code_traces_to, filename_.length()); |
| 1530 } |
| 1531 |
| 1532 WriteChars(filename_.start(), "", 0, false); |
| 1533 } |
| 1534 |
| 1535 class Scope { |
| 1536 public: |
| 1537 explicit Scope(CodeTracer* tracer) : tracer_(tracer) { tracer->OpenFile(); } |
| 1538 ~Scope() { tracer_->CloseFile(); } |
| 1539 |
| 1540 FILE* file() const { return tracer_->file(); } |
| 1541 |
| 1542 private: |
| 1543 CodeTracer* tracer_; |
| 1544 }; |
| 1545 |
| 1546 void OpenFile() { |
| 1547 if (!ShouldRedirect()) { |
| 1548 return; |
| 1549 } |
| 1550 |
| 1551 if (file_ == NULL) { |
| 1552 file_ = OS::FOpen(filename_.start(), "a"); |
| 1553 } |
| 1554 |
| 1555 scope_depth_++; |
| 1556 } |
| 1557 |
| 1558 void CloseFile() { |
| 1559 if (!ShouldRedirect()) { |
| 1560 return; |
| 1561 } |
| 1562 |
| 1563 if (--scope_depth_ == 0) { |
| 1564 fclose(file_); |
| 1565 file_ = NULL; |
| 1566 } |
| 1567 } |
| 1568 |
| 1569 FILE* file() const { return file_; } |
| 1570 |
| 1571 private: |
| 1572 static bool ShouldRedirect() { |
| 1573 return FLAG_redirect_code_traces; |
| 1574 } |
| 1575 |
| 1576 EmbeddedVector<char, 128> filename_; |
| 1577 FILE* file_; |
| 1578 int scope_depth_; |
| 1579 }; |
| 1508 | 1580 |
| 1509 } } // namespace v8::internal | 1581 } } // namespace v8::internal |
| 1510 | 1582 |
| 1511 #endif // V8_ISOLATE_H_ | 1583 #endif // V8_ISOLATE_H_ |
| OLD | NEW |