Commit 7bad4ba6 authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove uses of static oddball accessors using GetCurrent in advance of removal from api

R=mstarzinger@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16957 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8d549fb1
......@@ -5897,7 +5897,7 @@ FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args,
template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
if (i < 0 || length_ <= i) return Local<Value>(*Undefined());
if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
return Local<Value>(reinterpret_cast<Value*>(values_ - i));
}
......@@ -5979,7 +5979,8 @@ Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
Handle<Boolean> Boolean::New(bool value) {
return value ? True() : False();
Isolate* isolate = Isolate::GetCurrent();
return value ? True(isolate) : False(isolate);
}
......
......@@ -296,7 +296,7 @@ bool RunCppCycle(v8::Handle<v8::Script> script,
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::String> input_line = ReadLine();
if (input_line == v8::Undefined()) {
if (input_line == v8::Undefined(isolate)) {
continue;
}
......@@ -436,7 +436,7 @@ v8::Handle<v8::String> ReadLine() {
res = fgets(buffer, kBufferSize, stdin);
}
if (res == NULL) {
v8::Handle<v8::Primitive> t = v8::Undefined();
v8::Handle<v8::Primitive> t = v8::Undefined(v8::Isolate::GetCurrent());
return v8::Handle<v8::String>::Cast(t);
}
// Remove newline char
......
......@@ -1010,7 +1010,9 @@ static Local<FunctionTemplate> FunctionTemplateNew(
}
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
if (callback != 0) {
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
Utils::ToLocal(obj)->SetCallHandler(callback, data);
}
obj->set_length(length);
......@@ -1234,7 +1236,9 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback,
i::Handle<i::CallHandlerInfo> obj =
i::Handle<i::CallHandlerInfo>::cast(struct_obj);
SET_FIELD_WRAPPED(obj, set_callback, callback);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
obj->set_data(*Utils::OpenHandle(*data));
Utils::OpenHandle(this)->set_call_code(*obj);
}
......@@ -1272,7 +1276,9 @@ static i::Handle<i::AccessorInfo> MakeAccessorInfo(
isolate->factory()->NewExecutableAccessorInfo();
SET_FIELD_WRAPPED(obj, set_getter, getter);
SET_FIELD_WRAPPED(obj, set_setter, setter);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
obj->set_data(*Utils::OpenHandle(*data));
return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
}
......@@ -1500,7 +1506,9 @@ void ObjectTemplate::SetNamedPropertyHandler(
if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
obj->set_data(*Utils::OpenHandle(*data));
cons->set_named_property_handler(*obj);
}
......@@ -1536,7 +1544,9 @@ void ObjectTemplate::SetAccessCheckCallbacks(
SET_FIELD_WRAPPED(info, set_named_callback, named_callback);
SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
info->set_data(*Utils::OpenHandle(*data));
i::FunctionTemplateInfo* constructor =
......@@ -1572,7 +1582,9 @@ void ObjectTemplate::SetIndexedPropertyHandler(
if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover);
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
obj->set_data(*Utils::OpenHandle(*data));
cons->set_indexed_property_handler(*obj);
}
......@@ -1592,7 +1604,9 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
i::Handle<i::CallHandlerInfo> obj =
i::Handle<i::CallHandlerInfo>::cast(struct_obj);
SET_FIELD_WRAPPED(obj, set_callback, callback);
if (data.IsEmpty()) data = v8::Undefined();
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
obj->set_data(*Utils::OpenHandle(*data));
cons->set_instance_call_handler(*obj);
}
......@@ -1697,8 +1711,9 @@ Local<Script> Script::New(v8::Handle<String> source,
static_cast<int>(origin->ResourceColumnOffset()->Value());
}
if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) {
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
is_shared_cross_origin =
origin->ResourceIsSharedCrossOrigin() == v8::True();
origin->ResourceIsSharedCrossOrigin() == v8::True(v8_isolate);
}
}
EXCEPTION_PREAMBLE(isolate);
......@@ -1943,7 +1958,7 @@ bool v8::TryCatch::HasTerminated() const {
v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
if (!HasCaught()) return v8::Local<v8::Value>();
rethrow_ = true;
return v8::Undefined();
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate_));
}
......@@ -4113,10 +4128,12 @@ int Function::GetScriptColumnNumber() const {
Handle<Value> Function::GetScriptId() const {
i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
if (!func->shared()->script()->IsScript())
return v8::Undefined();
i::Isolate* isolate = func->GetIsolate();
if (!func->shared()->script()->IsScript()) {
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
return Utils::ToLocal(i::Handle<i::Object>(script->id(), func->GetIsolate()));
return Utils::ToLocal(i::Handle<i::Object>(script->id(), isolate));
}
......@@ -6362,7 +6379,7 @@ v8::Local<Value> Isolate::ThrowException(v8::Local<v8::Value> value) {
} else {
isolate->ScheduleThrow(*Utils::OpenHandle(*value));
}
return v8::Undefined();
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
......@@ -7113,7 +7130,7 @@ Handle<Value> HeapGraphEdge::GetName() const {
isolate->factory()->NewNumberFromInt(edge->index()));
default: UNREACHABLE();
}
return v8::Undefined();
return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
}
......
......@@ -3135,8 +3135,7 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent event,
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
v8::Handle<v8::Boolean> running =
auto_continue ? v8::True() : v8::False();
v8::Handle<v8::Boolean> running = v8::Boolean::New(auto_continue);
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { running };
cmd_processor = v8::Local<v8::Object>::Cast(
......
......@@ -354,7 +354,8 @@ static void EmptyGetter(Local<String> name,
THREADED_TEST(EmptyResult) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
v8::Handle<v8::Object> inst = obj->NewInstance();
......@@ -362,7 +363,7 @@ THREADED_TEST(EmptyResult) {
Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
for (int i = 0; i < 10; i++) {
Local<Value> result = scr->Run();
CHECK(result == v8::Undefined());
CHECK(result == v8::Undefined(isolate));
}
}
......@@ -370,7 +371,8 @@ THREADED_TEST(EmptyResult) {
THREADED_TEST(NoReuseRegress) {
// Check that the IC generated for the one test doesn't get reused
// for the other.
v8::HandleScope scope(CcTest::isolate());
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
{
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
......@@ -380,7 +382,7 @@ THREADED_TEST(NoReuseRegress) {
Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
for (int i = 0; i < 2; i++) {
Local<Value> result = scr->Run();
CHECK(result == v8::Undefined());
CHECK(result == v8::Undefined(isolate));
}
}
{
......
This diff is collapsed.
......@@ -2400,7 +2400,8 @@ TEST(DebuggerStatementBreakpoint) {
// the correct results.
TEST(DebugEvaluate) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug();
// Create a function for checking the evaluation when hitting a break point.
......@@ -2413,13 +2414,13 @@ TEST(DebugEvaluate) {
// Different expected vaules of x and a when in a break point (u = undefined,
// d = Hello, world!).
struct EvaluateCheck checks_uu[] = {
{"x", v8::Undefined()},
{"a", v8::Undefined()},
{"x", v8::Undefined(isolate)},
{"a", v8::Undefined(isolate)},
{NULL, v8::Handle<v8::Value>()}
};
struct EvaluateCheck checks_hu[] = {
{"x", v8::String::New("Hello, world!")},
{"a", v8::Undefined()},
{"a", v8::Undefined(isolate)},
{NULL, v8::Handle<v8::Value>()}
};
struct EvaluateCheck checks_hh[] = {
......@@ -2485,7 +2486,7 @@ TEST(DebugEvaluate) {
// parameter.
checks = checks_uu;
v8::Handle<v8::Value> argv_bar_1[2] = {
v8::Undefined(),
v8::Undefined(isolate),
v8::Number::New(barbar_break_position)
};
bar->Call(env->Global(), 2, argv_bar_1);
......@@ -3105,7 +3106,8 @@ TEST(DebugStepLocals) {
TEST(DebugStepIf) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
......@@ -3129,14 +3131,14 @@ TEST(DebugStepIf) {
// Stepping through the true part.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_true[argc] = { v8::True() };
v8::Handle<v8::Value> argv_true[argc] = { v8::True(isolate) };
foo->Call(env->Global(), argc, argv_true);
CHECK_EQ(4, break_point_hit_count);
// Stepping through the false part.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_false[argc] = { v8::False() };
v8::Handle<v8::Value> argv_false[argc] = { v8::False(isolate) };
foo->Call(env->Global(), argc, argv_false);
CHECK_EQ(5, break_point_hit_count);
......@@ -3507,7 +3509,8 @@ TEST(DebugStepWith) {
TEST(DebugConditional) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
......@@ -3531,7 +3534,7 @@ TEST(DebugConditional) {
step_action = StepIn;
break_point_hit_count = 0;
const int argc = 1;
v8::Handle<v8::Value> argv_true[argc] = { v8::True() };
v8::Handle<v8::Value> argv_true[argc] = { v8::True(isolate) };
foo->Call(env->Global(), argc, argv_true);
CHECK_EQ(5, break_point_hit_count);
......@@ -3759,7 +3762,8 @@ TEST(DebugStepFunctionApply) {
// Test that step in works with function.call.
TEST(DebugStepFunctionCall) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
// Create a function for testing stepping.
v8::Local<v8::Function> foo = CompileFunction(
......@@ -3786,7 +3790,7 @@ TEST(DebugStepFunctionCall) {
// Check stepping where the if condition in bar is true.
break_point_hit_count = 0;
const int argc = 1;
v8::Handle<v8::Value> argv[argc] = { v8::True() };
v8::Handle<v8::Value> argv[argc] = { v8::True(isolate) };
foo->Call(env->Global(), argc, argv);
CHECK_EQ(8, break_point_hit_count);
......
......@@ -234,7 +234,7 @@ TEST(Unknown) {
1, // access
1, // declaration
2, // declaration + initialization
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ DeclarationContext context;
......@@ -258,15 +258,16 @@ TEST(Unknown) {
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ DeclarationContext context;
// SB 0 - BUG 1213579
context.Check("const x = 0; x",
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
}
......@@ -313,7 +314,7 @@ TEST(Present) {
1, // access
1, // initialization
1, // (re-)declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ PresentPropertyContext context;
......@@ -336,14 +337,15 @@ class AbsentPropertyContext: public DeclarationContext {
TEST(Absent) {
HandleScope scope(CcTest::isolate());
v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
{ AbsentPropertyContext context;
context.Check("var x; x",
1, // access
1, // declaration
2, // declaration + initialization
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(isolate));
}
{ AbsentPropertyContext context;
......@@ -367,7 +369,7 @@ TEST(Absent) {
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(isolate));
}
{ AbsentPropertyContext context;
......@@ -375,7 +377,7 @@ TEST(Absent) {
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579
EXPECT_RESULT, Undefined(isolate)); // SB 0 - BUG 1213579
}
{ AbsentPropertyContext context;
......@@ -383,7 +385,7 @@ TEST(Absent) {
1, // access
1, // declaration
1, // declaration + initialization
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(isolate));
}
}
......@@ -433,7 +435,7 @@ TEST(Appearing) {
1, // access
1, // declaration
2, // declaration + initialization
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ AppearingPropertyContext context;
......@@ -457,7 +459,7 @@ TEST(Appearing) {
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ AppearingPropertyContext context;
......@@ -465,7 +467,7 @@ TEST(Appearing) {
1, // access
2, // declaration + initialization
1, // declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
// Result is undefined because declaration succeeded but
// initialization to 0 failed (due to context behavior).
}
......@@ -525,7 +527,7 @@ TEST(Reappearing) {
0,
3, // const declaration+initialization, var initialization
3, // 2 x declaration + var initialization
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
}
......@@ -564,7 +566,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ ExistsInPrototypeContext context;
......@@ -580,7 +582,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
{ ExistsInPrototypeContext context;
......@@ -617,7 +619,7 @@ TEST(AbsentInPrototype) {
0,
0,
0,
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
}
......@@ -689,7 +691,7 @@ TEST(ExistsInHiddenPrototype) {
0,
0,
1, // (re-)declaration
EXPECT_RESULT, Undefined());
EXPECT_RESULT, Undefined(CcTest::isolate()));
}
// TODO(mstarzinger): The semantics of global const is vague.
......
......@@ -394,7 +394,7 @@ TEST(HiddenPrototypeObservation) {
{ obj, "updated", "foo", Number::New(75) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
obj->SetPrototype(Null());
obj->SetPrototype(Null(isolate.GetIsolate()));
CompileRun("obj.foo = 43");
const RecordExpectation expected_records2[] = {
{ obj, "new", "foo", Handle<Value>() }
......
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