| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
| 6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
| 7 | 7 |
| 8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
| 9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
| 10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 virtual size_t length() const { return length_; } | 187 virtual size_t length() const { return length_; } |
| 188 | 188 |
| 189 private: | 189 private: |
| 190 const char* data_; | 190 const char* data_; |
| 191 size_t length_; | 191 size_t length_; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 | 194 |
| 195 class ShellOptions { | 195 class ShellOptions { |
| 196 public: | 196 public: |
| 197 ShellOptions() : | 197 ShellOptions() |
| 198 script_executed(false), | 198 : script_executed(false), |
| 199 last_run(true), | 199 last_run(true), |
| 200 send_idle_notification(false), | 200 send_idle_notification(false), |
| 201 invoke_weak_callbacks(false), | 201 invoke_weak_callbacks(false), |
| 202 stress_opt(false), | 202 stress_opt(false), |
| 203 stress_deopt(false), | 203 stress_deopt(false), |
| 204 interactive_shell(false), | 204 interactive_shell(false), |
| 205 test_shell(false), | 205 test_shell(false), |
| 206 dump_heap_constants(false), | 206 dump_heap_constants(false), |
| 207 expected_to_throw(false), | 207 expected_to_throw(false), |
| 208 mock_arraybuffer_allocator(false), | 208 mock_arraybuffer_allocator(false), |
| 209 num_isolates(1), | 209 num_isolates(1), |
| 210 isolate_sources(NULL), | 210 compile_options(v8::ScriptCompiler::kNoCompileOptions), |
| 211 icu_data_file(NULL), | 211 isolate_sources(NULL), |
| 212 natives_blob(NULL), | 212 icu_data_file(NULL), |
| 213 snapshot_blob(NULL) { } | 213 natives_blob(NULL), |
| 214 snapshot_blob(NULL) {} |
| 214 | 215 |
| 215 ~ShellOptions() { | 216 ~ShellOptions() { |
| 216 delete[] isolate_sources; | 217 delete[] isolate_sources; |
| 217 } | 218 } |
| 218 | 219 |
| 219 bool use_interactive_shell() { | 220 bool use_interactive_shell() { |
| 220 return (interactive_shell || !script_executed) && !test_shell; | 221 return (interactive_shell || !script_executed) && !test_shell; |
| 221 } | 222 } |
| 222 | 223 |
| 223 bool script_executed; | 224 bool script_executed; |
| 224 bool last_run; | 225 bool last_run; |
| 225 bool send_idle_notification; | 226 bool send_idle_notification; |
| 226 bool invoke_weak_callbacks; | 227 bool invoke_weak_callbacks; |
| 227 bool stress_opt; | 228 bool stress_opt; |
| 228 bool stress_deopt; | 229 bool stress_deopt; |
| 229 bool interactive_shell; | 230 bool interactive_shell; |
| 230 bool test_shell; | 231 bool test_shell; |
| 231 bool dump_heap_constants; | 232 bool dump_heap_constants; |
| 232 bool expected_to_throw; | 233 bool expected_to_throw; |
| 233 bool mock_arraybuffer_allocator; | 234 bool mock_arraybuffer_allocator; |
| 234 int num_isolates; | 235 int num_isolates; |
| 236 v8::ScriptCompiler::CompileOptions compile_options; |
| 235 SourceGroup* isolate_sources; | 237 SourceGroup* isolate_sources; |
| 236 const char* icu_data_file; | 238 const char* icu_data_file; |
| 237 const char* natives_blob; | 239 const char* natives_blob; |
| 238 const char* snapshot_blob; | 240 const char* snapshot_blob; |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 #ifdef V8_SHARED | 243 #ifdef V8_SHARED |
| 242 class Shell { | 244 class Shell { |
| 243 #else | 245 #else |
| 244 class Shell : public i::AllStatic { | 246 class Shell : public i::AllStatic { |
| 245 #endif // V8_SHARED | 247 #endif // V8_SHARED |
| 246 | 248 |
| 247 public: | 249 public: |
| 250 static Local<UnboundScript> CompileString( |
| 251 Isolate* isolate, Local<String> source, Local<Value> name, |
| 252 v8::ScriptCompiler::CompileOptions compile_options); |
| 248 static bool ExecuteString(Isolate* isolate, | 253 static bool ExecuteString(Isolate* isolate, |
| 249 Handle<String> source, | 254 Handle<String> source, |
| 250 Handle<Value> name, | 255 Handle<Value> name, |
| 251 bool print_result, | 256 bool print_result, |
| 252 bool report_exceptions); | 257 bool report_exceptions); |
| 253 static const char* ToCString(const v8::String::Utf8Value& value); | 258 static const char* ToCString(const v8::String::Utf8Value& value); |
| 254 static void ReportException(Isolate* isolate, TryCatch* try_catch); | 259 static void ReportException(Isolate* isolate, TryCatch* try_catch); |
| 255 static Handle<String> ReadFile(Isolate* isolate, const char* name); | 260 static Handle<String> ReadFile(Isolate* isolate, const char* name); |
| 256 static Local<Context> CreateEvaluationContext(Isolate* isolate); | 261 static Local<Context> CreateEvaluationContext(Isolate* isolate); |
| 257 static int RunMain(Isolate* isolate, int argc, char* argv[]); | 262 static int RunMain(Isolate* isolate, int argc, char* argv[]); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 static void ExternalArrayWeakCallback(Isolate* isolate, | 404 static void ExternalArrayWeakCallback(Isolate* isolate, |
| 400 Persistent<Object>* object, | 405 Persistent<Object>* object, |
| 401 uint8_t* data); | 406 uint8_t* data); |
| 402 }; | 407 }; |
| 403 | 408 |
| 404 | 409 |
| 405 } // namespace v8 | 410 } // namespace v8 |
| 406 | 411 |
| 407 | 412 |
| 408 #endif // V8_D8_H_ | 413 #endif // V8_D8_H_ |
| OLD | NEW |