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

Side by Side Diff: src/isolate.h

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 5 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/ia32/full-codegen-ia32.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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 #define RETURN_IF_EMPTY_HANDLE(isolate, call) \ 120 #define RETURN_IF_EMPTY_HANDLE(isolate, call) \
121 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception()) 121 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception())
122 122
123 #define ISOLATE_ADDRESS_LIST(C) \ 123 #define ISOLATE_ADDRESS_LIST(C) \
124 C(handler_address) \ 124 C(handler_address) \
125 C(c_entry_fp_address) \ 125 C(c_entry_fp_address) \
126 C(context_address) \ 126 C(context_address) \
127 C(pending_exception_address) \ 127 C(pending_exception_address) \
128 C(external_caught_exception_address) 128 C(external_caught_exception_address) \
129
130 #ifdef ENABLE_LOGGING_AND_PROFILING
131 #define ISOLATE_ADDRESS_LIST_PROF(C) \
132 C(js_entry_sp_address) 129 C(js_entry_sp_address)
133 #else
134 #define ISOLATE_ADDRESS_LIST_PROF(C)
135 #endif
136 130
137 131
138 // Platform-independent, reliable thread identifier. 132 // Platform-independent, reliable thread identifier.
139 class ThreadId { 133 class ThreadId {
140 public: 134 public:
141 // Creates an invalid ThreadId. 135 // Creates an invalid ThreadId.
142 ThreadId() : id_(kInvalidId) {} 136 ThreadId() : id_(kInvalidId) {}
143 137
144 // Returns ThreadId for current thread. 138 // Returns ThreadId for current thread.
145 static ThreadId Current() { return ThreadId(GetCurrentThreadId()); } 139 static ThreadId Current() { return ThreadId(GetCurrentThreadId()); }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Stack. 239 // Stack.
246 Address c_entry_fp_; // the frame pointer of the top c entry frame 240 Address c_entry_fp_; // the frame pointer of the top c entry frame
247 Address handler_; // try-blocks are chained through the stack 241 Address handler_; // try-blocks are chained through the stack
248 242
249 #ifdef USE_SIMULATOR 243 #ifdef USE_SIMULATOR
250 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) 244 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
251 Simulator* simulator_; 245 Simulator* simulator_;
252 #endif 246 #endif
253 #endif // USE_SIMULATOR 247 #endif // USE_SIMULATOR
254 248
255 #ifdef ENABLE_LOGGING_AND_PROFILING
256 Address js_entry_sp_; // the stack pointer of the bottom js entry frame 249 Address js_entry_sp_; // the stack pointer of the bottom js entry frame
257 Address external_callback_; // the external callback we're currently in 250 Address external_callback_; // the external callback we're currently in
258 #endif
259
260 #ifdef ENABLE_VMSTATE_TRACKING
261 StateTag current_vm_state_; 251 StateTag current_vm_state_;
262 #endif
263 252
264 // Generated code scratch locations. 253 // Generated code scratch locations.
265 int32_t formal_count_; 254 int32_t formal_count_;
266 255
267 // Call back function to report unsafe JS accesses. 256 // Call back function to report unsafe JS accesses.
268 v8::FailedAccessCheckCallback failed_access_check_callback_; 257 v8::FailedAccessCheckCallback failed_access_check_callback_;
269 258
270 private: 259 private:
271 void InitializeInternal(); 260 void InitializeInternal();
272 261
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 295
307 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \ 296 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \
308 V(CommentStatistic, paged_space_comments_statistics, \ 297 V(CommentStatistic, paged_space_comments_statistics, \
309 CommentStatistic::kMaxComments + 1) 298 CommentStatistic::kMaxComments + 1)
310 #else 299 #else
311 300
312 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) 301 #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V)
313 302
314 #endif 303 #endif
315 304
316 #ifdef ENABLE_LOGGING_AND_PROFILING
317
318 #define ISOLATE_LOGGING_INIT_LIST(V) \
319 V(CpuProfiler*, cpu_profiler, NULL) \
320 V(HeapProfiler*, heap_profiler, NULL)
321
322 #else
323
324 #define ISOLATE_LOGGING_INIT_LIST(V)
325
326 #endif
327
328 #define ISOLATE_INIT_ARRAY_LIST(V) \ 305 #define ISOLATE_INIT_ARRAY_LIST(V) \
329 /* SerializerDeserializer state. */ \ 306 /* SerializerDeserializer state. */ \
330 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \ 307 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \
331 V(int, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \ 308 V(int, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \
332 V(int, bad_char_shift_table, kUC16AlphabetSize) \ 309 V(int, bad_char_shift_table, kUC16AlphabetSize) \
333 V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \ 310 V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \
334 V(int, suffix_table, (kBMMaxShift + 1)) \ 311 V(int, suffix_table, (kBMMaxShift + 1)) \
335 V(uint32_t, random_seed, 2) \ 312 V(uint32_t, random_seed, 2) \
336 V(uint32_t, private_random_seed, 2) \ 313 V(uint32_t, private_random_seed, 2) \
337 ISOLATE_INIT_DEBUG_ARRAY_LIST(V) 314 ISOLATE_INIT_DEBUG_ARRAY_LIST(V)
(...skipping 28 matching lines...) Expand all
366 /* TODO(isolates): Release this on destruction? */ \ 343 /* TODO(isolates): Release this on destruction? */ \
367 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ 344 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \
368 /* Serializer state. */ \ 345 /* Serializer state. */ \
369 V(ExternalReferenceTable*, external_reference_table, NULL) \ 346 V(ExternalReferenceTable*, external_reference_table, NULL) \
370 /* AstNode state. */ \ 347 /* AstNode state. */ \
371 V(unsigned, ast_node_id, 0) \ 348 V(unsigned, ast_node_id, 0) \
372 V(unsigned, ast_node_count, 0) \ 349 V(unsigned, ast_node_count, 0) \
373 /* SafeStackFrameIterator activations count. */ \ 350 /* SafeStackFrameIterator activations count. */ \
374 V(int, safe_stack_iterator_counter, 0) \ 351 V(int, safe_stack_iterator_counter, 0) \
375 V(uint64_t, enabled_cpu_features, 0) \ 352 V(uint64_t, enabled_cpu_features, 0) \
353 V(CpuProfiler*, cpu_profiler, NULL) \
354 V(HeapProfiler*, heap_profiler, NULL) \
376 ISOLATE_PLATFORM_INIT_LIST(V) \ 355 ISOLATE_PLATFORM_INIT_LIST(V) \
377 ISOLATE_LOGGING_INIT_LIST(V) \
378 ISOLATE_DEBUGGER_INIT_LIST(V) 356 ISOLATE_DEBUGGER_INIT_LIST(V)
379 357
380 class Isolate { 358 class Isolate {
381 // These forward declarations are required to make the friend declarations in 359 // These forward declarations are required to make the friend declarations in
382 // PerIsolateThreadData work on some older versions of gcc. 360 // PerIsolateThreadData work on some older versions of gcc.
383 class ThreadDataTable; 361 class ThreadDataTable;
384 class EntryStackItem; 362 class EntryStackItem;
385 public: 363 public:
386 ~Isolate(); 364 ~Isolate();
387 365
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 friend class ThreadDataTable; 416 friend class ThreadDataTable;
439 friend class EntryStackItem; 417 friend class EntryStackItem;
440 418
441 DISALLOW_COPY_AND_ASSIGN(PerIsolateThreadData); 419 DISALLOW_COPY_AND_ASSIGN(PerIsolateThreadData);
442 }; 420 };
443 421
444 422
445 enum AddressId { 423 enum AddressId {
446 #define C(name) k_##name, 424 #define C(name) k_##name,
447 ISOLATE_ADDRESS_LIST(C) 425 ISOLATE_ADDRESS_LIST(C)
448 ISOLATE_ADDRESS_LIST_PROF(C)
449 #undef C 426 #undef C
450 k_isolate_address_count 427 k_isolate_address_count
451 }; 428 };
452 429
453 // Returns the PerIsolateThreadData for the current thread (or NULL if one is 430 // Returns the PerIsolateThreadData for the current thread (or NULL if one is
454 // not currently set). 431 // not currently set).
455 static PerIsolateThreadData* CurrentPerIsolateThreadData() { 432 static PerIsolateThreadData* CurrentPerIsolateThreadData() {
456 return reinterpret_cast<PerIsolateThreadData*>( 433 return reinterpret_cast<PerIsolateThreadData*>(
457 Thread::GetThreadLocal(per_isolate_thread_data_key_)); 434 Thread::GetThreadLocal(per_isolate_thread_data_key_));
458 } 435 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 static Address c_entry_fp(ThreadLocalTop* thread) { 590 static Address c_entry_fp(ThreadLocalTop* thread) {
614 return thread->c_entry_fp_; 591 return thread->c_entry_fp_;
615 } 592 }
616 static Address handler(ThreadLocalTop* thread) { return thread->handler_; } 593 static Address handler(ThreadLocalTop* thread) { return thread->handler_; }
617 594
618 inline Address* c_entry_fp_address() { 595 inline Address* c_entry_fp_address() {
619 return &thread_local_top_.c_entry_fp_; 596 return &thread_local_top_.c_entry_fp_;
620 } 597 }
621 inline Address* handler_address() { return &thread_local_top_.handler_; } 598 inline Address* handler_address() { return &thread_local_top_.handler_; }
622 599
623 #ifdef ENABLE_LOGGING_AND_PROFILING
624 // Bottom JS entry (see StackTracer::Trace in log.cc). 600 // Bottom JS entry (see StackTracer::Trace in log.cc).
625 static Address js_entry_sp(ThreadLocalTop* thread) { 601 static Address js_entry_sp(ThreadLocalTop* thread) {
626 return thread->js_entry_sp_; 602 return thread->js_entry_sp_;
627 } 603 }
628 inline Address* js_entry_sp_address() { 604 inline Address* js_entry_sp_address() {
629 return &thread_local_top_.js_entry_sp_; 605 return &thread_local_top_.js_entry_sp_;
630 } 606 }
631 #endif
632 607
633 // Generated code scratch locations. 608 // Generated code scratch locations.
634 void* formal_count_address() { return &thread_local_top_.formal_count_; } 609 void* formal_count_address() { return &thread_local_top_.formal_count_; }
635 610
636 // Returns the global object of the current context. It could be 611 // Returns the global object of the current context. It could be
637 // a builtin object, or a js global object. 612 // a builtin object, or a js global object.
638 Handle<GlobalObject> global() { 613 Handle<GlobalObject> global() {
639 return Handle<GlobalObject>(context()->global()); 614 return Handle<GlobalObject>(context()->global());
640 } 615 }
641 616
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 } 913 }
939 #endif 914 #endif
940 915
941 Factory* factory() { return reinterpret_cast<Factory*>(this); } 916 Factory* factory() { return reinterpret_cast<Factory*>(this); }
942 917
943 // SerializerDeserializer state. 918 // SerializerDeserializer state.
944 static const int kPartialSnapshotCacheCapacity = 1400; 919 static const int kPartialSnapshotCacheCapacity = 1400;
945 920
946 static const int kJSRegexpStaticOffsetsVectorSize = 50; 921 static const int kJSRegexpStaticOffsetsVectorSize = 50;
947 922
948 #ifdef ENABLE_LOGGING_AND_PROFILING
949 Address external_callback() { 923 Address external_callback() {
950 return thread_local_top_.external_callback_; 924 return thread_local_top_.external_callback_;
951 } 925 }
952 void set_external_callback(Address callback) { 926 void set_external_callback(Address callback) {
953 thread_local_top_.external_callback_ = callback; 927 thread_local_top_.external_callback_ = callback;
954 } 928 }
955 #endif
956 929
957 #ifdef ENABLE_VMSTATE_TRACKING
958 StateTag current_vm_state() { 930 StateTag current_vm_state() {
959 return thread_local_top_.current_vm_state_; 931 return thread_local_top_.current_vm_state_;
960 } 932 }
961 933
962 void SetCurrentVMState(StateTag state) { 934 void SetCurrentVMState(StateTag state) {
963 if (RuntimeProfiler::IsEnabled()) { 935 if (RuntimeProfiler::IsEnabled()) {
964 // Make sure thread local top is initialized. 936 // Make sure thread local top is initialized.
965 ASSERT(thread_local_top_.isolate_ == this); 937 ASSERT(thread_local_top_.isolate_ == this);
966 StateTag current_state = thread_local_top_.current_vm_state_; 938 StateTag current_state = thread_local_top_.current_vm_state_;
967 if (current_state != JS && state == JS) { 939 if (current_state != JS && state == JS) {
968 // Non-JS -> JS transition. 940 // Non-JS -> JS transition.
969 RuntimeProfiler::IsolateEnteredJS(this); 941 RuntimeProfiler::IsolateEnteredJS(this);
970 } else if (current_state == JS && state != JS) { 942 } else if (current_state == JS && state != JS) {
971 // JS -> non-JS transition. 943 // JS -> non-JS transition.
972 ASSERT(RuntimeProfiler::IsSomeIsolateInJS()); 944 ASSERT(RuntimeProfiler::IsSomeIsolateInJS());
973 RuntimeProfiler::IsolateExitedJS(this); 945 RuntimeProfiler::IsolateExitedJS(this);
974 } else { 946 } else {
975 // Other types of state transitions are not interesting to the 947 // Other types of state transitions are not interesting to the
976 // runtime profiler, because they don't affect whether we're 948 // runtime profiler, because they don't affect whether we're
977 // in JS or not. 949 // in JS or not.
978 ASSERT((current_state == JS) == (state == JS)); 950 ASSERT((current_state == JS) == (state == JS));
979 } 951 }
980 } 952 }
981 thread_local_top_.current_vm_state_ = state; 953 thread_local_top_.current_vm_state_ = state;
982 } 954 }
983 #endif
984 955
985 void SetData(void* data) { embedder_data_ = data; } 956 void SetData(void* data) { embedder_data_ = data; }
986 void* GetData() { return embedder_data_; } 957 void* GetData() { return embedder_data_; }
987 958
988 private: 959 private:
989 Isolate(); 960 Isolate();
990 961
991 // The per-process lock should be acquired before the ThreadDataTable is 962 // The per-process lock should be acquired before the ThreadDataTable is
992 // modified. 963 // modified.
993 class ThreadDataTable { 964 class ThreadDataTable {
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1321
1351 // Mark the global context with out of memory. 1322 // Mark the global context with out of memory.
1352 inline void Context::mark_out_of_memory() { 1323 inline void Context::mark_out_of_memory() {
1353 global_context()->set_out_of_memory(HEAP->true_value()); 1324 global_context()->set_out_of_memory(HEAP->true_value());
1354 } 1325 }
1355 1326
1356 1327
1357 } } // namespace v8::internal 1328 } } // namespace v8::internal
1358 1329
1359 #endif // V8_ISOLATE_H_ 1330 #endif // V8_ISOLATE_H_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698