| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 Address try_catch_handler_address_; | 301 Address try_catch_handler_address_; |
| 301 }; | 302 }; |
| 302 | 303 |
| 303 | 304 |
| 304 class SystemThreadManager { | 305 class SystemThreadManager { |
| 305 public: | 306 public: |
| 306 enum ParallelSystemComponent { | 307 enum ParallelSystemComponent { |
| 307 PARALLEL_SWEEPING, | 308 PARALLEL_SWEEPING, |
| 308 CONCURRENT_SWEEPING, | 309 CONCURRENT_SWEEPING, |
| 309 PARALLEL_RECOMPILATION | 310 CONCURRENT_RECOMPILATION |
| 310 }; | 311 }; |
| 311 | 312 |
| 312 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); | 313 static int NumberOfParallelSystemThreads(ParallelSystemComponent type); |
| 313 | 314 |
| 314 static const int kMaxThreads = 4; | 315 static const int kMaxThreads = 4; |
| 315 }; | 316 }; |
| 316 | 317 |
| 317 | 318 |
| 318 #ifdef ENABLE_DEBUGGER_SUPPORT | 319 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 319 | 320 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 /* TODO(isolates): Release this on destruction? */ \ | 372 /* TODO(isolates): Release this on destruction? */ \ |
| 372 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ | 373 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ |
| 373 /* Serializer state. */ \ | 374 /* Serializer state. */ \ |
| 374 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 375 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
| 375 /* AstNode state. */ \ | 376 /* AstNode state. */ \ |
| 376 V(int, ast_node_id, 0) \ | 377 V(int, ast_node_id, 0) \ |
| 377 V(unsigned, ast_node_count, 0) \ | 378 V(unsigned, ast_node_count, 0) \ |
| 378 V(bool, observer_delivery_pending, false) \ | 379 V(bool, observer_delivery_pending, false) \ |
| 379 V(HStatistics*, hstatistics, NULL) \ | 380 V(HStatistics*, hstatistics, NULL) \ |
| 380 V(HTracer*, htracer, NULL) \ | 381 V(HTracer*, htracer, NULL) \ |
| 382 V(CodeTracer*, code_tracer, NULL) \ |
| 381 ISOLATE_DEBUGGER_INIT_LIST(V) | 383 ISOLATE_DEBUGGER_INIT_LIST(V) |
| 382 | 384 |
| 383 class Isolate { | 385 class Isolate { |
| 384 // These forward declarations are required to make the friend declarations in | 386 // These forward declarations are required to make the friend declarations in |
| 385 // PerIsolateThreadData work on some older versions of gcc. | 387 // PerIsolateThreadData work on some older versions of gcc. |
| 386 class ThreadDataTable; | 388 class ThreadDataTable; |
| 387 class EntryStackItem; | 389 class EntryStackItem; |
| 388 public: | 390 public: |
| 389 ~Isolate(); | 391 ~Isolate(); |
| 390 | 392 |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 static v8::Isolate* GetDefaultIsolateForLocking(); | 1126 static v8::Isolate* GetDefaultIsolateForLocking(); |
| 1125 | 1127 |
| 1126 SweeperThread** sweeper_threads() { | 1128 SweeperThread** sweeper_threads() { |
| 1127 return sweeper_thread_; | 1129 return sweeper_thread_; |
| 1128 } | 1130 } |
| 1129 | 1131 |
| 1130 int id() const { return static_cast<int>(id_); } | 1132 int id() const { return static_cast<int>(id_); } |
| 1131 | 1133 |
| 1132 HStatistics* GetHStatistics(); | 1134 HStatistics* GetHStatistics(); |
| 1133 HTracer* GetHTracer(); | 1135 HTracer* GetHTracer(); |
| 1136 CodeTracer* GetCodeTracer(); |
| 1134 | 1137 |
| 1135 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } | 1138 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } |
| 1136 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { | 1139 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { |
| 1137 function_entry_hook_ = function_entry_hook; | 1140 function_entry_hook_ = function_entry_hook; |
| 1138 } | 1141 } |
| 1139 | 1142 |
| 1140 void* stress_deopt_count_address() { return &stress_deopt_count_; } | 1143 void* stress_deopt_count_address() { return &stress_deopt_count_; } |
| 1141 | 1144 |
| 1142 inline RandomNumberGenerator* random_number_generator(); | 1145 inline RandomNumberGenerator* random_number_generator(); |
| 1143 | 1146 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 inline bool Context::has_out_of_memory() { | 1509 inline bool Context::has_out_of_memory() { |
| 1507 return native_context()->out_of_memory()->IsTrue(); | 1510 return native_context()->out_of_memory()->IsTrue(); |
| 1508 } | 1511 } |
| 1509 | 1512 |
| 1510 | 1513 |
| 1511 // Mark the native context with out of memory. | 1514 // Mark the native context with out of memory. |
| 1512 inline void Context::mark_out_of_memory() { | 1515 inline void Context::mark_out_of_memory() { |
| 1513 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); | 1516 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); |
| 1514 } | 1517 } |
| 1515 | 1518 |
| 1519 class CodeTracer V8_FINAL : public Malloced { |
| 1520 public: |
| 1521 explicit CodeTracer(int isolate_id) |
| 1522 : file_(NULL), |
| 1523 scope_depth_(0) { |
| 1524 if (!ShouldRedirect()) { |
| 1525 file_ = stdout; |
| 1526 return; |
| 1527 } |
| 1528 |
| 1529 if (FLAG_redirect_code_traces_to == NULL) { |
| 1530 OS::SNPrintF(filename_, |
| 1531 "code-%d-%d.asm", |
| 1532 OS::GetCurrentProcessId(), |
| 1533 isolate_id); |
| 1534 } else { |
| 1535 OS::StrNCpy(filename_, FLAG_redirect_code_traces_to, filename_.length()); |
| 1536 } |
| 1537 |
| 1538 WriteChars(filename_.start(), "", 0, false); |
| 1539 } |
| 1540 |
| 1541 class Scope { |
| 1542 public: |
| 1543 explicit Scope(CodeTracer* tracer) : tracer_(tracer) { tracer->OpenFile(); } |
| 1544 ~Scope() { tracer_->CloseFile(); } |
| 1545 |
| 1546 FILE* file() const { return tracer_->file(); } |
| 1547 |
| 1548 private: |
| 1549 CodeTracer* tracer_; |
| 1550 }; |
| 1551 |
| 1552 void OpenFile() { |
| 1553 if (!ShouldRedirect()) { |
| 1554 return; |
| 1555 } |
| 1556 |
| 1557 if (file_ == NULL) { |
| 1558 file_ = OS::FOpen(filename_.start(), "a"); |
| 1559 } |
| 1560 |
| 1561 scope_depth_++; |
| 1562 } |
| 1563 |
| 1564 void CloseFile() { |
| 1565 if (!ShouldRedirect()) { |
| 1566 return; |
| 1567 } |
| 1568 |
| 1569 if (--scope_depth_ == 0) { |
| 1570 fclose(file_); |
| 1571 file_ = NULL; |
| 1572 } |
| 1573 } |
| 1574 |
| 1575 FILE* file() const { return file_; } |
| 1576 |
| 1577 private: |
| 1578 static bool ShouldRedirect() { |
| 1579 return FLAG_redirect_code_traces; |
| 1580 } |
| 1581 |
| 1582 EmbeddedVector<char, 128> filename_; |
| 1583 FILE* file_; |
| 1584 int scope_depth_; |
| 1585 }; |
| 1516 | 1586 |
| 1517 } } // namespace v8::internal | 1587 } } // namespace v8::internal |
| 1518 | 1588 |
| 1519 #endif // V8_ISOLATE_H_ | 1589 #endif // V8_ISOLATE_H_ |
| OLD | NEW |