OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return CompileWithOrigin(v8_str(source), v8_str(origin_url)); | 391 return CompileWithOrigin(v8_str(source), v8_str(origin_url)); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 // Helper functions that compile and run the source. | 395 // Helper functions that compile and run the source. |
396 static inline v8::Local<v8::Value> CompileRun(const char* source) { | 396 static inline v8::Local<v8::Value> CompileRun(const char* source) { |
397 return v8::Script::Compile(v8_str(source))->Run(); | 397 return v8::Script::Compile(v8_str(source))->Run(); |
398 } | 398 } |
399 | 399 |
400 | 400 |
| 401 // Helper functions that compile and run the source. |
| 402 static inline v8::MaybeLocal<v8::Value> CompileRun( |
| 403 v8::Local<v8::Context> context, const char* source) { |
| 404 return v8::Script::Compile(v8_str(source))->Run(context); |
| 405 } |
| 406 |
| 407 |
401 // Compiles source as an ES6 module. | 408 // Compiles source as an ES6 module. |
402 static inline v8::Local<v8::Value> CompileRunModule(const char* source) { | 409 static inline v8::Local<v8::Value> CompileRunModule(const char* source) { |
403 v8::ScriptCompiler::Source script_source(v8_str(source)); | 410 v8::ScriptCompiler::Source script_source(v8_str(source)); |
404 return v8::ScriptCompiler::CompileModule(v8::Isolate::GetCurrent(), | 411 return v8::ScriptCompiler::CompileModule(v8::Isolate::GetCurrent(), |
405 &script_source)->Run(); | 412 &script_source)->Run(); |
406 } | 413 } |
407 | 414 |
408 | 415 |
409 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) { | 416 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) { |
410 return v8::Script::Compile(source)->Run(); | 417 return v8::Script::Compile(source)->Run(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 HandleAndZoneScope() {} | 636 HandleAndZoneScope() {} |
630 | 637 |
631 // Prefixing the below with main_ reduces a lot of naming clashes. | 638 // Prefixing the below with main_ reduces a lot of naming clashes. |
632 i::Zone* main_zone() { return &main_zone_; } | 639 i::Zone* main_zone() { return &main_zone_; } |
633 | 640 |
634 private: | 641 private: |
635 i::Zone main_zone_; | 642 i::Zone main_zone_; |
636 }; | 643 }; |
637 | 644 |
638 #endif // ifndef CCTEST_H_ | 645 #endif // ifndef CCTEST_H_ |
OLD | NEW |