Remove deprecate API usage from more cctests

BUG=v8:4134
R=vogelheim@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1502193002

Cr-Commit-Position: refs/heads/master@{#32659}
This commit is contained in:
jochen 2015-12-07 07:27:40 -08:00 committed by Commit bot
parent b6a2ff8ede
commit 6150662d89
4 changed files with 137 additions and 84 deletions

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include "src/interface-descriptors.h" #include "src/interface-descriptors.h"
#include "src/isolate.h" #include "src/isolate.h"
#include "test/cctest/compiler/function-tester.h" #include "test/cctest/compiler/function-tester.h"

View File

@ -25,6 +25,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h> #include <stdlib.h>
#include "src/v8.h" #include "src/v8.h"
@ -60,25 +63,24 @@ class DeclarationContext {
} }
} }
void Check(const char* source, void Check(const char* source, int get, int set, int has,
int get, int set, int has,
Expectations expectations, Expectations expectations,
v8::Handle<Value> value = Local<Value>()); v8::Local<Value> value = Local<Value>());
int get_count() const { return get_count_; } int get_count() const { return get_count_; }
int set_count() const { return set_count_; } int set_count() const { return set_count_; }
int query_count() const { return query_count_; } int query_count() const { return query_count_; }
protected: protected:
virtual v8::Handle<Value> Get(Local<Name> key); virtual v8::Local<Value> Get(Local<Name> key);
virtual v8::Handle<Value> Set(Local<Name> key, Local<Value> value); virtual v8::Local<Value> Set(Local<Name> key, Local<Value> value);
virtual v8::Handle<Integer> Query(Local<Name> key); virtual v8::Local<Integer> Query(Local<Name> key);
void InitializeIfNeeded(); void InitializeIfNeeded();
// Perform optional initialization steps on the context after it has // Perform optional initialization steps on the context after it has
// been created. Defaults to none but may be overwritten. // been created. Defaults to none but may be overwritten.
virtual void PostInitializeContext(Handle<Context> context) {} virtual void PostInitializeContext(Local<Context> context) {}
// Get the holder for the interceptor. Default to the instance template // Get the holder for the interceptor. Default to the instance template
// but may be overwritten. // but may be overwritten.
@ -138,10 +140,9 @@ void DeclarationContext::InitializeIfNeeded() {
} }
void DeclarationContext::Check(const char* source, void DeclarationContext::Check(const char* source, int get, int set, int query,
int get, int set, int query,
Expectations expectations, Expectations expectations,
v8::Handle<Value> value) { v8::Local<Value> value) {
InitializeIfNeeded(); InitializeIfNeeded();
// A retry after a GC may pollute the counts, so perform gc now // A retry after a GC may pollute the counts, so perform gc now
// to avoid that. // to avoid that.
@ -149,27 +150,30 @@ void DeclarationContext::Check(const char* source,
HandleScope scope(CcTest::isolate()); HandleScope scope(CcTest::isolate());
TryCatch catcher(CcTest::isolate()); TryCatch catcher(CcTest::isolate());
catcher.SetVerbose(true); catcher.SetVerbose(true);
Local<Script> script = Local<Context> context = CcTest::isolate()->GetCurrentContext();
Script::Compile(String::NewFromUtf8(CcTest::isolate(), source)); MaybeLocal<Script> script = Script::Compile(
context,
String::NewFromUtf8(CcTest::isolate(), source, v8::NewStringType::kNormal)
.ToLocalChecked());
if (expectations == EXPECT_ERROR) { if (expectations == EXPECT_ERROR) {
CHECK(script.IsEmpty()); CHECK(script.IsEmpty());
return; return;
} }
CHECK(!script.IsEmpty()); CHECK(!script.IsEmpty());
Local<Value> result = script->Run(); MaybeLocal<Value> result = script.ToLocalChecked()->Run(context);
CHECK_EQ(get, get_count()); CHECK_EQ(get, get_count());
CHECK_EQ(set, set_count()); CHECK_EQ(set, set_count());
CHECK_EQ(query, query_count()); CHECK_EQ(query, query_count());
if (expectations == EXPECT_RESULT) { if (expectations == EXPECT_RESULT) {
CHECK(!catcher.HasCaught()); CHECK(!catcher.HasCaught());
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
CHECK(value->Equals(result)); CHECK(value->Equals(context, result.ToLocalChecked()).FromJust());
} }
} else { } else {
CHECK(expectations == EXPECT_EXCEPTION); CHECK(expectations == EXPECT_EXCEPTION);
CHECK(catcher.HasCaught()); CHECK(catcher.HasCaught());
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
CHECK(value->Equals(catcher.Exception())); CHECK(value->Equals(context, catcher.Exception()).FromJust());
} }
} }
// Clean slate for the next test. // Clean slate for the next test.
@ -208,18 +212,18 @@ DeclarationContext* DeclarationContext::GetInstance(Local<Value> data) {
} }
v8::Handle<Value> DeclarationContext::Get(Local<Name> key) { v8::Local<Value> DeclarationContext::Get(Local<Name> key) {
return v8::Handle<Value>(); return v8::Local<Value>();
} }
v8::Handle<Value> DeclarationContext::Set(Local<Name> key, Local<Value> value) { v8::Local<Value> DeclarationContext::Set(Local<Name> key, Local<Value> value) {
return v8::Handle<Value>(); return v8::Local<Value>();
} }
v8::Handle<Integer> DeclarationContext::Query(Local<Name> key) { v8::Local<Integer> DeclarationContext::Query(Local<Name> key) {
return v8::Handle<Integer>(); return v8::Local<Integer>();
} }
@ -268,8 +272,8 @@ TEST(Unknown) {
class AbsentPropertyContext: public DeclarationContext { class AbsentPropertyContext: public DeclarationContext {
protected: protected:
virtual v8::Handle<Integer> Query(Local<Name> key) { virtual v8::Local<Integer> Query(Local<Name> key) {
return v8::Handle<Integer>(); return v8::Local<Integer>();
} }
}; };
@ -332,13 +336,13 @@ class AppearingPropertyContext: public DeclarationContext {
AppearingPropertyContext() : state_(DECLARE) { } AppearingPropertyContext() : state_(DECLARE) { }
protected: protected:
virtual v8::Handle<Integer> Query(Local<Name> key) { virtual v8::Local<Integer> Query(Local<Name> key) {
switch (state_) { switch (state_) {
case DECLARE: case DECLARE:
// Force declaration by returning that the // Force declaration by returning that the
// property is absent. // property is absent.
state_ = INITIALIZE_IF_ASSIGN; state_ = INITIALIZE_IF_ASSIGN;
return Handle<Integer>(); return Local<Integer>();
case INITIALIZE_IF_ASSIGN: case INITIALIZE_IF_ASSIGN:
// Return that the property is present so we only get the // Return that the property is present so we only get the
// setter called when initializing with a value. // setter called when initializing with a value.
@ -349,7 +353,7 @@ class AppearingPropertyContext: public DeclarationContext {
break; break;
} }
// Do the lookup in the object. // Do the lookup in the object.
return v8::Handle<Integer>(); return v8::Local<Integer>();
} }
private: private:
@ -401,7 +405,7 @@ class ExistsInPrototypeContext: public DeclarationContext {
public: public:
ExistsInPrototypeContext() { InitializeIfNeeded(); } ExistsInPrototypeContext() { InitializeIfNeeded(); }
protected: protected:
virtual v8::Handle<Integer> Query(Local<Name> key) { virtual v8::Local<Integer> Query(Local<Name> key) {
// Let it seem that the property exists in the prototype object. // Let it seem that the property exists in the prototype object.
return Integer::New(isolate(), v8::None); return Integer::New(isolate(), v8::None);
} }
@ -460,9 +464,9 @@ TEST(ExistsInPrototype) {
class AbsentInPrototypeContext: public DeclarationContext { class AbsentInPrototypeContext: public DeclarationContext {
protected: protected:
virtual v8::Handle<Integer> Query(Local<Name> key) { virtual v8::Local<Integer> Query(Local<Name> key) {
// Let it seem that the property is absent in the prototype object. // Let it seem that the property is absent in the prototype object.
return Handle<Integer>(); return Local<Integer>();
} }
// Use the prototype as the holder for the interceptors. // Use the prototype as the holder for the interceptors.
@ -495,18 +499,21 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext {
} }
protected: protected:
virtual v8::Handle<Integer> Query(Local<Name> key) { virtual v8::Local<Integer> Query(Local<Name> key) {
// Let it seem that the property exists in the hidden prototype object. // Let it seem that the property exists in the hidden prototype object.
return Integer::New(isolate(), v8::None); return Integer::New(isolate(), v8::None);
} }
// Install the hidden prototype after the global object has been created. // Install the hidden prototype after the global object has been created.
virtual void PostInitializeContext(Handle<Context> context) { virtual void PostInitializeContext(Local<Context> context) {
Local<Object> global_object = context->Global(); Local<Object> global_object = context->Global();
Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance(); Local<Object> hidden_proto = hidden_proto_->GetFunction(context)
.ToLocalChecked()
->NewInstance(context)
.ToLocalChecked();
Local<Object> inner_global = Local<Object> inner_global =
Local<Object>::Cast(global_object->GetPrototype()); Local<Object>::Cast(global_object->GetPrototype());
inner_global->SetPrototype(hidden_proto); inner_global->SetPrototype(context, hidden_proto).FromJust();
} }
// Use the hidden prototype as the holder for the interceptors. // Use the hidden prototype as the holder for the interceptors.
@ -567,30 +574,31 @@ class SimpleContext {
context_->Exit(); context_->Exit();
} }
void Check(const char* source, void Check(const char* source, Expectations expectations,
Expectations expectations, v8::Local<Value> value = Local<Value>()) {
v8::Handle<Value> value = Local<Value>()) {
HandleScope scope(context_->GetIsolate()); HandleScope scope(context_->GetIsolate());
TryCatch catcher(context_->GetIsolate()); TryCatch catcher(context_->GetIsolate());
catcher.SetVerbose(true); catcher.SetVerbose(true);
Local<Script> script = MaybeLocal<Script> script = Script::Compile(
Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source)); context_, String::NewFromUtf8(context_->GetIsolate(), source,
v8::NewStringType::kNormal)
.ToLocalChecked());
if (expectations == EXPECT_ERROR) { if (expectations == EXPECT_ERROR) {
CHECK(script.IsEmpty()); CHECK(script.IsEmpty());
return; return;
} }
CHECK(!script.IsEmpty()); CHECK(!script.IsEmpty());
Local<Value> result = script->Run(); MaybeLocal<Value> result = script.ToLocalChecked()->Run(context_);
if (expectations == EXPECT_RESULT) { if (expectations == EXPECT_RESULT) {
CHECK(!catcher.HasCaught()); CHECK(!catcher.HasCaught());
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
CHECK(value->Equals(result)); CHECK(value->Equals(context_, result.ToLocalChecked()).FromJust());
} }
} else { } else {
CHECK(expectations == EXPECT_EXCEPTION); CHECK(expectations == EXPECT_EXCEPTION);
CHECK(catcher.HasCaught()); CHECK(catcher.HasCaught());
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
CHECK(value->Equals(catcher.Exception())); CHECK(value->Equals(context_, catcher.Exception()).FromJust());
} }
} }
} }
@ -901,10 +909,14 @@ TEST(CrossScriptDynamicLookup) {
{ {
SimpleContext context; SimpleContext context;
Local<String> undefined_string = String::NewFromUtf8( Local<String> undefined_string =
CcTest::isolate(), "undefined", String::kInternalizedString); String::NewFromUtf8(CcTest::isolate(), "undefined",
Local<String> number_string = String::NewFromUtf8( v8::NewStringType::kInternalized)
CcTest::isolate(), "number", String::kInternalizedString); .ToLocalChecked();
Local<String> number_string =
String::NewFromUtf8(CcTest::isolate(), "number",
v8::NewStringType::kInternalized)
.ToLocalChecked();
context.Check( context.Check(
"function f(o) { with(o) { return x; } }" "function f(o) { with(o) { return x; } }"
@ -974,10 +986,14 @@ TEST(CrossScriptStaticLookupUndeclared) {
{ {
SimpleContext context; SimpleContext context;
Local<String> undefined_string = String::NewFromUtf8( Local<String> undefined_string =
CcTest::isolate(), "undefined", String::kInternalizedString); String::NewFromUtf8(CcTest::isolate(), "undefined",
Local<String> number_string = String::NewFromUtf8( v8::NewStringType::kInternalized)
CcTest::isolate(), "number", String::kInternalizedString); .ToLocalChecked();
Local<String> number_string =
String::NewFromUtf8(CcTest::isolate(), "number",
v8::NewStringType::kInternalized)
.ToLocalChecked();
context.Check( context.Check(
"function f(o) { return x; }" "function f(o) { return x; }"

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h> #include <stdlib.h>
#include <sstream> #include <sstream>
#include <utility> #include <utility>

View File

@ -30,6 +30,9 @@
// of ConsStrings. These operations may not be very fast, but they // of ConsStrings. These operations may not be very fast, but they
// should be possible without getting errors due to too deep recursion. // should be possible without getting errors due to too deep recursion.
// TODO(jochen): Remove this after the setting is turned on globally.
#define V8_IMMINENT_DEPRECATION_WARNINGS
#include <stdlib.h> #include <stdlib.h>
#include "src/v8.h" #include "src/v8.h"
@ -191,9 +194,9 @@ static void InitializeBuildingBlocks(Handle<String>* building_blocks,
buf[j] = rng->next(0x10000); buf[j] = rng->next(0x10000);
} }
Resource* resource = new Resource(buf, len); Resource* resource = new Resource(buf, len);
building_blocks[i] = building_blocks[i] = v8::Utils::OpenHandle(
v8::Utils::OpenHandle( *v8::String::NewExternalTwoByte(CcTest::isolate(), resource)
*v8::String::NewExternal(CcTest::isolate(), resource)); .ToLocalChecked());
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
CHECK_EQ(buf[j], building_blocks[i]->Get(j)); CHECK_EQ(buf[j], building_blocks[i]->Get(j));
} }
@ -205,9 +208,9 @@ static void InitializeBuildingBlocks(Handle<String>* building_blocks,
buf[j] = rng->next(0x80); buf[j] = rng->next(0x80);
} }
OneByteResource* resource = new OneByteResource(buf, len); OneByteResource* resource = new OneByteResource(buf, len);
building_blocks[i] = building_blocks[i] = v8::Utils::OpenHandle(
v8::Utils::OpenHandle( *v8::String::NewExternalOneByte(CcTest::isolate(), resource)
*v8::String::NewExternal(CcTest::isolate(), resource)); .ToLocalChecked());
for (int j = 0; j < len; j++) { for (int j = 0; j < len; j++) {
CHECK_EQ(buf[j], building_blocks[i]->Get(j)); CHECK_EQ(buf[j], building_blocks[i]->Get(j));
} }
@ -880,8 +883,10 @@ TEST(Utf8Conversion) {
// A simple one-byte string // A simple one-byte string
const char* one_byte_string = "abcdef12345"; const char* one_byte_string = "abcdef12345";
int len = v8::String::NewFromUtf8(CcTest::isolate(), one_byte_string, int len = v8::String::NewFromUtf8(CcTest::isolate(), one_byte_string,
v8::String::kNormalString, v8::NewStringType::kNormal,
StrLength(one_byte_string))->Utf8Length(); StrLength(one_byte_string))
.ToLocalChecked()
->Utf8Length();
CHECK_EQ(StrLength(one_byte_string), len); CHECK_EQ(StrLength(one_byte_string), len);
// A mixed one-byte and two-byte string // A mixed one-byte and two-byte string
// U+02E4 -> CB A4 // U+02E4 -> CB A4
@ -896,8 +901,10 @@ TEST(Utf8Conversion) {
// The number of bytes expected to be written for each length // The number of bytes expected to be written for each length
const int lengths[12] = {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11}; const int lengths[12] = {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11};
const int char_lengths[12] = {0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5}; const int char_lengths[12] = {0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5};
v8::Handle<v8::String> mixed = v8::String::NewFromTwoByte( v8::Local<v8::String> mixed =
CcTest::isolate(), mixed_string, v8::String::kNormalString, 5); v8::String::NewFromTwoByte(CcTest::isolate(), mixed_string,
v8::NewStringType::kNormal, 5)
.ToLocalChecked();
CHECK_EQ(10, mixed->Utf8Length()); CHECK_EQ(10, mixed->Utf8Length());
// Try encoding the string with all capacities // Try encoding the string with all capacities
char buffer[11]; char buffer[11];
@ -929,9 +936,9 @@ TEST(ExternalShortStringAdd) {
CHECK_GT(kMaxLength, i::ConsString::kMinLength); CHECK_GT(kMaxLength, i::ConsString::kMinLength);
// Allocate two JavaScript arrays for holding short strings. // Allocate two JavaScript arrays for holding short strings.
v8::Handle<v8::Array> one_byte_external_strings = v8::Local<v8::Array> one_byte_external_strings =
v8::Array::New(CcTest::isolate(), kMaxLength + 1); v8::Array::New(CcTest::isolate(), kMaxLength + 1);
v8::Handle<v8::Array> non_one_byte_external_strings = v8::Local<v8::Array> non_one_byte_external_strings =
v8::Array::New(CcTest::isolate(), kMaxLength + 1); v8::Array::New(CcTest::isolate(), kMaxLength + 1);
// Generate short one-byte and two-byte external strings. // Generate short one-byte and two-byte external strings.
@ -944,10 +951,13 @@ TEST(ExternalShortStringAdd) {
// string data. // string data.
OneByteResource* one_byte_resource = new OneByteResource(one_byte, i); OneByteResource* one_byte_resource = new OneByteResource(one_byte, i);
v8::Local<v8::String> one_byte_external_string = v8::Local<v8::String> one_byte_external_string =
v8::String::NewExternal(CcTest::isolate(), one_byte_resource); v8::String::NewExternalOneByte(CcTest::isolate(), one_byte_resource)
.ToLocalChecked();
one_byte_external_strings->Set(v8::Integer::New(CcTest::isolate(), i), one_byte_external_strings->Set(context.local(),
one_byte_external_string); v8::Integer::New(CcTest::isolate(), i),
one_byte_external_string)
.FromJust();
uc16* non_one_byte = NewArray<uc16>(i + 1); uc16* non_one_byte = NewArray<uc16>(i + 1);
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
non_one_byte[j] = 0x1234; non_one_byte[j] = 0x1234;
@ -956,17 +966,25 @@ TEST(ExternalShortStringAdd) {
// string data. // string data.
Resource* resource = new Resource(non_one_byte, i); Resource* resource = new Resource(non_one_byte, i);
v8::Local<v8::String> non_one_byte_external_string = v8::Local<v8::String> non_one_byte_external_string =
v8::String::NewExternal(CcTest::isolate(), resource); v8::String::NewExternalTwoByte(CcTest::isolate(), resource)
non_one_byte_external_strings->Set(v8::Integer::New(CcTest::isolate(), i), .ToLocalChecked();
non_one_byte_external_string); non_one_byte_external_strings->Set(context.local(),
v8::Integer::New(CcTest::isolate(), i),
non_one_byte_external_string)
.FromJust();
} }
// Add the arrays with the short external strings in the global object. // Add the arrays with the short external strings in the global object.
v8::Handle<v8::Object> global = context->Global(); v8::Local<v8::Object> global = context->Global();
global->Set(v8_str("external_one_byte"), one_byte_external_strings); global->Set(context.local(), v8_str("external_one_byte"),
global->Set(v8_str("external_non_one_byte"), non_one_byte_external_strings); one_byte_external_strings)
global->Set(v8_str("max_length"), .FromJust();
v8::Integer::New(CcTest::isolate(), kMaxLength)); global->Set(context.local(), v8_str("external_non_one_byte"),
non_one_byte_external_strings)
.FromJust();
global->Set(context.local(), v8_str("max_length"),
v8::Integer::New(CcTest::isolate(), kMaxLength))
.FromJust();
// Add short external one-byte and two-byte strings checking the result. // Add short external one-byte and two-byte strings checking the result.
static const char* source = static const char* source =
@ -1012,7 +1030,7 @@ TEST(ExternalShortStringAdd) {
" return 0;" " return 0;"
"};" "};"
"test()"; "test()";
CHECK_EQ(0, CompileRun(source)->Int32Value()); CHECK_EQ(0, CompileRun(source)->Int32Value(context.local()).FromJust());
} }
@ -1021,14 +1039,19 @@ TEST(JSONStringifySliceMadeExternal) {
// Create a sliced string from a one-byte string. The latter is turned // Create a sliced string from a one-byte string. The latter is turned
// into a two-byte external string. Check that JSON.stringify works. // into a two-byte external string. Check that JSON.stringify works.
v8::HandleScope handle_scope(CcTest::isolate()); v8::HandleScope handle_scope(CcTest::isolate());
v8::Handle<v8::String> underlying = v8::Local<v8::String> underlying =
CompileRun( CompileRun(
"var underlying = 'abcdefghijklmnopqrstuvwxyz';" "var underlying = 'abcdefghijklmnopqrstuvwxyz';"
"underlying")->ToString(CcTest::isolate()); "underlying")
v8::Handle<v8::String> slice = CompileRun( ->ToString(CcTest::isolate()->GetCurrentContext())
"var slice = '';" .ToLocalChecked();
"slice = underlying.slice(1);" v8::Local<v8::String> slice =
"slice")->ToString(CcTest::isolate()); CompileRun(
"var slice = '';"
"slice = underlying.slice(1);"
"slice")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString()); CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString());
CHECK(v8::Utils::OpenHandle(*underlying)->IsSeqOneByteString()); CHECK(v8::Utils::OpenHandle(*underlying)->IsSeqOneByteString());
@ -1079,16 +1102,23 @@ TEST(CachedHashOverflow) {
}; };
const char* line; const char* line;
v8::Local<v8::Context> context = CcTest::isolate()->GetCurrentContext();
for (int i = 0; (line = lines[i]); i++) { for (int i = 0; (line = lines[i]); i++) {
printf("%s\n", line); printf("%s\n", line);
v8::Local<v8::Value> result = v8::Script::Compile( v8::Local<v8::Value> result =
v8::String::NewFromUtf8(CcTest::isolate(), line))->Run(); v8::Script::Compile(context,
v8::String::NewFromUtf8(CcTest::isolate(), line,
v8::NewStringType::kNormal)
.ToLocalChecked())
.ToLocalChecked()
->Run(context)
.ToLocalChecked();
CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined()); CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined());
CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); CHECK_EQ(results[i]->IsNumber(), result->IsNumber());
if (result->IsNumber()) { if (result->IsNumber()) {
int32_t value = 0; int32_t value = 0;
CHECK(results[i]->ToInt32(&value)); CHECK(results[i]->ToInt32(&value));
CHECK_EQ(value, result->ToInt32(CcTest::isolate())->Value()); CHECK_EQ(value, result->ToInt32(context).ToLocalChecked()->Value());
} }
} }
} }
@ -1320,7 +1350,8 @@ TEST(CountBreakIterator) {
" return iterator.next();" " return iterator.next();"
"})();"); "})();");
CHECK(result->IsNumber()); CHECK(result->IsNumber());
int uses = result->ToInt32(CcTest::isolate())->Value() == 0 ? 0 : 1; int uses =
result->ToInt32(context.local()).ToLocalChecked()->Value() == 0 ? 0 : 1;
CHECK_EQ(uses, use_counts[v8::Isolate::kBreakIterator]); CHECK_EQ(uses, use_counts[v8::Isolate::kBreakIterator]);
// Make sure GC cleans up the break iterator, so we don't get a memory leak // Make sure GC cleans up the break iterator, so we don't get a memory leak
// reported by ASAN. // reported by ASAN.
@ -1341,7 +1372,7 @@ TEST(StringReplaceAtomTwoByteResult) {
CHECK(string->IsSeqTwoByteString()); CHECK(string->IsSeqTwoByteString());
v8::Local<v8::String> expected = v8_str("one_byte\x80only\x80string\x80"); v8::Local<v8::String> expected = v8_str("one_byte\x80only\x80string\x80");
CHECK(expected->Equals(result)); CHECK(expected->Equals(context.local(), result).FromJust());
} }