Removed internal uses of (almost) deprecated FunctionTemplate::New version.

LOG=y
R=dcarney@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18342 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7be4945c
...@@ -204,12 +204,12 @@ int RunMain(int argc, char* argv[]) { ...@@ -204,12 +204,12 @@ int RunMain(int argc, char* argv[]) {
// Bind the global 'print' function to the C++ Print callback. // Bind the global 'print' function to the C++ Print callback.
global->Set(v8::String::NewFromUtf8(isolate, "print"), global->Set(v8::String::NewFromUtf8(isolate, "print"),
v8::FunctionTemplate::New(Print)); v8::FunctionTemplate::New(isolate, Print));
if (cycle_type == CycleInJs) { if (cycle_type == CycleInJs) {
// Bind the global 'read_line' function to the C++ Print callback. // Bind the global 'read_line' function to the C++ Print callback.
global->Set(v8::String::NewFromUtf8(isolate, "read_line"), global->Set(v8::String::NewFromUtf8(isolate, "read_line"),
v8::FunctionTemplate::New(ReadLine)); v8::FunctionTemplate::New(isolate, ReadLine));
} }
// Create a new execution environment containing the built-in // Create a new execution environment containing the built-in
......
...@@ -162,7 +162,7 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts, ...@@ -162,7 +162,7 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
// built-in global functions. // built-in global functions.
Handle<ObjectTemplate> global = ObjectTemplate::New(); Handle<ObjectTemplate> global = ObjectTemplate::New();
global->Set(String::NewFromUtf8(GetIsolate(), "log"), global->Set(String::NewFromUtf8(GetIsolate(), "log"),
FunctionTemplate::New(LogCallback)); FunctionTemplate::New(GetIsolate(), LogCallback));
// Each processor gets its own context so different processors don't // Each processor gets its own context so different processors don't
// affect each other. Context::New returns a persistent handle which // affect each other. Context::New returns a persistent handle which
......
...@@ -101,19 +101,19 @@ v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) { ...@@ -101,19 +101,19 @@ v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) {
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// Bind the global 'print' function to the C++ Print callback. // Bind the global 'print' function to the C++ Print callback.
global->Set(v8::String::NewFromUtf8(isolate, "print"), global->Set(v8::String::NewFromUtf8(isolate, "print"),
v8::FunctionTemplate::New(Print)); v8::FunctionTemplate::New(isolate, Print));
// Bind the global 'read' function to the C++ Read callback. // Bind the global 'read' function to the C++ Read callback.
global->Set(v8::String::NewFromUtf8(isolate, "read"), global->Set(v8::String::NewFromUtf8(isolate, "read"),
v8::FunctionTemplate::New(Read)); v8::FunctionTemplate::New(isolate, Read));
// Bind the global 'load' function to the C++ Load callback. // Bind the global 'load' function to the C++ Load callback.
global->Set(v8::String::NewFromUtf8(isolate, "load"), global->Set(v8::String::NewFromUtf8(isolate, "load"),
v8::FunctionTemplate::New(Load)); v8::FunctionTemplate::New(isolate, Load));
// Bind the 'quit' function // Bind the 'quit' function
global->Set(v8::String::NewFromUtf8(isolate, "quit"), global->Set(v8::String::NewFromUtf8(isolate, "quit"),
v8::FunctionTemplate::New(Quit)); v8::FunctionTemplate::New(isolate, Quit));
// Bind the 'version' function // Bind the 'version' function
global->Set(v8::String::NewFromUtf8(isolate, "version"), global->Set(v8::String::NewFromUtf8(isolate, "version"),
v8::FunctionTemplate::New(Version)); v8::FunctionTemplate::New(isolate, Version));
return v8::Context::New(isolate, NULL, global); return v8::Context::New(isolate, NULL, global);
} }
......
...@@ -1368,13 +1368,15 @@ Local<ObjectTemplate> ObjectTemplate::New( ...@@ -1368,13 +1368,15 @@ Local<ObjectTemplate> ObjectTemplate::New(
// Ensure that the object template has a constructor. If no // Ensure that the object template has a constructor. If no
// constructor is available we create one. // constructor is available we create one.
static i::Handle<i::FunctionTemplateInfo> EnsureConstructor( static i::Handle<i::FunctionTemplateInfo> EnsureConstructor(
i::Isolate* isolate,
ObjectTemplate* object_template) { ObjectTemplate* object_template) {
i::Object* obj = Utils::OpenHandle(object_template)->constructor(); i::Object* obj = Utils::OpenHandle(object_template)->constructor();
if (!obj ->IsUndefined()) { if (!obj ->IsUndefined()) {
i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj);
return i::Handle<i::FunctionTemplateInfo>(info, info->GetIsolate()); return i::Handle<i::FunctionTemplateInfo>(info, isolate);
} }
Local<FunctionTemplate> templ = FunctionTemplate::New(); Local<FunctionTemplate> templ =
FunctionTemplate::New(reinterpret_cast<Isolate*>(isolate));
i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ); i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ);
constructor->set_instance_template(*Utils::OpenHandle(object_template)); constructor->set_instance_template(*Utils::OpenHandle(object_template));
Utils::OpenHandle(object_template)->set_constructor(*constructor); Utils::OpenHandle(object_template)->set_constructor(*constructor);
...@@ -1396,6 +1398,7 @@ static inline void AddPropertyToTemplate( ...@@ -1396,6 +1398,7 @@ static inline void AddPropertyToTemplate(
static inline i::Handle<i::TemplateInfo> GetTemplateInfo( static inline i::Handle<i::TemplateInfo> GetTemplateInfo(
i::Isolate* isolate,
Template* template_obj) { Template* template_obj) {
return Utils::OpenHandle(template_obj); return Utils::OpenHandle(template_obj);
} }
...@@ -1403,8 +1406,9 @@ static inline i::Handle<i::TemplateInfo> GetTemplateInfo( ...@@ -1403,8 +1406,9 @@ static inline i::Handle<i::TemplateInfo> GetTemplateInfo(
// TODO(dcarney): remove this with ObjectTemplate::SetAccessor // TODO(dcarney): remove this with ObjectTemplate::SetAccessor
static inline i::Handle<i::TemplateInfo> GetTemplateInfo( static inline i::Handle<i::TemplateInfo> GetTemplateInfo(
i::Isolate* isolate,
ObjectTemplate* object_template) { ObjectTemplate* object_template) {
EnsureConstructor(object_template); EnsureConstructor(isolate, object_template);
return Utils::OpenHandle(object_template); return Utils::OpenHandle(object_template);
} }
...@@ -1425,7 +1429,7 @@ static bool TemplateSetAccessor( ...@@ -1425,7 +1429,7 @@ static bool TemplateSetAccessor(
i::Handle<i::AccessorInfo> obj = MakeAccessorInfo( i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(
name, getter, setter, data, settings, attribute, signature); name, getter, setter, data, settings, attribute, signature);
if (obj.is_null()) return false; if (obj.is_null()) return false;
i::Handle<i::TemplateInfo> info = GetTemplateInfo(template_obj); i::Handle<i::TemplateInfo> info = GetTemplateInfo(isolate, template_obj);
AddPropertyToTemplate(info, obj); AddPropertyToTemplate(info, obj);
return true; return true;
} }
...@@ -1477,7 +1481,7 @@ void ObjectTemplate::SetNamedPropertyHandler( ...@@ -1477,7 +1481,7 @@ void ObjectTemplate::SetNamedPropertyHandler(
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
EnsureConstructor(this); EnsureConstructor(isolate, this);
i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast(
Utils::OpenHandle(this)->constructor()); Utils::OpenHandle(this)->constructor());
i::Handle<i::FunctionTemplateInfo> cons(constructor); i::Handle<i::FunctionTemplateInfo> cons(constructor);
...@@ -1504,7 +1508,7 @@ void ObjectTemplate::MarkAsUndetectable() { ...@@ -1504,7 +1508,7 @@ void ObjectTemplate::MarkAsUndetectable() {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
EnsureConstructor(this); EnsureConstructor(isolate, this);
i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo* constructor =
i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor());
i::Handle<i::FunctionTemplateInfo> cons(constructor); i::Handle<i::FunctionTemplateInfo> cons(constructor);
...@@ -1520,7 +1524,7 @@ void ObjectTemplate::SetAccessCheckCallbacks( ...@@ -1520,7 +1524,7 @@ void ObjectTemplate::SetAccessCheckCallbacks(
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
EnsureConstructor(this); EnsureConstructor(isolate, this);
i::Handle<i::Struct> struct_info = i::Handle<i::Struct> struct_info =
isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE);
...@@ -1553,7 +1557,7 @@ void ObjectTemplate::SetIndexedPropertyHandler( ...@@ -1553,7 +1557,7 @@ void ObjectTemplate::SetIndexedPropertyHandler(
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
EnsureConstructor(this); EnsureConstructor(isolate, this);
i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast(
Utils::OpenHandle(this)->constructor()); Utils::OpenHandle(this)->constructor());
i::Handle<i::FunctionTemplateInfo> cons(constructor); i::Handle<i::FunctionTemplateInfo> cons(constructor);
...@@ -1581,7 +1585,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, ...@@ -1581,7 +1585,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
EnsureConstructor(this); EnsureConstructor(isolate, this);
i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast(
Utils::OpenHandle(this)->constructor()); Utils::OpenHandle(this)->constructor());
i::Handle<i::FunctionTemplateInfo> cons(constructor); i::Handle<i::FunctionTemplateInfo> cons(constructor);
...@@ -1615,7 +1619,7 @@ void ObjectTemplate::SetInternalFieldCount(int value) { ...@@ -1615,7 +1619,7 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
// The internal field count is set by the constructor function's // The internal field count is set by the constructor function's
// construct code, so we ensure that there is a constructor // construct code, so we ensure that there is a constructor
// function to do the setting. // function to do the setting.
EnsureConstructor(this); EnsureConstructor(isolate, this);
} }
Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value)); Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value));
} }
...@@ -5140,11 +5144,11 @@ static i::Handle<i::Context> CreateEnvironment( ...@@ -5140,11 +5144,11 @@ static i::Handle<i::Context> CreateEnvironment(
if (!global_template.IsEmpty()) { if (!global_template.IsEmpty()) {
// Make sure that the global_template has a constructor. // Make sure that the global_template has a constructor.
global_constructor = EnsureConstructor(*global_template); global_constructor = EnsureConstructor(isolate, *global_template);
// Create a fresh template for the global proxy object. // Create a fresh template for the global proxy object.
proxy_template = ObjectTemplate::New(); proxy_template = ObjectTemplate::New();
proxy_constructor = EnsureConstructor(*proxy_template); proxy_constructor = EnsureConstructor(isolate, *proxy_template);
// Set the global template to be the prototype template of // Set the global template to be the prototype template of
// global proxy template. // global proxy template.
......
...@@ -723,19 +723,19 @@ void Shell::UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -723,19 +723,19 @@ void Shell::UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Shell::AddOSMethods(Isolate* isolate, Handle<ObjectTemplate> os_templ) { void Shell::AddOSMethods(Isolate* isolate, Handle<ObjectTemplate> os_templ) {
os_templ->Set(String::NewFromUtf8(isolate, "system"), os_templ->Set(String::NewFromUtf8(isolate, "system"),
FunctionTemplate::New(System)); FunctionTemplate::New(isolate, System));
os_templ->Set(String::NewFromUtf8(isolate, "chdir"), os_templ->Set(String::NewFromUtf8(isolate, "chdir"),
FunctionTemplate::New(ChangeDirectory)); FunctionTemplate::New(isolate, ChangeDirectory));
os_templ->Set(String::NewFromUtf8(isolate, "setenv"), os_templ->Set(String::NewFromUtf8(isolate, "setenv"),
FunctionTemplate::New(SetEnvironment)); FunctionTemplate::New(isolate, SetEnvironment));
os_templ->Set(String::NewFromUtf8(isolate, "unsetenv"), os_templ->Set(String::NewFromUtf8(isolate, "unsetenv"),
FunctionTemplate::New(UnsetEnvironment)); FunctionTemplate::New(isolate, UnsetEnvironment));
os_templ->Set(String::NewFromUtf8(isolate, "umask"), os_templ->Set(String::NewFromUtf8(isolate, "umask"),
FunctionTemplate::New(SetUMask)); FunctionTemplate::New(isolate, SetUMask));
os_templ->Set(String::NewFromUtf8(isolate, "mkdirp"), os_templ->Set(String::NewFromUtf8(isolate, "mkdirp"),
FunctionTemplate::New(MakeDirectory)); FunctionTemplate::New(isolate, MakeDirectory));
os_templ->Set(String::NewFromUtf8(isolate, "rmdir"), os_templ->Set(String::NewFromUtf8(isolate, "rmdir"),
FunctionTemplate::New(RemoveDirectory)); FunctionTemplate::New(isolate, RemoveDirectory));
} }
} // namespace v8 } // namespace v8
...@@ -860,38 +860,38 @@ class BZip2Decompressor : public v8::StartupDataDecompressor { ...@@ -860,38 +860,38 @@ class BZip2Decompressor : public v8::StartupDataDecompressor {
Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
Handle<ObjectTemplate> global_template = ObjectTemplate::New(); Handle<ObjectTemplate> global_template = ObjectTemplate::New();
global_template->Set(String::NewFromUtf8(isolate, "print"), global_template->Set(String::NewFromUtf8(isolate, "print"),
FunctionTemplate::New(Print)); FunctionTemplate::New(isolate, Print));
global_template->Set(String::NewFromUtf8(isolate, "write"), global_template->Set(String::NewFromUtf8(isolate, "write"),
FunctionTemplate::New(Write)); FunctionTemplate::New(isolate, Write));
global_template->Set(String::NewFromUtf8(isolate, "read"), global_template->Set(String::NewFromUtf8(isolate, "read"),
FunctionTemplate::New(Read)); FunctionTemplate::New(isolate, Read));
global_template->Set(String::NewFromUtf8(isolate, "readbuffer"), global_template->Set(String::NewFromUtf8(isolate, "readbuffer"),
FunctionTemplate::New(ReadBuffer)); FunctionTemplate::New(isolate, ReadBuffer));
global_template->Set(String::NewFromUtf8(isolate, "readline"), global_template->Set(String::NewFromUtf8(isolate, "readline"),
FunctionTemplate::New(ReadLine)); FunctionTemplate::New(isolate, ReadLine));
global_template->Set(String::NewFromUtf8(isolate, "load"), global_template->Set(String::NewFromUtf8(isolate, "load"),
FunctionTemplate::New(Load)); FunctionTemplate::New(isolate, Load));
global_template->Set(String::NewFromUtf8(isolate, "quit"), global_template->Set(String::NewFromUtf8(isolate, "quit"),
FunctionTemplate::New(Quit)); FunctionTemplate::New(isolate, Quit));
global_template->Set(String::NewFromUtf8(isolate, "version"), global_template->Set(String::NewFromUtf8(isolate, "version"),
FunctionTemplate::New(Version)); FunctionTemplate::New(isolate, Version));
// Bind the Realm object. // Bind the Realm object.
Handle<ObjectTemplate> realm_template = ObjectTemplate::New(); Handle<ObjectTemplate> realm_template = ObjectTemplate::New();
realm_template->Set(String::NewFromUtf8(isolate, "current"), realm_template->Set(String::NewFromUtf8(isolate, "current"),
FunctionTemplate::New(RealmCurrent)); FunctionTemplate::New(isolate, RealmCurrent));
realm_template->Set(String::NewFromUtf8(isolate, "owner"), realm_template->Set(String::NewFromUtf8(isolate, "owner"),
FunctionTemplate::New(RealmOwner)); FunctionTemplate::New(isolate, RealmOwner));
realm_template->Set(String::NewFromUtf8(isolate, "global"), realm_template->Set(String::NewFromUtf8(isolate, "global"),
FunctionTemplate::New(RealmGlobal)); FunctionTemplate::New(isolate, RealmGlobal));
realm_template->Set(String::NewFromUtf8(isolate, "create"), realm_template->Set(String::NewFromUtf8(isolate, "create"),
FunctionTemplate::New(RealmCreate)); FunctionTemplate::New(isolate, RealmCreate));
realm_template->Set(String::NewFromUtf8(isolate, "dispose"), realm_template->Set(String::NewFromUtf8(isolate, "dispose"),
FunctionTemplate::New(RealmDispose)); FunctionTemplate::New(isolate, RealmDispose));
realm_template->Set(String::NewFromUtf8(isolate, "switch"), realm_template->Set(String::NewFromUtf8(isolate, "switch"),
FunctionTemplate::New(RealmSwitch)); FunctionTemplate::New(isolate, RealmSwitch));
realm_template->Set(String::NewFromUtf8(isolate, "eval"), realm_template->Set(String::NewFromUtf8(isolate, "eval"),
FunctionTemplate::New(RealmEval)); FunctionTemplate::New(isolate, RealmEval));
realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"), realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"),
RealmSharedGet, RealmSharedSet); RealmSharedGet, RealmSharedSet);
global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template); global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template);
...@@ -899,7 +899,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { ...@@ -899,7 +899,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
#ifndef V8_SHARED #ifndef V8_SHARED
Handle<ObjectTemplate> performance_template = ObjectTemplate::New(); Handle<ObjectTemplate> performance_template = ObjectTemplate::New();
performance_template->Set(String::NewFromUtf8(isolate, "now"), performance_template->Set(String::NewFromUtf8(isolate, "now"),
FunctionTemplate::New(PerformanceNow)); FunctionTemplate::New(isolate, PerformanceNow));
global_template->Set(String::NewFromUtf8(isolate, "performance"), global_template->Set(String::NewFromUtf8(isolate, "performance"),
performance_template); performance_template);
#endif // V8_SHARED #endif // V8_SHARED
......
...@@ -64,10 +64,12 @@ v8::Handle<v8::FunctionTemplate> ...@@ -64,10 +64,12 @@ v8::Handle<v8::FunctionTemplate>
ExternalizeStringExtension::GetNativeFunctionTemplate( ExternalizeStringExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<v8::String> str) { v8::Isolate* isolate, v8::Handle<v8::String> str) {
if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) { if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) {
return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize); return v8::FunctionTemplate::New(isolate,
ExternalizeStringExtension::Externalize);
} else { } else {
ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0); ASSERT(strcmp(*v8::String::Utf8Value(str), "isAsciiString") == 0);
return v8::FunctionTemplate::New(ExternalizeStringExtension::IsAscii); return v8::FunctionTemplate::New(isolate,
ExternalizeStringExtension::IsAscii);
} }
} }
......
...@@ -36,7 +36,7 @@ namespace internal { ...@@ -36,7 +36,7 @@ namespace internal {
v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate( v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::String> str) { v8::Handle<v8::String> str) {
return v8::FunctionTemplate::New(FreeBufferExtension::FreeBuffer); return v8::FunctionTemplate::New(isolate, FreeBufferExtension::FreeBuffer);
} }
......
...@@ -35,7 +35,7 @@ namespace internal { ...@@ -35,7 +35,7 @@ namespace internal {
v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunctionTemplate( v8::Handle<v8::FunctionTemplate> GCExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::String> str) { v8::Handle<v8::String> str) {
return v8::FunctionTemplate::New(GCExtension::GC); return v8::FunctionTemplate::New(isolate, GCExtension::GC);
} }
......
...@@ -38,7 +38,7 @@ v8::Handle<v8::FunctionTemplate> StatisticsExtension::GetNativeFunctionTemplate( ...@@ -38,7 +38,7 @@ v8::Handle<v8::FunctionTemplate> StatisticsExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::String> str) { v8::Handle<v8::String> str) {
ASSERT(strcmp(*v8::String::Utf8Value(str), "getV8Statistics") == 0); ASSERT(strcmp(*v8::String::Utf8Value(str), "getV8Statistics") == 0);
return v8::FunctionTemplate::New(StatisticsExtension::GetCounters); return v8::FunctionTemplate::New(isolate, StatisticsExtension::GetCounters);
} }
......
...@@ -44,13 +44,16 @@ TriggerFailureExtension::GetNativeFunctionTemplate( ...@@ -44,13 +44,16 @@ TriggerFailureExtension::GetNativeFunctionTemplate(
v8::Handle<v8::String> str) { v8::Handle<v8::String> str) {
if (strcmp(*v8::String::Utf8Value(str), "triggerCheckFalse") == 0) { if (strcmp(*v8::String::Utf8Value(str), "triggerCheckFalse") == 0) {
return v8::FunctionTemplate::New( return v8::FunctionTemplate::New(
isolate,
TriggerFailureExtension::TriggerCheckFalse); TriggerFailureExtension::TriggerCheckFalse);
} else if (strcmp(*v8::String::Utf8Value(str), "triggerAssertFalse") == 0) { } else if (strcmp(*v8::String::Utf8Value(str), "triggerAssertFalse") == 0) {
return v8::FunctionTemplate::New( return v8::FunctionTemplate::New(
isolate,
TriggerFailureExtension::TriggerAssertFalse); TriggerFailureExtension::TriggerAssertFalse);
} else { } else {
CHECK_EQ(0, strcmp(*v8::String::Utf8Value(str), "triggerSlowAssertFalse")); CHECK_EQ(0, strcmp(*v8::String::Utf8Value(str), "triggerSlowAssertFalse"));
return v8::FunctionTemplate::New( return v8::FunctionTemplate::New(
isolate,
TriggerFailureExtension::TriggerSlowAssertFalse); TriggerFailureExtension::TriggerSlowAssertFalse);
} }
} }
......
...@@ -65,11 +65,12 @@ static void handle_property(const v8::FunctionCallbackInfo<v8::Value>& info) { ...@@ -65,11 +65,12 @@ static void handle_property(const v8::FunctionCallbackInfo<v8::Value>& info) {
THREADED_TEST(PropertyHandler) { THREADED_TEST(PropertyHandler) {
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::Isolate* isolate = env->GetIsolate();
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); v8::HandleScope scope(isolate);
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(isolate);
fun_templ->InstanceTemplate()->SetAccessor(v8_str("foo"), handle_property); fun_templ->InstanceTemplate()->SetAccessor(v8_str("foo"), handle_property);
Local<v8::FunctionTemplate> getter_templ = Local<v8::FunctionTemplate> getter_templ =
v8::FunctionTemplate::New(handle_property); v8::FunctionTemplate::New(isolate, handle_property);
getter_templ->SetLength(0); getter_templ->SetLength(0);
fun_templ-> fun_templ->
InstanceTemplate()->SetAccessorProperty(v8_str("bar"), getter_templ); InstanceTemplate()->SetAccessorProperty(v8_str("bar"), getter_templ);
...@@ -120,17 +121,18 @@ THREADED_TEST(GlobalVariableAccess) { ...@@ -120,17 +121,18 @@ THREADED_TEST(GlobalVariableAccess) {
foo = 0; foo = 0;
bar = -4; bar = -4;
baz = 10; baz = 10;
v8::HandleScope scope(CcTest::isolate()); v8::Isolate* isolate = CcTest::isolate();
v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(); v8::HandleScope scope(isolate);
v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate);
templ->InstanceTemplate()->SetAccessor( templ->InstanceTemplate()->SetAccessor(
v8_str("foo"), GetIntValue, SetIntValue, v8_str("foo"), GetIntValue, SetIntValue,
v8::External::New(CcTest::isolate(), &foo)); v8::External::New(isolate, &foo));
templ->InstanceTemplate()->SetAccessor( templ->InstanceTemplate()->SetAccessor(
v8_str("bar"), GetIntValue, SetIntValue, v8_str("bar"), GetIntValue, SetIntValue,
v8::External::New(CcTest::isolate(), &bar)); v8::External::New(isolate, &bar));
templ->InstanceTemplate()->SetAccessor( templ->InstanceTemplate()->SetAccessor(
v8_str("baz"), GetIntValue, SetIntValue, v8_str("baz"), GetIntValue, SetIntValue,
v8::External::New(CcTest::isolate(), &baz)); v8::External::New(isolate, &baz));
LocalContext env(0, templ->InstanceTemplate()); LocalContext env(0, templ->InstanceTemplate());
v8_compile("foo = (++bar) + baz")->Run(); v8_compile("foo = (++bar) + baz")->Run();
CHECK_EQ(bar, -3); CHECK_EQ(bar, -3);
...@@ -190,12 +192,13 @@ static void XSetter(const v8::FunctionCallbackInfo<v8::Value>& info) { ...@@ -190,12 +192,13 @@ static void XSetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
THREADED_TEST(AccessorIC) { THREADED_TEST(AccessorIC) {
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("x0"), XGetter, XSetter); obj->SetAccessor(v8_str("x0"), XGetter, XSetter);
obj->SetAccessorProperty(v8_str("x1"), obj->SetAccessorProperty(v8_str("x1"),
v8::FunctionTemplate::New(XGetter), v8::FunctionTemplate::New(isolate, XGetter),
v8::FunctionTemplate::New(XSetter)); v8::FunctionTemplate::New(isolate, XSetter));
x_holder = obj->NewInstance(); x_holder = obj->NewInstance();
context->Global()->Set(v8_str("holder"), x_holder); context->Global()->Set(v8_str("holder"), x_holder);
x_receiver = v8::Object::New(); x_receiver = v8::Object::New();
......
This diff is collapsed.
...@@ -535,7 +535,8 @@ TEST(StackAlignmentForSSE2) { ...@@ -535,7 +535,8 @@ TEST(StackAlignmentForSSE2) {
v8::Isolate* isolate = CcTest::isolate(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); global_template->Set(v8_str("do_sse2"),
v8::FunctionTemplate::New(isolate, DoSSE2));
LocalContext env(NULL, global_template); LocalContext env(NULL, global_template);
CompileRun( CompileRun(
......
...@@ -615,7 +615,8 @@ TEST(StackAlignmentForSSE2) { ...@@ -615,7 +615,8 @@ TEST(StackAlignmentForSSE2) {
v8::Isolate* isolate = CcTest::isolate(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); global_template->Set(v8_str("do_sse2"),
v8::FunctionTemplate::New(isolate, DoSSE2));
LocalContext env(NULL, global_template); LocalContext env(NULL, global_template);
CompileRun( CompileRun(
......
...@@ -60,7 +60,7 @@ const char* PrintExtension::kSource = "native function print();"; ...@@ -60,7 +60,7 @@ const char* PrintExtension::kSource = "native function print();";
v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate( v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::String> str) { v8::Handle<v8::String> str) {
return v8::FunctionTemplate::New(PrintExtension::Print); return v8::FunctionTemplate::New(isolate, PrintExtension::Print);
} }
......
This diff is collapsed.
...@@ -4476,33 +4476,34 @@ TEST(InterceptorPropertyMirror) { ...@@ -4476,33 +4476,34 @@ TEST(InterceptorPropertyMirror) {
TEST(HiddenPrototypePropertyMirror) { TEST(HiddenPrototypePropertyMirror) {
// Create a V8 environment with debug access. // Create a V8 environment with debug access.
DebugLocalContext env; DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug(); env.ExposeDebug();
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "x"), t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "x"),
v8::Number::New(0)); v8::Number::New(0));
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
t1->SetHiddenPrototype(true); t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "y"), t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "y"),
v8::Number::New(1)); v8::Number::New(1));
v8::Handle<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
t2->SetHiddenPrototype(true); t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "z"), t2->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "z"),
v8::Number::New(2)); v8::Number::New(2));
v8::Handle<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
t3->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "u"), t3->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "u"),
v8::Number::New(3)); v8::Number::New(3));
// Create object and set them on the global object. // Create object and set them on the global object.
v8::Handle<v8::Object> o0 = t0->GetFunction()->NewInstance(); v8::Handle<v8::Object> o0 = t0->GetFunction()->NewInstance();
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o0"), o0); env->Global()->Set(v8::String::NewFromUtf8(isolate, "o0"), o0);
v8::Handle<v8::Object> o1 = t1->GetFunction()->NewInstance(); v8::Handle<v8::Object> o1 = t1->GetFunction()->NewInstance();
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o1"), o1); env->Global()->Set(v8::String::NewFromUtf8(isolate, "o1"), o1);
v8::Handle<v8::Object> o2 = t2->GetFunction()->NewInstance(); v8::Handle<v8::Object> o2 = t2->GetFunction()->NewInstance();
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o2"), o2); env->Global()->Set(v8::String::NewFromUtf8(isolate, "o2"), o2);
v8::Handle<v8::Object> o3 = t3->GetFunction()->NewInstance(); v8::Handle<v8::Object> o3 = t3->GetFunction()->NewInstance();
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o3"), o3); env->Global()->Set(v8::String::NewFromUtf8(isolate, "o3"), o3);
// Get mirrors for the four objects. // Get mirrors for the four objects.
CompileRun( CompileRun(
...@@ -4527,7 +4528,7 @@ TEST(HiddenPrototypePropertyMirror) { ...@@ -4527,7 +4528,7 @@ TEST(HiddenPrototypePropertyMirror) {
// Set o1 as prototype for o0. o1 has the hidden prototype flag so all // Set o1 as prototype for o0. o1 has the hidden prototype flag so all
// properties on o1 should be seen on o0. // properties on o1 should be seen on o0.
o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o1); o0->Set(v8::String::NewFromUtf8(isolate, "__proto__"), o1);
CHECK_EQ(2, CompileRun( CHECK_EQ(2, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value()); "o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(0, CompileRun( CHECK_EQ(0, CompileRun(
...@@ -4538,7 +4539,7 @@ TEST(HiddenPrototypePropertyMirror) { ...@@ -4538,7 +4539,7 @@ TEST(HiddenPrototypePropertyMirror) {
// Set o2 as prototype for o0 (it will end up after o1 as o1 has the hidden // Set o2 as prototype for o0 (it will end up after o1 as o1 has the hidden
// prototype flag. o2 also has the hidden prototype flag so all properties // prototype flag. o2 also has the hidden prototype flag so all properties
// on o2 should be seen on o0 as well as properties on o1. // on o2 should be seen on o0 as well as properties on o1.
o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o2); o0->Set(v8::String::NewFromUtf8(isolate, "__proto__"), o2);
CHECK_EQ(3, CompileRun( CHECK_EQ(3, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value()); "o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(0, CompileRun( CHECK_EQ(0, CompileRun(
...@@ -4554,7 +4555,7 @@ TEST(HiddenPrototypePropertyMirror) { ...@@ -4554,7 +4555,7 @@ TEST(HiddenPrototypePropertyMirror) {
// from o1 and o2 should still be seen on o0. // from o1 and o2 should still be seen on o0.
// Final prototype chain: o0 -> o1 -> o2 -> o3 // Final prototype chain: o0 -> o1 -> o2 -> o3
// Hidden prototypes: ^^ ^^ // Hidden prototypes: ^^ ^^
o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o3); o0->Set(v8::String::NewFromUtf8(isolate, "__proto__"), o3);
CHECK_EQ(3, CompileRun( CHECK_EQ(3, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value()); "o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(1, CompileRun( CHECK_EQ(1, CompileRun(
...@@ -4657,18 +4658,19 @@ TEST(NativeGetterThrowingErrorPropertyMirror) { ...@@ -4657,18 +4658,19 @@ TEST(NativeGetterThrowingErrorPropertyMirror) {
TEST(NoHiddenProperties) { TEST(NoHiddenProperties) {
// Create a V8 environment with debug access. // Create a V8 environment with debug access.
DebugLocalContext env; DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug(); env.ExposeDebug();
// Create an object in the global scope. // Create an object in the global scope.
const char* source = "var obj = {a: 1};"; const char* source = "var obj = {a: 1};";
v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), source)) v8::Script::Compile(v8::String::NewFromUtf8(isolate, source))
->Run(); ->Run();
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast( v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "obj"))); env->Global()->Get(v8::String::NewFromUtf8(isolate, "obj")));
// Set a hidden property on the object. // Set a hidden property on the object.
obj->SetHiddenValue( obj->SetHiddenValue(
v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::a"), v8::String::NewFromUtf8(isolate, "v8::test-debug::a"),
v8::Int32::New(11)); v8::Int32::New(11));
// Get mirror for the object with property getter. // Get mirror for the object with property getter.
...@@ -4685,34 +4687,34 @@ TEST(NoHiddenProperties) { ...@@ -4685,34 +4687,34 @@ TEST(NoHiddenProperties) {
"obj_mirror.property('a').value().value() == 1")->BooleanValue()); "obj_mirror.property('a').value().value() == 1")->BooleanValue());
// Object created by t0 will become hidden prototype of object 'obj'. // Object created by t0 will become hidden prototype of object 'obj'.
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "b"), t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "b"),
v8::Number::New(2)); v8::Number::New(2));
t0->SetHiddenPrototype(true); t0->SetHiddenPrototype(true);
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "c"), t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "c"),
v8::Number::New(3)); v8::Number::New(3));
// Create proto objects, add hidden properties to them and set them on // Create proto objects, add hidden properties to them and set them on
// the global object. // the global object.
v8::Handle<v8::Object> protoObj = t0->GetFunction()->NewInstance(); v8::Handle<v8::Object> protoObj = t0->GetFunction()->NewInstance();
protoObj->SetHiddenValue( protoObj->SetHiddenValue(
v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::b"), v8::String::NewFromUtf8(isolate, "v8::test-debug::b"),
v8::Int32::New(12)); v8::Int32::New(12));
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "protoObj"), env->Global()->Set(v8::String::NewFromUtf8(isolate, "protoObj"),
protoObj); protoObj);
v8::Handle<v8::Object> grandProtoObj = t1->GetFunction()->NewInstance(); v8::Handle<v8::Object> grandProtoObj = t1->GetFunction()->NewInstance();
grandProtoObj->SetHiddenValue( grandProtoObj->SetHiddenValue(
v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::c"), v8::String::NewFromUtf8(isolate, "v8::test-debug::c"),
v8::Int32::New(13)); v8::Int32::New(13));
env->Global()->Set( env->Global()->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "grandProtoObj"), v8::String::NewFromUtf8(isolate, "grandProtoObj"),
grandProtoObj); grandProtoObj);
// Setting prototypes: obj->protoObj->grandProtoObj // Setting prototypes: obj->protoObj->grandProtoObj
protoObj->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), protoObj->Set(v8::String::NewFromUtf8(isolate, "__proto__"),
grandProtoObj); grandProtoObj);
obj->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), protoObj); obj->Set(v8::String::NewFromUtf8(isolate, "__proto__"), protoObj);
// Get mirror for the object with property getter. // Get mirror for the object with property getter.
CompileRun("var obj_mirror = debug.MakeMirror(obj);"); CompileRun("var obj_mirror = debug.MakeMirror(obj);");
...@@ -5207,7 +5209,7 @@ void V8Thread::Run() { ...@@ -5207,7 +5209,7 @@ void V8Thread::Run() {
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set( global_template->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "ThreadedAtBarrier1"), v8::String::NewFromUtf8(env->GetIsolate(), "ThreadedAtBarrier1"),
v8::FunctionTemplate::New(ThreadedAtBarrier1)); v8::FunctionTemplate::New(CcTest::isolate(), ThreadedAtBarrier1));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(), v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL, NULL,
global_template); global_template);
...@@ -5568,16 +5570,16 @@ TEST(CallFunctionInDebugger) { ...@@ -5568,16 +5570,16 @@ TEST(CallFunctionInDebugger) {
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set( global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount"), v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount"),
v8::FunctionTemplate::New(CheckFrameCount)); v8::FunctionTemplate::New(CcTest::isolate(), CheckFrameCount));
global_template->Set( global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine"), v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine"),
v8::FunctionTemplate::New(CheckSourceLine)); v8::FunctionTemplate::New(CcTest::isolate(), CheckSourceLine));
global_template->Set( global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckDataParameter"), v8::String::NewFromUtf8(CcTest::isolate(), "CheckDataParameter"),
v8::FunctionTemplate::New(CheckDataParameter)); v8::FunctionTemplate::New(CcTest::isolate(), CheckDataParameter));
global_template->Set( global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure"), v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure"),
v8::FunctionTemplate::New(CheckClosure)); v8::FunctionTemplate::New(CcTest::isolate(), CheckClosure));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(), v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL, NULL,
global_template); global_template);
...@@ -7427,7 +7429,7 @@ TEST(DebugBreakStackInspection) { ...@@ -7427,7 +7429,7 @@ TEST(DebugBreakStackInspection) {
CompileFunction(&env, frame_local_value_source, "frame_local_value"); CompileFunction(&env, frame_local_value_source, "frame_local_value");
v8::Handle<v8::FunctionTemplate> schedule_break_template = v8::Handle<v8::FunctionTemplate> schedule_break_template =
v8::FunctionTemplate::New(ScheduleBreak); v8::FunctionTemplate::New(env->GetIsolate(), ScheduleBreak);
v8::Handle<v8::Function> schedule_break = v8::Handle<v8::Function> schedule_break =
schedule_break_template->GetFunction(); schedule_break_template->GetFunction();
env->Global()->Set(v8_str("scheduleBreak"), schedule_break); env->Global()->Set(v8_str("scheduleBreak"), schedule_break);
......
...@@ -95,7 +95,8 @@ static v8::Local<v8::ObjectTemplate> CreateConstructor( ...@@ -95,7 +95,8 @@ static v8::Local<v8::ObjectTemplate> CreateConstructor(
const char* descriptor_name = NULL, const char* descriptor_name = NULL,
v8::Handle<v8::DeclaredAccessorDescriptor> descriptor = v8::Handle<v8::DeclaredAccessorDescriptor> descriptor =
v8::Handle<v8::DeclaredAccessorDescriptor>()) { v8::Handle<v8::DeclaredAccessorDescriptor>()) {
v8::Local<v8::FunctionTemplate> constructor = v8::FunctionTemplate::New(); v8::Local<v8::FunctionTemplate> constructor =
v8::FunctionTemplate::New(context->GetIsolate());
v8::Local<v8::ObjectTemplate> obj_template = constructor->InstanceTemplate(); v8::Local<v8::ObjectTemplate> obj_template = constructor->InstanceTemplate();
// Setup object template. // Setup object template.
if (descriptor_name != NULL && !descriptor.IsEmpty()) { if (descriptor_name != NULL && !descriptor.IsEmpty()) {
......
...@@ -118,7 +118,7 @@ void DeclarationContext::InitializeIfNeeded() { ...@@ -118,7 +118,7 @@ void DeclarationContext::InitializeIfNeeded() {
if (is_initialized_) return; if (is_initialized_) return;
Isolate* isolate = CcTest::isolate(); Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
Local<FunctionTemplate> function = FunctionTemplate::New(); Local<FunctionTemplate> function = FunctionTemplate::New(isolate);
Local<Value> data = External::New(CcTest::isolate(), this); Local<Value> data = External::New(CcTest::isolate(), this);
GetHolder(function)->SetNamedPropertyHandler(&HandleGet, GetHolder(function)->SetNamedPropertyHandler(&HandleGet,
&HandleSet, &HandleSet,
...@@ -634,7 +634,7 @@ TEST(AbsentInPrototype) { ...@@ -634,7 +634,7 @@ TEST(AbsentInPrototype) {
class ExistsInHiddenPrototypeContext: public DeclarationContext { class ExistsInHiddenPrototypeContext: public DeclarationContext {
public: public:
ExistsInHiddenPrototypeContext() { ExistsInHiddenPrototypeContext() {
hidden_proto_ = FunctionTemplate::New(); hidden_proto_ = FunctionTemplate::New(CcTest::isolate());
hidden_proto_->SetHiddenPrototype(true); hidden_proto_->SetHiddenPrototype(true);
} }
......
...@@ -2087,6 +2087,7 @@ HeapProfilerExtension::GetNativeFunctionTemplate(v8::Isolate* isolate, ...@@ -2087,6 +2087,7 @@ HeapProfilerExtension::GetNativeFunctionTemplate(v8::Isolate* isolate,
v8::Handle<v8::String> name) { v8::Handle<v8::String> name) {
if (name->Equals(v8::String::NewFromUtf8(isolate, "findUntrackedObjects"))) { if (name->Equals(v8::String::NewFromUtf8(isolate, "findUntrackedObjects"))) {
return v8::FunctionTemplate::New( return v8::FunctionTemplate::New(
isolate,
HeapProfilerExtension::FindUntrackedObjects); HeapProfilerExtension::FindUntrackedObjects);
} else { } else {
CHECK(false); CHECK(false);
......
...@@ -115,14 +115,14 @@ const char* TraceExtension::kSource = ...@@ -115,14 +115,14 @@ const char* TraceExtension::kSource =
v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate( v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<String> name) { v8::Isolate* isolate, v8::Handle<String> name) {
if (name->Equals(String::NewFromUtf8(isolate, "trace"))) { if (name->Equals(String::NewFromUtf8(isolate, "trace"))) {
return v8::FunctionTemplate::New(TraceExtension::Trace); return v8::FunctionTemplate::New(isolate, TraceExtension::Trace);
} else if (name->Equals( } else if (name->Equals(
String::NewFromUtf8(isolate, "js_trace"))) { String::NewFromUtf8(isolate, "js_trace"))) {
return v8::FunctionTemplate::New(TraceExtension::JSTrace); return v8::FunctionTemplate::New(isolate, TraceExtension::JSTrace);
} else if (name->Equals(String::NewFromUtf8(isolate, "js_entry_sp"))) { } else if (name->Equals(String::NewFromUtf8(isolate, "js_entry_sp"))) {
return v8::FunctionTemplate::New(TraceExtension::JSEntrySP); return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySP);
} else if (name->Equals(String::NewFromUtf8(isolate, "js_entry_sp_level2"))) { } else if (name->Equals(String::NewFromUtf8(isolate, "js_entry_sp_level2"))) {
return v8::FunctionTemplate::New(TraceExtension::JSEntrySPLevel2); return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySPLevel2);
} else { } else {
CHECK(false); CHECK(false);
return v8::Handle<v8::FunctionTemplate>(); return v8::Handle<v8::FunctionTemplate>();
...@@ -232,7 +232,7 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -232,7 +232,7 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) {
void CreateFramePointerGrabberConstructor(v8::Local<v8::Context> context, void CreateFramePointerGrabberConstructor(v8::Local<v8::Context> context,
const char* constructor_name) { const char* constructor_name) {
Local<v8::FunctionTemplate> constructor_template = Local<v8::FunctionTemplate> constructor_template =
v8::FunctionTemplate::New(construct_call); v8::FunctionTemplate::New(context->GetIsolate(), construct_call);
constructor_template->SetClassName(v8_str("FPGrabber")); constructor_template->SetClassName(v8_str("FPGrabber"));
Local<Function> fun = constructor_template->GetFunction(); Local<Function> fun = constructor_template->GetFunction();
context->Global()->Set(v8_str(constructor_name), fun); context->Global()->Set(v8_str(constructor_name), fun);
......
...@@ -329,18 +329,20 @@ static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -329,18 +329,20 @@ static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(LogCallbacks) { TEST(LogCallbacks) {
v8::Isolate* isolate = CcTest::isolate();
ScopedLoggerInitializer initialize_logger; ScopedLoggerInitializer initialize_logger;
Logger* logger = initialize_logger.logger(); Logger* logger = initialize_logger.logger();
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), v8::Local<v8::FunctionTemplate>::New(isolate,
v8::FunctionTemplate::New()); v8::FunctionTemplate::New(isolate));
obj->SetClassName(v8_str("Obj")); obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate();
v8::Local<v8::Signature> signature = v8::Local<v8::Signature> signature =
v8::Signature::New(CcTest::isolate(), obj); v8::Signature::New(isolate, obj);
proto->Set(v8_str("method1"), proto->Set(v8_str("method1"),
v8::FunctionTemplate::New(ObjMethod1, v8::FunctionTemplate::New(isolate,
ObjMethod1,
v8::Handle<v8::Value>(), v8::Handle<v8::Value>(),
signature), signature),
static_cast<v8::PropertyAttribute>(v8::DontDelete)); static_cast<v8::PropertyAttribute>(v8::DontDelete));
...@@ -379,12 +381,13 @@ static void Prop2Getter(v8::Local<v8::String> property, ...@@ -379,12 +381,13 @@ static void Prop2Getter(v8::Local<v8::String> property,
TEST(LogAccessorCallbacks) { TEST(LogAccessorCallbacks) {
v8::Isolate* isolate = CcTest::isolate();
ScopedLoggerInitializer initialize_logger; ScopedLoggerInitializer initialize_logger;
Logger* logger = initialize_logger.logger(); Logger* logger = initialize_logger.logger();
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(), v8::Local<v8::FunctionTemplate>::New(isolate,
v8::FunctionTemplate::New()); v8::FunctionTemplate::New(isolate));
obj->SetClassName(v8_str("Obj")); obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate();
inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter);
......
...@@ -379,7 +379,7 @@ TEST(HiddenPrototypeObservation) { ...@@ -379,7 +379,7 @@ TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate; HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate()); HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate()); LocalContext context(isolate.GetIsolate());
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(); Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate());
tmpl->SetHiddenPrototype(true); tmpl->SetHiddenPrototype(true);
tmpl->InstanceTemplate()->Set( tmpl->InstanceTemplate()->Set(
String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75));
......
...@@ -74,7 +74,7 @@ TEST(StackAlignment) { ...@@ -74,7 +74,7 @@ TEST(StackAlignment) {
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("get_stack_pointer"), global_template->Set(v8_str("get_stack_pointer"),
v8::FunctionTemplate::New(GetStackPointer)); v8::FunctionTemplate::New(isolate, GetStackPointer));
LocalContext env(NULL, global_template); LocalContext env(NULL, global_template);
CompileRun( CompileRun(
......
...@@ -107,13 +107,13 @@ v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate( ...@@ -107,13 +107,13 @@ v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
v8::FunctionCallback doloop) { v8::FunctionCallback doloop) {
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set(v8::String::NewFromUtf8(isolate, "terminate"), global->Set(v8::String::NewFromUtf8(isolate, "terminate"),
v8::FunctionTemplate::New(terminate)); v8::FunctionTemplate::New(isolate, terminate));
global->Set(v8::String::NewFromUtf8(isolate, "fail"), global->Set(v8::String::NewFromUtf8(isolate, "fail"),
v8::FunctionTemplate::New(Fail)); v8::FunctionTemplate::New(isolate, Fail));
global->Set(v8::String::NewFromUtf8(isolate, "loop"), global->Set(v8::String::NewFromUtf8(isolate, "loop"),
v8::FunctionTemplate::New(Loop)); v8::FunctionTemplate::New(isolate, Loop));
global->Set(v8::String::NewFromUtf8(isolate, "doloop"), global->Set(v8::String::NewFromUtf8(isolate, "doloop"),
v8::FunctionTemplate::New(doloop)); v8::FunctionTemplate::New(isolate, doloop));
return global; return global;
} }
...@@ -242,27 +242,28 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -242,27 +242,28 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Test that we correctly handle termination exceptions if they are // Test that we correctly handle termination exceptions if they are
// triggered by the creation of error objects in connection with ICs. // triggered by the creation of error objects in connection with ICs.
TEST(TerminateLoadICException) { TEST(TerminateLoadICException) {
v8::HandleScope scope(CcTest::isolate()); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set( global->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "terminate_or_return_object"), v8::String::NewFromUtf8(isolate, "terminate_or_return_object"),
v8::FunctionTemplate::New(TerminateOrReturnObject)); v8::FunctionTemplate::New(isolate, TerminateOrReturnObject));
global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "fail"), global->Set(v8::String::NewFromUtf8(isolate, "fail"),
v8::FunctionTemplate::New(Fail)); v8::FunctionTemplate::New(isolate, Fail));
global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "loop"), global->Set(v8::String::NewFromUtf8(isolate, "loop"),
v8::FunctionTemplate::New(LoopGetProperty)); v8::FunctionTemplate::New(isolate, LoopGetProperty));
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global); v8::Context::New(isolate, NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); CHECK(!v8::V8::IsExecutionTerminating(isolate));
// Run a loop that will be infinite if thread termination does not work. // Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source = v8::String::NewFromUtf8( v8::Handle<v8::String> source = v8::String::NewFromUtf8(
CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }"); isolate, "try { loop(); fail(); } catch(e) { fail(); }");
call_count = 0; call_count = 0;
v8::Script::Compile(source)->Run(); v8::Script::Compile(source)->Run();
// Test that we can run the code again after thread termination. // Test that we can run the code again after thread termination.
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); CHECK(!v8::V8::IsExecutionTerminating(isolate));
call_count = 0; call_count = 0;
v8::Script::Compile(source)->Run(); v8::Script::Compile(source)->Run();
} }
...@@ -299,20 +300,21 @@ void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -299,20 +300,21 @@ void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Test that reentry into V8 while the termination exception is still pending // Test that reentry into V8 while the termination exception is still pending
// (has not yet unwound the 0-level JS frame) does not crash. // (has not yet unwound the 0-level JS frame) does not crash.
TEST(TerminateAndReenterFromThreadItself) { TEST(TerminateAndReenterFromThreadItself) {
v8::HandleScope scope(CcTest::isolate()); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate( v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
CcTest::isolate(), TerminateCurrentThread, ReenterAfterTermination); isolate, TerminateCurrentThread, ReenterAfterTermination);
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global); v8::Context::New(isolate, NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Handle<v8::String> source = v8::String::NewFromUtf8( v8::Handle<v8::String> source = v8::String::NewFromUtf8(
CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }"); isolate, "try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run(); v8::Script::Compile(source)->Run();
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); CHECK(!v8::V8::IsExecutionTerminating(isolate));
// Check we can run JS again after termination. // Check we can run JS again after termination.
CHECK(v8::Script::Compile( CHECK(v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), v8::String::NewFromUtf8(isolate,
"function f() { return true; }" "function f() { return true; }"
"f()")) "f()"))
->Run() ->Run()
......
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