Commit b1667fca authored by dcarney's avatar dcarney Committed by Commit bot

don't use to-be-deprecated Value::To* without isolate parameter

R=svenpanne@chromium.org

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25473}
parent c1bfc348
...@@ -25,7 +25,8 @@ static void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -25,7 +25,8 @@ static void AssertInlineCount(const v8::FunctionCallbackInfo<v8::Value>& args) {
frames_seen++; frames_seen++;
it.Advance(); it.Advance();
} }
CHECK_EQ(args[0]->ToInt32()->Value(), topmost->GetInlineCount()); CHECK_EQ(args[0]->ToInt32(args.GetIsolate())->Value(),
topmost->GetInlineCount());
} }
......
This diff is collapsed.
...@@ -621,7 +621,7 @@ static void DebugEventBreakPointHitCount( ...@@ -621,7 +621,7 @@ static void DebugEventBreakPointHitCount(
last_function_hit[0] = '\0'; last_function_hit[0] = '\0';
} else { } else {
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> function_name(result->ToString()); v8::Handle<v8::String> function_name(result.As<v8::String>());
function_name->WriteUtf8(last_function_hit); function_name->WriteUtf8(last_function_hit);
} }
} }
...@@ -656,7 +656,7 @@ static void DebugEventBreakPointHitCount( ...@@ -656,7 +656,7 @@ static void DebugEventBreakPointHitCount(
last_script_name_hit[0] = '\0'; last_script_name_hit[0] = '\0';
} else { } else {
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> script_name(result->ToString()); v8::Handle<v8::String> script_name(result.As<v8::String>());
script_name->WriteUtf8(last_script_name_hit); script_name->WriteUtf8(last_script_name_hit);
} }
} }
...@@ -775,7 +775,7 @@ static void DebugEventEvaluate( ...@@ -775,7 +775,7 @@ static void DebugEventEvaluate(
v8::Handle<v8::Value> result = v8::Handle<v8::Value> result =
evaluate_check_function->Call(exec_state, argc, argv); evaluate_check_function->Call(exec_state, argc, argv);
if (!result->IsTrue()) { if (!result->IsTrue()) {
v8::String::Utf8Value utf8(checks[i].expected->ToString()); v8::String::Utf8Value utf8(checks[i].expected);
V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8); V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8);
} }
} }
...@@ -849,7 +849,7 @@ static void DebugEventStepSequence( ...@@ -849,7 +849,7 @@ static void DebugEventStepSequence(
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv); argc, argv);
CHECK(result->IsString()); CHECK(result->IsString());
v8::String::Utf8Value function_name(result->ToString()); v8::String::Utf8Value function_name(result->ToString(CcTest::isolate()));
CHECK_EQ(1, StrLength(*function_name)); CHECK_EQ(1, StrLength(*function_name));
CHECK_EQ((*function_name)[0], CHECK_EQ((*function_name)[0],
expected_step_sequence[break_point_hit_count]); expected_step_sequence[break_point_hit_count]);
...@@ -6159,7 +6159,8 @@ static void DebugEventDebugBreak( ...@@ -6159,7 +6159,8 @@ static void DebugEventDebugBreak(
last_function_hit[0] = '\0'; last_function_hit[0] = '\0';
} else { } else {
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> function_name(result->ToString()); v8::Handle<v8::String> function_name(
result->ToString(CcTest::isolate()));
function_name->WriteUtf8(last_function_hit); function_name->WriteUtf8(last_function_hit);
} }
} }
...@@ -7042,7 +7043,8 @@ static void DebugEventBreakDeoptimize( ...@@ -7042,7 +7043,8 @@ static void DebugEventBreakDeoptimize(
if (!result->IsUndefined()) { if (!result->IsUndefined()) {
char fn[80]; char fn[80];
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> function_name(result->ToString()); v8::Handle<v8::String> function_name(
result->ToString(CcTest::isolate()));
function_name->WriteUtf8(fn); function_name->WriteUtf8(fn);
if (strcmp(fn, "bar") == 0) { if (strcmp(fn, "bar") == 0) {
i::Deoptimizer::DeoptimizeAll(CcTest::i_isolate()); i::Deoptimizer::DeoptimizeAll(CcTest::i_isolate());
...@@ -7107,12 +7109,12 @@ static void DebugEventBreakWithOptimizedStack( ...@@ -7107,12 +7109,12 @@ static void DebugEventBreakWithOptimizedStack(
v8::Handle<v8::Value> result = v8::Handle<v8::Value> result =
frame_function_name->Call(exec_state, argc, argv); frame_function_name->Call(exec_state, argc, argv);
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> function_name(result->ToString()); v8::Handle<v8::String> function_name(result->ToString(isolate));
CHECK(function_name->Equals(v8::String::NewFromUtf8(isolate, "loop"))); CHECK(function_name->Equals(v8::String::NewFromUtf8(isolate, "loop")));
// Get the name of the first argument in frame i. // Get the name of the first argument in frame i.
result = frame_argument_name->Call(exec_state, argc, argv); result = frame_argument_name->Call(exec_state, argc, argv);
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> argument_name(result->ToString()); v8::Handle<v8::String> argument_name(result->ToString(isolate));
CHECK(argument_name->Equals(v8::String::NewFromUtf8(isolate, "count"))); CHECK(argument_name->Equals(v8::String::NewFromUtf8(isolate, "count")));
// Get the value of the first argument in frame i. If the // Get the value of the first argument in frame i. If the
// funtion is optimized the value will be undefined, otherwise // funtion is optimized the value will be undefined, otherwise
...@@ -7125,7 +7127,7 @@ static void DebugEventBreakWithOptimizedStack( ...@@ -7125,7 +7127,7 @@ static void DebugEventBreakWithOptimizedStack(
// Get the name of the first local variable. // Get the name of the first local variable.
result = frame_local_name->Call(exec_state, argc, argv); result = frame_local_name->Call(exec_state, argc, argv);
CHECK(result->IsString()); CHECK(result->IsString());
v8::Handle<v8::String> local_name(result->ToString()); v8::Handle<v8::String> local_name(result->ToString(isolate));
CHECK(local_name->Equals(v8::String::NewFromUtf8(isolate, "local"))); CHECK(local_name->Equals(v8::String::NewFromUtf8(isolate, "local")));
// Get the value of the first local variable. If the function // Get the value of the first local variable. If the function
// is optimized the value will be undefined, otherwise it will // is optimized the value will be undefined, otherwise it will
......
...@@ -890,9 +890,10 @@ class OneByteResource : public v8::String::ExternalOneByteStringResource { ...@@ -890,9 +890,10 @@ class OneByteResource : public v8::String::ExternalOneByteStringResource {
} // namespace } // namespace
TEST(HeapSnapshotJSONSerialization) { TEST(HeapSnapshotJSONSerialization) {
v8::Isolate* isolate = CcTest::isolate();
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(isolate);
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
#define STRING_LITERAL_FOR_TEST \ #define STRING_LITERAL_FOR_TEST \
"\"String \\n\\r\\u0008\\u0081\\u0101\\u0801\\u8001\"" "\"String \\n\\r\\u0008\\u0081\\u0101\\u0801\\u8001\""
...@@ -923,7 +924,7 @@ TEST(HeapSnapshotJSONSerialization) { ...@@ -923,7 +924,7 @@ TEST(HeapSnapshotJSONSerialization) {
// Verify that snapshot object has required fields. // Verify that snapshot object has required fields.
v8::Local<v8::Object> parsed_snapshot = v8::Local<v8::Object> parsed_snapshot =
env->Global()->Get(v8_str("parsed"))->ToObject(); env->Global()->Get(v8_str("parsed"))->ToObject(isolate);
CHECK(parsed_snapshot->Has(v8_str("snapshot"))); CHECK(parsed_snapshot->Has(v8_str("snapshot")));
CHECK(parsed_snapshot->Has(v8_str("nodes"))); CHECK(parsed_snapshot->Has(v8_str("nodes")));
CHECK(parsed_snapshot->Has(v8_str("edges"))); CHECK(parsed_snapshot->Has(v8_str("edges")));
...@@ -979,17 +980,18 @@ TEST(HeapSnapshotJSONSerialization) { ...@@ -979,17 +980,18 @@ TEST(HeapSnapshotJSONSerialization) {
" \"s\", property_type)"); " \"s\", property_type)");
CHECK(!string_obj_pos_val.IsEmpty()); CHECK(!string_obj_pos_val.IsEmpty());
int string_obj_pos = int string_obj_pos =
static_cast<int>(string_obj_pos_val->ToNumber()->Value()); static_cast<int>(string_obj_pos_val->ToNumber(isolate)->Value());
v8::Local<v8::Object> nodes_array = v8::Local<v8::Object> nodes_array =
parsed_snapshot->Get(v8_str("nodes"))->ToObject(); parsed_snapshot->Get(v8_str("nodes"))->ToObject(isolate);
int string_index = static_cast<int>( int string_index = static_cast<int>(
nodes_array->Get(string_obj_pos + 1)->ToNumber()->Value()); nodes_array->Get(string_obj_pos + 1)->ToNumber(isolate)->Value());
CHECK_GT(string_index, 0); CHECK_GT(string_index, 0);
v8::Local<v8::Object> strings_array = v8::Local<v8::Object> strings_array =
parsed_snapshot->Get(v8_str("strings"))->ToObject(); parsed_snapshot->Get(v8_str("strings"))->ToObject(isolate);
v8::Local<v8::String> string = strings_array->Get(string_index)->ToString(); v8::Local<v8::String> string =
strings_array->Get(string_index)->ToString(isolate);
v8::Local<v8::String> ref_string = v8::Local<v8::String> ref_string =
CompileRun(STRING_LITERAL_FOR_TEST)->ToString(); CompileRun(STRING_LITERAL_FOR_TEST)->ToString(isolate);
#undef STRING_LITERAL_FOR_TEST #undef STRING_LITERAL_FOR_TEST
CHECK_EQ(*v8::String::Utf8Value(ref_string), CHECK_EQ(*v8::String::Utf8Value(ref_string),
*v8::String::Utf8Value(string)); *v8::String::Utf8Value(string));
...@@ -1949,9 +1951,10 @@ TEST(SlowCaseAccessors) { ...@@ -1949,9 +1951,10 @@ TEST(SlowCaseAccessors) {
TEST(HiddenPropertiesFastCase) { TEST(HiddenPropertiesFastCase) {
v8::Isolate* isolate = CcTest::isolate();
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(isolate);
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
CompileRun( CompileRun(
"function C(x) { this.a = this; this.b = x; }\n" "function C(x) { this.a = this; this.b = x; }\n"
...@@ -1970,7 +1973,7 @@ TEST(HiddenPropertiesFastCase) { ...@@ -1970,7 +1973,7 @@ TEST(HiddenPropertiesFastCase) {
v8::Handle<v8::Value> cHandle = v8::Handle<v8::Value> cHandle =
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c")); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c"));
CHECK(!cHandle.IsEmpty() && cHandle->IsObject()); CHECK(!cHandle.IsEmpty() && cHandle->IsObject());
cHandle->ToObject()->SetHiddenValue(v8_str("key"), v8_str("val")); cHandle->ToObject(isolate)->SetHiddenValue(v8_str("key"), v8_str("val"));
snapshot = heap_profiler->TakeHeapSnapshot( snapshot = heap_profiler->TakeHeapSnapshot(
v8_str("HiddenPropertiesFastCase2")); v8_str("HiddenPropertiesFastCase2"));
......
...@@ -2338,7 +2338,8 @@ TEST(OptimizedAllocationAlwaysInNewSpace) { ...@@ -2338,7 +2338,8 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
"f(1); f(2); f(3);" "f(1); f(2); f(3);"
"%OptimizeFunctionOnNextCall(f);" "%OptimizeFunctionOnNextCall(f);"
"f(4);"); "f(4);");
CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); CHECK_EQ(
4, res.As<v8::Object>()->GetRealNamedProperty(v8_str("x"))->Int32Value());
Handle<JSObject> o = Handle<JSObject> o =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
...@@ -4297,7 +4298,7 @@ void CheckWeakness(const char* source) { ...@@ -4297,7 +4298,7 @@ void CheckWeakness(const char* source) {
v8::Persistent<v8::Object> garbage; v8::Persistent<v8::Object> garbage;
{ {
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
garbage.Reset(isolate, CompileRun(source)->ToObject()); garbage.Reset(isolate, CompileRun(source)->ToObject(isolate));
} }
weak_ic_cleared = false; weak_ic_cleared = false;
garbage.SetWeak(static_cast<void*>(&garbage), &ClearWeakIC); garbage.SetWeak(static_cast<void*>(&garbage), &ClearWeakIC);
...@@ -4542,7 +4543,7 @@ TEST(Regress357137) { ...@@ -4542,7 +4543,7 @@ TEST(Regress357137) {
"eval('function f() {' + locals + 'return function() { return v0; }; }');" "eval('function f() {' + locals + 'return function() { return v0; }; }');"
"interrupt();" // This triggers a fake stack overflow in f. "interrupt();" // This triggers a fake stack overflow in f.
"f()()"); "f()()");
CHECK_EQ(42.0, result->ToNumber()->Value()); CHECK_EQ(42.0, result->ToNumber(isolate)->Value());
} }
......
...@@ -496,7 +496,7 @@ TEST(EquivalenceOfLoggingAndTraversal) { ...@@ -496,7 +496,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
} }
// The result either be a "true" literal or problem description. // The result either be a "true" literal or problem description.
if (!result->IsTrue()) { if (!result->IsTrue()) {
v8::Local<v8::String> s = result->ToString(); v8::Local<v8::String> s = result->ToString(isolate);
i::ScopedVector<char> data(s->Utf8Length() + 1); i::ScopedVector<char> data(s->Utf8Length() + 1);
CHECK_NE(NULL, data.start()); CHECK_NE(NULL, data.start());
s->WriteUtf8(data.start()); s->WriteUtf8(data.start());
......
...@@ -946,12 +946,15 @@ TEST(SerializeToplevelThreeBigStrings) { ...@@ -946,12 +946,15 @@ TEST(SerializeToplevelThreeBigStrings) {
CHECK_EQ(600000 + 700000, CompileRun("(a + b).length")->Int32Value()); CHECK_EQ(600000 + 700000, CompileRun("(a + b).length")->Int32Value());
CHECK_EQ(500000 + 600000, CompileRun("(b + c).length")->Int32Value()); CHECK_EQ(500000 + 600000, CompileRun("(b + c).length")->Int32Value());
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*CompileRun("a")->ToString()), CHECK(heap->InSpace(
OLD_DATA_SPACE)); *v8::Utils::OpenHandle(*CompileRun("a")->ToString(CcTest::isolate())),
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*CompileRun("b")->ToString()), OLD_DATA_SPACE));
OLD_DATA_SPACE)); CHECK(heap->InSpace(
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*CompileRun("c")->ToString()), *v8::Utils::OpenHandle(*CompileRun("b")->ToString(CcTest::isolate())),
OLD_DATA_SPACE)); OLD_DATA_SPACE));
CHECK(heap->InSpace(
*v8::Utils::OpenHandle(*CompileRun("c")->ToString(CcTest::isolate())),
OLD_DATA_SPACE));
delete cache; delete cache;
source_a.Dispose(); source_a.Dispose();
...@@ -1208,7 +1211,7 @@ TEST(SerializeToplevelIsolates) { ...@@ -1208,7 +1211,7 @@ TEST(SerializeToplevelIsolates) {
buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned); buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned);
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
CHECK(result->ToString()->Equals(v8_str("abcdef"))); CHECK(result->ToString(isolate1)->Equals(v8_str("abcdef")));
} }
isolate1->Dispose(); isolate1->Dispose();
...@@ -1233,7 +1236,7 @@ TEST(SerializeToplevelIsolates) { ...@@ -1233,7 +1236,7 @@ TEST(SerializeToplevelIsolates) {
} }
CHECK(!cache->rejected); CHECK(!cache->rejected);
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
CHECK(result->ToString()->Equals(v8_str("abcdef"))); CHECK(result->ToString(isolate2)->Equals(v8_str("abcdef")));
} }
DCHECK(toplevel_test_code_event_found); DCHECK(toplevel_test_code_event_found);
isolate2->Dispose(); isolate2->Dispose();
...@@ -1274,7 +1277,7 @@ TEST(SerializeWithHarmonyScoping) { ...@@ -1274,7 +1277,7 @@ TEST(SerializeWithHarmonyScoping) {
buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned); buffer, data->length, v8::ScriptCompiler::CachedData::BufferOwned);
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
CHECK(result->ToString()->Equals(v8_str("XY"))); CHECK(result->ToString(isolate1)->Equals(v8_str("XY")));
} }
isolate1->Dispose(); isolate1->Dispose();
...@@ -1299,7 +1302,7 @@ TEST(SerializeWithHarmonyScoping) { ...@@ -1299,7 +1302,7 @@ TEST(SerializeWithHarmonyScoping) {
isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
} }
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
CHECK(result->ToString()->Equals(v8_str("XY"))); CHECK(result->ToString(isolate2)->Equals(v8_str("XY")));
} }
isolate2->Dispose(); isolate2->Dispose();
} }
...@@ -1020,11 +1020,12 @@ TEST(JSONStringifySliceMadeExternal) { ...@@ -1020,11 +1020,12 @@ TEST(JSONStringifySliceMadeExternal) {
// 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::Handle<v8::String> underlying =
CompileRun("var underlying = 'abcdefghijklmnopqrstuvwxyz';" CompileRun(
"underlying")->ToString(); "var underlying = 'abcdefghijklmnopqrstuvwxyz';"
v8::Handle<v8::String> slice = "underlying")->ToString(CcTest::isolate());
CompileRun("var slice = underlying.slice(1);" v8::Handle<v8::String> slice = CompileRun(
"slice")->ToString(); "var slice = underlying.slice(1);"
"slice")->ToString(CcTest::isolate());
CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString()); CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString());
CHECK(v8::Utils::OpenHandle(*underlying)->IsSeqOneByteString()); CHECK(v8::Utils::OpenHandle(*underlying)->IsSeqOneByteString());
...@@ -1082,7 +1083,7 @@ TEST(CachedHashOverflow) { ...@@ -1082,7 +1083,7 @@ TEST(CachedHashOverflow) {
CHECK_EQ(results[i]->IsNumber(), result->IsNumber()); CHECK_EQ(results[i]->IsNumber(), result->IsNumber());
if (result->IsNumber()) { if (result->IsNumber()) {
CHECK_EQ(Object::ToSmi(isolate, results[i]).ToHandleChecked()->value(), CHECK_EQ(Object::ToSmi(isolate, results[i]).ToHandleChecked()->value(),
result->ToInt32()->Value()); result->ToInt32(CcTest::isolate())->Value());
} }
} }
} }
...@@ -1313,7 +1314,7 @@ TEST(CountBreakIterator) { ...@@ -1313,7 +1314,7 @@ TEST(CountBreakIterator) {
" return iterator.next();" " return iterator.next();"
"})();"); "})();");
CHECK(result->IsNumber()); CHECK(result->IsNumber());
int uses = result->ToInt32()->Value() == 0 ? 0 : 1; int uses = result->ToInt32(CcTest::isolate())->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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment