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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 return v8::Local<v8::Script>(); | 362 return v8::Local<v8::Script>(); |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 static inline v8::Local<v8::Script> v8_compile(const char* x) { | 366 static inline v8::Local<v8::Script> v8_compile(const char* x) { |
367 return v8_compile(v8_str(x)); | 367 return v8_compile(v8_str(x)); |
368 } | 368 } |
369 | 369 |
370 | 370 |
| 371 static inline int32_t v8_run_int32value(v8::Local<v8::Script> script) { |
| 372 v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext(); |
| 373 return script->Run(context).ToLocalChecked()->Int32Value(context).FromJust(); |
| 374 } |
| 375 |
| 376 |
371 static inline v8::Local<v8::Script> CompileWithOrigin( | 377 static inline v8::Local<v8::Script> CompileWithOrigin( |
372 v8::Local<v8::String> source, v8::Local<v8::String> origin_url) { | 378 v8::Local<v8::String> source, v8::Local<v8::String> origin_url) { |
373 v8::ScriptOrigin origin(origin_url); | 379 v8::ScriptOrigin origin(origin_url); |
374 v8::ScriptCompiler::Source script_source(source, origin); | 380 v8::ScriptCompiler::Source script_source(source, origin); |
375 return v8::ScriptCompiler::Compile( | 381 return v8::ScriptCompiler::Compile( |
376 v8::Isolate::GetCurrent()->GetCurrentContext(), &script_source) | 382 v8::Isolate::GetCurrent()->GetCurrentContext(), &script_source) |
377 .ToLocalChecked(); | 383 .ToLocalChecked(); |
378 } | 384 } |
379 | 385 |
380 | 386 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 HandleAndZoneScope() {} | 714 HandleAndZoneScope() {} |
709 | 715 |
710 // Prefixing the below with main_ reduces a lot of naming clashes. | 716 // Prefixing the below with main_ reduces a lot of naming clashes. |
711 i::Zone* main_zone() { return &main_zone_; } | 717 i::Zone* main_zone() { return &main_zone_; } |
712 | 718 |
713 private: | 719 private: |
714 i::Zone main_zone_; | 720 i::Zone main_zone_; |
715 }; | 721 }; |
716 | 722 |
717 #endif // ifndef CCTEST_H_ | 723 #endif // ifndef CCTEST_H_ |
OLD | NEW |