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

Side by Side Diff: test/cctest/cctest.h

Issue 1459783005: Do not use deprecated API in cctest/test-debug. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | test/cctest/test-debug.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 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 336
337 static inline v8::Local<v8::String> v8_str(const char* x) { 337 static inline v8::Local<v8::String> v8_str(const char* x) {
338 return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x, 338 return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x,
339 v8::NewStringType::kNormal) 339 v8::NewStringType::kNormal)
340 .ToLocalChecked(); 340 .ToLocalChecked();
341 } 341 }
342 342
343 343
344 static inline v8::Local<v8::String> v8_str(v8::Isolate* isolate,
345 const char* x) {
346 return v8::String::NewFromUtf8(isolate, x, v8::NewStringType::kNormal)
347 .ToLocalChecked();
348 }
349
350
344 static inline v8::Local<v8::Symbol> v8_symbol(const char* name) { 351 static inline v8::Local<v8::Symbol> v8_symbol(const char* name) {
345 return v8::Symbol::New(v8::Isolate::GetCurrent(), v8_str(name)); 352 return v8::Symbol::New(v8::Isolate::GetCurrent(), v8_str(name));
346 } 353 }
347 354
348 355
349 static inline v8::Local<v8::Script> v8_compile(v8::Local<v8::String> x) { 356 static inline v8::Local<v8::Script> v8_compile(v8::Local<v8::String> x) {
350 v8::Local<v8::Script> result; 357 v8::Local<v8::Script> result;
351 if (v8::Script::Compile(v8::Isolate::GetCurrent()->GetCurrentContext(), x) 358 if (v8::Script::Compile(v8::Isolate::GetCurrent()->GetCurrentContext(), x)
352 .ToLocal(&result)) { 359 .ToLocal(&result)) {
353 return result; 360 return result;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 392
386 // Helper functions that compile and run the source. 393 // Helper functions that compile and run the source.
387 static inline v8::MaybeLocal<v8::Value> CompileRun( 394 static inline v8::MaybeLocal<v8::Value> CompileRun(
388 v8::Local<v8::Context> context, const char* source) { 395 v8::Local<v8::Context> context, const char* source) {
389 return v8::Script::Compile(context, v8_str(source)) 396 return v8::Script::Compile(context, v8_str(source))
390 .ToLocalChecked() 397 .ToLocalChecked()
391 ->Run(context); 398 ->Run(context);
392 } 399 }
393 400
394 401
402 static inline v8::Local<v8::Value> CompileRunChecked(v8::Isolate* isolate,
403 const char* source) {
404 v8::Local<v8::String> source_string =
405 v8::String::NewFromUtf8(isolate, source, v8::NewStringType::kNormal)
406 .ToLocalChecked();
407 v8::Local<v8::Context> context = isolate->GetCurrentContext();
408 v8::Local<v8::Script> script =
409 v8::Script::Compile(context, source_string).ToLocalChecked();
410 return script->Run(context).ToLocalChecked();
411 }
412
413
395 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) { 414 static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) {
396 v8::Local<v8::Value> result; 415 v8::Local<v8::Value> result;
397 if (v8_compile(source) 416 if (v8_compile(source)
398 ->Run(v8::Isolate::GetCurrent()->GetCurrentContext()) 417 ->Run(v8::Isolate::GetCurrent()->GetCurrentContext())
399 .ToLocal(&result)) { 418 .ToLocal(&result)) {
400 return result; 419 return result;
401 } 420 }
402 return v8::Local<v8::Value>(); 421 return v8::Local<v8::Value>();
403 } 422 }
404 423
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 HandleAndZoneScope() {} 708 HandleAndZoneScope() {}
690 709
691 // Prefixing the below with main_ reduces a lot of naming clashes. 710 // Prefixing the below with main_ reduces a lot of naming clashes.
692 i::Zone* main_zone() { return &main_zone_; } 711 i::Zone* main_zone() { return &main_zone_; }
693 712
694 private: 713 private:
695 i::Zone main_zone_; 714 i::Zone main_zone_;
696 }; 715 };
697 716
698 #endif // ifndef CCTEST_H_ 717 #endif // ifndef CCTEST_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698