| OLD | NEW |
| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 class V8 : public AllStatic { | 75 class V8 : public AllStatic { |
| 76 public: | 76 public: |
| 77 // Global actions. | 77 // Global actions. |
| 78 | 78 |
| 79 // If Initialize is called with des == NULL, the initial state is | 79 // If Initialize is called with des == NULL, the initial state is |
| 80 // created from scratch. If a non-null Deserializer is given, the | 80 // created from scratch. If a non-null Deserializer is given, the |
| 81 // initial state is created by reading the deserialized data into an | 81 // initial state is created by reading the deserialized data into an |
| 82 // empty heap. | 82 // empty heap. |
| 83 static bool Initialize(Deserializer* des); | 83 static bool Initialize(Deserializer* des); |
| 84 static void TearDown(); | 84 static void TearDown(); |
| 85 static bool UseCrankshaft() { return use_crankshaft_; } | |
| 86 // To be dead you have to have lived | |
| 87 // TODO(isolates): move IsDead to Isolate. | |
| 88 static bool IsDead() { return has_fatal_error_ || has_been_disposed_; } | |
| 89 static void SetFatalError(); | |
| 90 | 85 |
| 91 // Report process out of memory. Implementation found in api.cc. | 86 // Report process out of memory. Implementation found in api.cc. |
| 92 static void FatalProcessOutOfMemory(const char* location, | 87 static void FatalProcessOutOfMemory(const char* location, |
| 93 bool take_snapshot = false); | 88 bool take_snapshot = false); |
| 94 | 89 |
| 95 // Allows an entropy source to be provided for use in random number | 90 // Allows an entropy source to be provided for use in random number |
| 96 // generation. | 91 // generation. |
| 97 static void SetEntropySource(EntropySource source); | 92 static void SetEntropySource(EntropySource source); |
| 98 // Support for return-address rewriting profilers. | 93 // Support for return-address rewriting profilers. |
| 99 static void SetReturnAddressLocationResolver( | 94 static void SetReturnAddressLocationResolver( |
| 100 ReturnAddressLocationResolver resolver); | 95 ReturnAddressLocationResolver resolver); |
| 101 // Support for entry hooking JITed code. | 96 // Support for entry hooking JITed code. |
| 102 static void SetFunctionEntryHook(FunctionEntryHook entry_hook); | 97 static void SetFunctionEntryHook(FunctionEntryHook entry_hook); |
| 103 // Random number generation support. Not cryptographically safe. | 98 // Random number generation support. Not cryptographically safe. |
| 104 static uint32_t Random(Context* context); | 99 static uint32_t Random(Context* context); |
| 105 // We use random numbers internally in memory allocation and in the | 100 // We use random numbers internally in memory allocation and in the |
| 106 // compilers for security. In order to prevent information leaks we | 101 // compilers for security. In order to prevent information leaks we |
| 107 // use a separate random state for internal random number | 102 // use a separate random state for internal random number |
| 108 // generation. | 103 // generation. |
| 109 static uint32_t RandomPrivate(Isolate* isolate); | 104 static uint32_t RandomPrivate(Isolate* isolate); |
| 110 static Object* FillHeapNumberWithRandom(Object* heap_number, | 105 static Object* FillHeapNumberWithRandom(Object* heap_number, |
| 111 Context* context); | 106 Context* context); |
| 112 | 107 |
| 113 // Idle notification directly from the API. | |
| 114 static bool IdleNotification(int hint); | |
| 115 | |
| 116 static void AddCallCompletedCallback(CallCompletedCallback callback); | 108 static void AddCallCompletedCallback(CallCompletedCallback callback); |
| 117 static void RemoveCallCompletedCallback(CallCompletedCallback callback); | 109 static void RemoveCallCompletedCallback(CallCompletedCallback callback); |
| 118 static void FireCallCompletedCallback(Isolate* isolate); | 110 static void FireCallCompletedCallback(Isolate* isolate); |
| 119 | 111 |
| 120 static v8::ArrayBuffer::Allocator* ArrayBufferAllocator() { | 112 static v8::ArrayBuffer::Allocator* ArrayBufferAllocator() { |
| 121 return array_buffer_allocator_; | 113 return array_buffer_allocator_; |
| 122 } | 114 } |
| 123 | 115 |
| 124 static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator) { | 116 static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator) { |
| 125 CHECK_EQ(NULL, array_buffer_allocator_); | 117 CHECK_EQ(NULL, array_buffer_allocator_); |
| 126 array_buffer_allocator_ = allocator; | 118 array_buffer_allocator_ = allocator; |
| 127 } | 119 } |
| 128 | 120 |
| 129 private: | 121 private: |
| 130 static void InitializeOncePerProcessImpl(); | 122 static void InitializeOncePerProcessImpl(); |
| 131 static void InitializeOncePerProcess(); | 123 static void InitializeOncePerProcess(); |
| 132 | 124 |
| 133 // True if V8 has ever been run | |
| 134 static bool has_been_set_up_; | |
| 135 // True if error has been signaled for current engine | |
| 136 // (reset to false if engine is restarted) | |
| 137 static bool has_fatal_error_; | |
| 138 // True if engine has been shut down | |
| 139 // (reset if engine is restarted) | |
| 140 static bool has_been_disposed_; | |
| 141 // True if we are using the crankshaft optimizing compiler. | |
| 142 static bool use_crankshaft_; | |
| 143 // List of callbacks when a Call completes. | 125 // List of callbacks when a Call completes. |
| 144 static List<CallCompletedCallback>* call_completed_callbacks_; | 126 static List<CallCompletedCallback>* call_completed_callbacks_; |
| 145 // Allocator for external array buffers. | 127 // Allocator for external array buffers. |
| 146 static v8::ArrayBuffer::Allocator* array_buffer_allocator_; | 128 static v8::ArrayBuffer::Allocator* array_buffer_allocator_; |
| 147 }; | 129 }; |
| 148 | 130 |
| 149 | 131 |
| 150 // JavaScript defines two kinds of 'nil'. | 132 // JavaScript defines two kinds of 'nil'. |
| 151 enum NilValue { kNullValue, kUndefinedValue }; | 133 enum NilValue { kNullValue, kUndefinedValue }; |
| 152 | 134 |
| 153 | 135 |
| 154 } } // namespace v8::internal | 136 } } // namespace v8::internal |
| 155 | 137 |
| 156 namespace i = v8::internal; | 138 namespace i = v8::internal; |
| 157 | 139 |
| 158 #endif // V8_V8_H_ | 140 #endif // V8_V8_H_ |
| OLD | NEW |