diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h index 6243ac5327..c20e573e57 100644 --- a/test/cctest/cctest.h +++ b/test/cctest/cctest.h @@ -368,6 +368,12 @@ static inline v8::Local v8_compile(const char* x) { } +static inline int32_t v8_run_int32value(v8::Local script) { + v8::Local context = CcTest::isolate()->GetCurrentContext(); + return script->Run(context).ToLocalChecked()->Int32Value(context).FromJust(); +} + + static inline v8::Local CompileWithOrigin( v8::Local source, v8::Local origin_url) { v8::ScriptOrigin origin(origin_url); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 10cb9788c3..b3c6d58cbc 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -60,7 +60,6 @@ using ::v8::Context; using ::v8::Extension; using ::v8::Function; using ::v8::FunctionTemplate; -using ::v8::Handle; using ::v8::HandleScope; using ::v8::Local; using ::v8::Maybe; @@ -94,8 +93,7 @@ using ::v8::Value; void RunWithProfiler(void (*test)()) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - v8::Local profile_name = - v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1"); + v8::Local profile_name = v8_str("my_profile1"); v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); cpu_profiler->StartProfiling(profile_name); @@ -110,12 +108,21 @@ static void IncrementingSignatureCallback( const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); signature_callback_count++; - CHECK(signature_expected_receiver->Equals(args.Holder())); - CHECK(signature_expected_receiver->Equals(args.This())); - v8::Handle result = + CHECK(signature_expected_receiver->Equals( + args.GetIsolate()->GetCurrentContext(), + args.Holder()) + .FromJust()); + CHECK(signature_expected_receiver->Equals( + args.GetIsolate()->GetCurrentContext(), + args.This()) + .FromJust()); + v8::Local result = v8::Array::New(args.GetIsolate(), args.Length()); - for (int i = 0; i < args.Length(); i++) - result->Set(v8::Integer::New(args.GetIsolate(), i), args[i]); + for (int i = 0; i < args.Length(); i++) { + CHECK(result->Set(args.GetIsolate()->GetCurrentContext(), + v8::Integer::New(args.GetIsolate(), i), args[i]) + .FromJust()); + } args.GetReturnValue().Set(result); } @@ -154,13 +161,13 @@ THREADED_TEST(Handles) { CHECK(!local_env.IsEmpty()); local_env->Enter(); - v8::Handle undef = v8::Undefined(CcTest::isolate()); + v8::Local undef = v8::Undefined(CcTest::isolate()); CHECK(!undef.IsEmpty()); CHECK(undef->IsUndefined()); const char* source = "1 + 2 + 3"; Local