Reland r18383: More API cleanup.

* Removed String::Empty, Number::New, Integer::New, Integer::NewFromUnsigned, FunctionTemplate::New and Object::New without Isolate* parameter.

* Removed Integer::New and Integer::NewUnsigned with weird argument order.

Chrome CLs matching this change have been landed.

TBR=dcarney@chromium.org
LOG=y
BUG=324225

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18449 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e3fa6d67
...@@ -1668,7 +1668,6 @@ class V8_EXPORT String : public Primitive { ...@@ -1668,7 +1668,6 @@ class V8_EXPORT String : public Primitive {
/** /**
* A zero length string. * A zero length string.
*/ */
static v8::Local<v8::String> Empty();
V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate); V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
/** /**
...@@ -1963,8 +1962,6 @@ class V8_EXPORT Number : public Primitive { ...@@ -1963,8 +1962,6 @@ class V8_EXPORT Number : public Primitive {
public: public:
double Value() const; double Value() const;
static Local<Number> New(Isolate* isolate, double value); static Local<Number> New(Isolate* isolate, double value);
// Will be deprecated soon.
static Local<Number> New(double value);
V8_INLINE static Number* Cast(v8::Value* obj); V8_INLINE static Number* Cast(v8::Value* obj);
private: private:
Number(); Number();
...@@ -1979,11 +1976,6 @@ class V8_EXPORT Integer : public Number { ...@@ -1979,11 +1976,6 @@ class V8_EXPORT Integer : public Number {
public: public:
static Local<Integer> New(Isolate* isolate, int32_t value); static Local<Integer> New(Isolate* isolate, int32_t value);
static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value); static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
// Will be deprecated soon.
static Local<Integer> New(int32_t value, Isolate*);
static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
static Local<Integer> New(int32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value);
int64_t Value() const; int64_t Value() const;
V8_INLINE static Integer* Cast(v8::Value* obj); V8_INLINE static Integer* Cast(v8::Value* obj);
private: private:
...@@ -2337,8 +2329,7 @@ class V8_EXPORT Object : public Value { ...@@ -2337,8 +2329,7 @@ class V8_EXPORT Object : public Value {
Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
static Local<Object> New(Isolate* isolate); static Local<Object> New(Isolate* isolate);
// Will be deprecated soon.
static Local<Object> New();
V8_INLINE static Object* Cast(Value* obj); V8_INLINE static Object* Cast(Value* obj);
private: private:
...@@ -3353,12 +3344,6 @@ class V8_EXPORT FunctionTemplate : public Template { ...@@ -3353,12 +3344,6 @@ class V8_EXPORT FunctionTemplate : public Template {
Handle<Value> data = Handle<Value>(), Handle<Value> data = Handle<Value>(),
Handle<Signature> signature = Handle<Signature>(), Handle<Signature> signature = Handle<Signature>(),
int length = 0); int length = 0);
// Will be deprecated soon.
static Local<FunctionTemplate> New(
FunctionCallback callback = 0,
Handle<Value> data = Handle<Value>(),
Handle<Signature> signature = Handle<Signature>(),
int length = 0);
/** Returns the unique function instance in the current execution context.*/ /** Returns the unique function instance in the current execution context.*/
Local<Function> GetFunction(); Local<Function> GetFunction();
...@@ -5798,7 +5783,7 @@ void ReturnValue<T>::Set(int32_t i) { ...@@ -5798,7 +5783,7 @@ void ReturnValue<T>::Set(int32_t i) {
*value_ = I::IntToSmi(i); *value_ = I::IntToSmi(i);
return; return;
} }
Set(Integer::New(i, GetIsolate())); Set(Integer::New(GetIsolate(), i));
} }
template<typename T> template<typename T>
...@@ -5810,7 +5795,7 @@ void ReturnValue<T>::Set(uint32_t i) { ...@@ -5810,7 +5795,7 @@ void ReturnValue<T>::Set(uint32_t i) {
Set(static_cast<int32_t>(i)); Set(static_cast<int32_t>(i));
return; return;
} }
Set(Integer::NewFromUnsigned(i, GetIsolate())); Set(Integer::NewFromUnsigned(GetIsolate(), i));
} }
template<typename T> template<typename T>
......
...@@ -885,7 +885,7 @@ static void TemplateSet(i::Isolate* isolate, ...@@ -885,7 +885,7 @@ static void TemplateSet(i::Isolate* isolate,
Utils::OpenHandle(templ)->set_property_list(*list); Utils::OpenHandle(templ)->set_property_list(*list);
} }
NeanderArray array(list); NeanderArray array(list);
array.add(Utils::OpenHandle(*v8::Integer::New(length))); array.add(isolate->factory()->NewNumberFromInt(length));
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
i::Handle<i::Object> value = data[i].IsEmpty() ? i::Handle<i::Object> value = data[i].IsEmpty() ?
i::Handle<i::Object>(isolate->factory()->undefined_value()) : i::Handle<i::Object>(isolate->factory()->undefined_value()) :
...@@ -902,10 +902,11 @@ void Template::Set(v8::Handle<String> name, ...@@ -902,10 +902,11 @@ void Template::Set(v8::Handle<String> name,
ENTER_V8(isolate); ENTER_V8(isolate);
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
const int kSize = 3; const int kSize = 3;
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = { v8::Handle<v8::Data> data[kSize] = {
name, name,
value, value,
v8::Integer::New(attribute)}; v8::Integer::New(v8_isolate, attribute)};
TemplateSet(isolate, this, kSize, data); TemplateSet(isolate, this, kSize, data);
} }
...@@ -922,12 +923,13 @@ void Template::SetAccessorProperty( ...@@ -922,12 +923,13 @@ void Template::SetAccessorProperty(
ASSERT(!getter.IsEmpty() || !setter.IsEmpty()); ASSERT(!getter.IsEmpty() || !setter.IsEmpty());
i::HandleScope scope(isolate); i::HandleScope scope(isolate);
const int kSize = 5; const int kSize = 5;
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = { v8::Handle<v8::Data> data[kSize] = {
name, name,
getter, getter,
setter, setter,
v8::Integer::New(attribute), v8::Integer::New(v8_isolate, attribute),
v8::Integer::New(access_control)}; v8::Integer::New(v8_isolate, access_control)};
TemplateSet(isolate, this, kSize, data); TemplateSet(isolate, this, kSize, data);
} }
...@@ -1008,14 +1010,6 @@ Local<FunctionTemplate> FunctionTemplate::New( ...@@ -1008,14 +1010,6 @@ Local<FunctionTemplate> FunctionTemplate::New(
} }
Local<FunctionTemplate> FunctionTemplate::New(
FunctionCallback callback,
v8::Handle<Value> data,
v8::Handle<Signature> signature,
int length) {
return New(Isolate::GetCurrent(), callback, data, signature, length);
}
Local<Signature> Signature::New(Isolate* isolate, Local<Signature> Signature::New(Isolate* isolate,
Handle<FunctionTemplate> receiver, int argc, Handle<FunctionTemplate> receiver, int argc,
Handle<FunctionTemplate> argv[]) { Handle<FunctionTemplate> argv[]) {
...@@ -4116,10 +4110,11 @@ ScriptOrigin Function::GetScriptOrigin() const { ...@@ -4116,10 +4110,11 @@ ScriptOrigin Function::GetScriptOrigin() const {
if (func->shared()->script()->IsScript()) { if (func->shared()->script()->IsScript()) {
i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script);
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate());
v8::ScriptOrigin origin( v8::ScriptOrigin origin(
Utils::ToLocal(scriptName), Utils::ToLocal(scriptName),
v8::Integer::New(script->line_offset()->value()), v8::Integer::New(isolate, script->line_offset()->value()),
v8::Integer::New(script->column_offset()->value())); v8::Integer::New(isolate, script->column_offset()->value()));
return origin; return origin;
} }
return v8::ScriptOrigin(Handle<Value>()); return v8::ScriptOrigin(Handle<Value>());
...@@ -5350,16 +5345,6 @@ void* External::Value() const { ...@@ -5350,16 +5345,6 @@ void* External::Value() const {
} }
Local<String> v8::String::Empty() {
i::Isolate* isolate = i::Isolate::Current();
if (!EnsureInitializedForIsolate(isolate, "v8::String::Empty()")) {
return v8::Local<String>();
}
LOG_API(isolate, "String::Empty()");
return Utils::ToLocal(isolate->factory()->empty_string());
}
// anonymous namespace for string creation helper functions // anonymous namespace for string creation helper functions
namespace { namespace {
...@@ -5422,7 +5407,7 @@ inline Local<String> NewString(Isolate* v8_isolate, ...@@ -5422,7 +5407,7 @@ inline Local<String> NewString(Isolate* v8_isolate,
EnsureInitializedForIsolate(isolate, location); EnsureInitializedForIsolate(isolate, location);
LOG_API(isolate, env); LOG_API(isolate, env);
if (length == 0 && type != String::kUndetectableString) { if (length == 0 && type != String::kUndetectableString) {
return String::Empty(); return String::Empty(v8_isolate);
} }
ENTER_V8(isolate); ENTER_V8(isolate);
if (length == -1) length = StringLength(data); if (length == -1) length = StringLength(data);
...@@ -5653,11 +5638,6 @@ Local<v8::Object> v8::Object::New(Isolate* isolate) { ...@@ -5653,11 +5638,6 @@ Local<v8::Object> v8::Object::New(Isolate* isolate) {
} }
Local<v8::Object> v8::Object::New() {
return New(Isolate::GetCurrent());
}
Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) { Local<v8::Value> v8::NumberObject::New(Isolate* isolate, double value) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()"); EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()");
...@@ -6143,13 +6123,6 @@ Local<Private> v8::Private::New( ...@@ -6143,13 +6123,6 @@ Local<Private> v8::Private::New(
} }
Local<Number> v8::Number::New(double value) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Number::New()");
return Number::New(reinterpret_cast<Isolate*>(isolate), value);
}
Local<Number> v8::Number::New(Isolate* isolate, double value) { Local<Number> v8::Number::New(Isolate* isolate, double value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized()); ASSERT(internal_isolate->IsInitialized());
...@@ -6163,30 +6136,6 @@ Local<Number> v8::Number::New(Isolate* isolate, double value) { ...@@ -6163,30 +6136,6 @@ Local<Number> v8::Number::New(Isolate* isolate, double value) {
} }
Local<Integer> v8::Integer::New(int32_t value) {
i::Isolate* isolate = i::Isolate::UncheckedCurrent();
EnsureInitializedForIsolate(isolate, "v8::Integer::New()");
return v8::Integer::New(reinterpret_cast<Isolate*>(isolate), value);
}
Local<Integer> Integer::NewFromUnsigned(uint32_t value) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Integer::NewFromUnsigned()");
return Integer::NewFromUnsigned(reinterpret_cast<Isolate*>(isolate), value);
}
Local<Integer> v8::Integer::New(int32_t value, Isolate* isolate) {
return Integer::New(isolate, value);
}
Local<Integer> v8::Integer::NewFromUnsigned(uint32_t value, Isolate* isolate) {
return Integer::NewFromUnsigned(isolate, value);
}
Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized()); ASSERT(internal_isolate->IsInitialized());
...@@ -6205,7 +6154,7 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) { ...@@ -6205,7 +6154,7 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
ASSERT(internal_isolate->IsInitialized()); ASSERT(internal_isolate->IsInitialized());
bool fits_into_int32_t = (value & (1 << 31)) == 0; bool fits_into_int32_t = (value & (1 << 31)) == 0;
if (fits_into_int32_t) { if (fits_into_int32_t) {
return Integer::New(static_cast<int32_t>(value), isolate); return Integer::New(isolate, static_cast<int32_t>(value));
} }
ENTER_V8(internal_isolate); ENTER_V8(internal_isolate);
i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
......
...@@ -202,7 +202,7 @@ class ExecArgs { ...@@ -202,7 +202,7 @@ class ExecArgs {
exec_args_[0] = c_arg; exec_args_[0] = c_arg;
int i = 1; int i = 1;
for (unsigned j = 0; j < command_args->Length(); i++, j++) { for (unsigned j = 0; j < command_args->Length(); i++, j++) {
Handle<Value> arg(command_args->Get(Integer::New(j))); Handle<Value> arg(command_args->Get(Integer::New(isolate, j)));
String::Utf8Value utf8_arg(arg); String::Utf8Value utf8_arg(arg);
if (*utf8_arg == NULL) { if (*utf8_arg == NULL) {
exec_args_[i] = NULL; // Consistent state for destructor. exec_args_[i] = NULL; // Consistent state for destructor.
...@@ -314,7 +314,7 @@ static Handle<Value> GetStdout(Isolate* isolate, ...@@ -314,7 +314,7 @@ static Handle<Value> GetStdout(Isolate* isolate,
struct timeval& start_time, struct timeval& start_time,
int read_timeout, int read_timeout,
int total_timeout) { int total_timeout) {
Handle<String> accumulator = String::Empty(); Handle<String> accumulator = String::Empty(isolate);
int fullness = 0; int fullness = 0;
static const int kStdoutReadBufferSize = 4096; static const int kStdoutReadBufferSize = 4096;
......
...@@ -48,7 +48,7 @@ static void AddCounter(v8::Isolate* isolate, ...@@ -48,7 +48,7 @@ static void AddCounter(v8::Isolate* isolate,
const char* name) { const char* name) {
if (counter->Enabled()) { if (counter->Enabled()) {
object->Set(v8::String::NewFromUtf8(isolate, name), object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(*counter->GetInternalPointer())); v8::Number::New(isolate, *counter->GetInternalPointer()));
} }
} }
...@@ -57,7 +57,7 @@ static void AddNumber(v8::Isolate* isolate, ...@@ -57,7 +57,7 @@ static void AddNumber(v8::Isolate* isolate,
intptr_t value, intptr_t value,
const char* name) { const char* name) {
object->Set(v8::String::NewFromUtf8(isolate, name), object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value))); v8::Number::New(isolate, static_cast<double>(value)));
} }
...@@ -66,7 +66,7 @@ static void AddNumber64(v8::Isolate* isolate, ...@@ -66,7 +66,7 @@ static void AddNumber64(v8::Isolate* isolate,
int64_t value, int64_t value,
const char* name) { const char* name) {
object->Set(v8::String::NewFromUtf8(isolate, name), object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value))); v8::Number::New(isolate, static_cast<double>(value)));
} }
...@@ -82,7 +82,7 @@ void StatisticsExtension::GetCounters( ...@@ -82,7 +82,7 @@ void StatisticsExtension::GetCounters(
} }
Counters* counters = isolate->counters(); Counters* counters = isolate->counters();
v8::Local<v8::Object> result = v8::Object::New(); v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate());
#define ADD_COUNTER(name, caption) \ #define ADD_COUNTER(name, caption) \
AddCounter(args.GetIsolate(), result, counters->name(), #name); AddCounter(args.GetIsolate(), result, counters->name(), #name);
......
...@@ -289,7 +289,7 @@ class LocalContext { ...@@ -289,7 +289,7 @@ class LocalContext {
}; };
static inline v8::Local<v8::Value> v8_num(double x) { static inline v8::Local<v8::Value> v8_num(double x) {
return v8::Number::New(x); return v8::Number::New(v8::Isolate::GetCurrent(), x);
} }
...@@ -317,8 +317,8 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source, ...@@ -317,8 +317,8 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source,
int column_number) { int column_number) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url), v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url),
v8::Integer::New(line_number), v8::Integer::New(isolate, line_number),
v8::Integer::New(column_number)); v8::Integer::New(isolate, column_number));
return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin) return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin)
->Run(); ->Run();
} }
......
...@@ -39,9 +39,11 @@ const char* ProfilerExtension::kSource = ...@@ -39,9 +39,11 @@ const char* ProfilerExtension::kSource =
v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate( v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<v8::String> name) { v8::Isolate* isolate, v8::Handle<v8::String> name) {
if (name->Equals(v8::String::NewFromUtf8(isolate, "startProfiling"))) { if (name->Equals(v8::String::NewFromUtf8(isolate, "startProfiling"))) {
return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling); return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StartProfiling);
} else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) { } else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) {
return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling); return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StopProfiling);
} else { } else {
CHECK(false); CHECK(false);
return v8::Handle<v8::FunctionTemplate>(); return v8::Handle<v8::FunctionTemplate>();
......
...@@ -201,7 +201,7 @@ THREADED_TEST(AccessorIC) { ...@@ -201,7 +201,7 @@ THREADED_TEST(AccessorIC) {
v8::FunctionTemplate::New(isolate, 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(isolate);
context->Global()->Set(v8_str("obj"), x_receiver); context->Global()->Set(v8_str("obj"), x_receiver);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun( v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun(
"obj.__proto__ = holder;" "obj.__proto__ = holder;"
...@@ -222,8 +222,8 @@ THREADED_TEST(AccessorIC) { ...@@ -222,8 +222,8 @@ THREADED_TEST(AccessorIC) {
"result")); "result"));
CHECK_EQ(40, array->Length()); CHECK_EQ(40, array->Length());
for (int i = 0; i < 40; i++) { for (int i = 0; i < 40; i++) {
v8::Handle<Value> entry = array->Get(v8::Integer::New(i)); v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i));
CHECK_EQ(v8::Integer::New(i), entry); CHECK_EQ(v8::Integer::New(isolate, i), entry);
} }
} }
...@@ -524,7 +524,7 @@ static void AllocateHandles(Local<String> name, ...@@ -524,7 +524,7 @@ static void AllocateHandles(Local<String> name,
for (int i = 0; i < i::kHandleBlockSize + 1; i++) { for (int i = 0; i < i::kHandleBlockSize + 1; i++) {
v8::Local<v8::Value>::New(info.GetIsolate(), name); v8::Local<v8::Value>::New(info.GetIsolate(), name);
} }
info.GetReturnValue().Set(v8::Integer::New(100)); info.GetReturnValue().Set(v8::Integer::New(info.GetIsolate(), 100));
} }
......
This diff is collapsed.
...@@ -522,7 +522,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -522,7 +522,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
F0 f = FUNCTION_CAST<F0>(Code::cast(code)->entry()); F0 f = FUNCTION_CAST<F0>(Code::cast(code)->entry());
int res = f(); int res = f();
args.GetReturnValue().Set(v8::Integer::New(res)); args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res));
} }
......
...@@ -604,7 +604,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -604,7 +604,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
F0 f = FUNCTION_CAST<F0>(code->entry()); F0 f = FUNCTION_CAST<F0>(code->entry());
int res = f(); int res = f();
args.GetReturnValue().Set(v8::Integer::New(res)); args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res));
} }
......
...@@ -369,7 +369,7 @@ TEST(OptimizedCodeSharing) { ...@@ -369,7 +369,7 @@ TEST(OptimizedCodeSharing) {
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
LocalContext env; LocalContext env;
env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"), env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"),
v8::Integer::New(i)); v8::Integer::New(CcTest::isolate(), i));
CompileRun("function MakeClosure() {" CompileRun("function MakeClosure() {"
" return function() { return x; };" " return function() { return x; };"
"}" "}"
......
...@@ -550,7 +550,9 @@ TEST(CollectCpuProfile) { ...@@ -550,7 +550,9 @@ TEST(CollectCpuProfile) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t profiling_interval_ms = 200; int32_t profiling_interval_ms = 200;
v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), profiling_interval_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200); RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
function->Call(env->Global(), ARRAY_SIZE(args), args); function->Call(env->Global(), ARRAY_SIZE(args), args);
...@@ -622,7 +624,9 @@ TEST(SampleWhenFrameIsNotSetup) { ...@@ -622,7 +624,9 @@ TEST(SampleWhenFrameIsNotSetup) {
// Simulators are much slower. // Simulators are much slower.
repeat_count = 1; repeat_count = 1;
#endif #endif
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), repeat_count)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -742,7 +746,7 @@ TEST(NativeAccessorUninitializedIC) { ...@@ -742,7 +746,7 @@ TEST(NativeAccessorUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
int32_t repeat_count = 1; int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 180); RunProfiler(env, function, args, ARRAY_SIZE(args), 180);
...@@ -791,13 +795,15 @@ TEST(NativeAccessorMonomorphicIC) { ...@@ -791,13 +795,15 @@ TEST(NativeAccessorMonomorphicIC) {
// profiling. // profiling.
accessors.set_warming_up(true); accessors.set_warming_up(true);
int32_t warm_up_iterations = 3; int32_t warm_up_iterations = 3;
v8::Handle<v8::Value> args[] = { v8::Integer::New(warm_up_iterations) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(isolate, warm_up_iterations)
};
function->Call(env->Global(), ARRAY_SIZE(args), args); function->Call(env->Global(), ARRAY_SIZE(args), args);
accessors.set_warming_up(false); accessors.set_warming_up(false);
} }
int32_t repeat_count = 100; int32_t repeat_count = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200); RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
...@@ -851,7 +857,7 @@ TEST(NativeMethodUninitializedIC) { ...@@ -851,7 +857,7 @@ TEST(NativeMethodUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start"))); env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
int32_t repeat_count = 1; int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -900,13 +906,15 @@ TEST(NativeMethodMonomorphicIC) { ...@@ -900,13 +906,15 @@ TEST(NativeMethodMonomorphicIC) {
// profiling. // profiling.
callbacks.set_warming_up(true); callbacks.set_warming_up(true);
int32_t warm_up_iterations = 3; int32_t warm_up_iterations = 3;
v8::Handle<v8::Value> args[] = { v8::Integer::New(warm_up_iterations) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(isolate, warm_up_iterations)
};
function->Call(env->Global(), ARRAY_SIZE(args), args); function->Call(env->Global(), ARRAY_SIZE(args), args);
callbacks.set_warming_up(false); callbacks.set_warming_up(false);
} }
int32_t repeat_count = 100; int32_t repeat_count = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -945,7 +953,9 @@ TEST(BoundFunctionCall) { ...@@ -945,7 +953,9 @@ TEST(BoundFunctionCall) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100; int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -1004,7 +1014,9 @@ TEST(FunctionCallSample) { ...@@ -1004,7 +1014,9 @@ TEST(FunctionCallSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100; int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -1084,7 +1096,9 @@ TEST(FunctionApplySample) { ...@@ -1084,7 +1096,9 @@ TEST(FunctionApplySample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100; int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100); RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
...@@ -1191,7 +1205,9 @@ TEST(JsNativeJsSample) { ...@@ -1191,7 +1205,9 @@ TEST(JsNativeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20; int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10); RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
...@@ -1275,7 +1291,9 @@ TEST(JsNativeJsRuntimeJsSample) { ...@@ -1275,7 +1291,9 @@ TEST(JsNativeJsRuntimeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20; int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10); RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
...@@ -1368,7 +1386,9 @@ TEST(JsNative1JsNative2JsSample) { ...@@ -1368,7 +1386,9 @@ TEST(JsNative1JsNative2JsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20; int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
const v8::CpuProfile* profile = const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10); RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
......
This diff is collapsed.
...@@ -147,17 +147,17 @@ static void VerifyRead(v8::Handle<v8::DeclaredAccessorDescriptor> descriptor, ...@@ -147,17 +147,17 @@ static void VerifyRead(v8::Handle<v8::DeclaredAccessorDescriptor> descriptor,
static v8::Handle<v8::Value> Convert(int32_t value, v8::Isolate* isolate) { static v8::Handle<v8::Value> Convert(int32_t value, v8::Isolate* isolate) {
return v8::Integer::New(value, isolate); return v8::Integer::New(isolate, value);
} }
static v8::Handle<v8::Value> Convert(float value, v8::Isolate*) { static v8::Handle<v8::Value> Convert(float value, v8::Isolate* isolate) {
return v8::Number::New(value); return v8::Number::New(isolate, value);
} }
static v8::Handle<v8::Value> Convert(double value, v8::Isolate*) { static v8::Handle<v8::Value> Convert(double value, v8::Isolate* isolate) {
return v8::Number::New(value); return v8::Number::New(isolate, value);
} }
...@@ -277,10 +277,12 @@ TEST(PointerDereferenceRead) { ...@@ -277,10 +277,12 @@ TEST(PointerDereferenceRead) {
AlignedArray* array = helper.array_.get(); AlignedArray* array = helper.array_.get();
array->As<uintptr_t**>()[first_index] = array->As<uintptr_t**>()[first_index] =
&array->As<uintptr_t*>()[pointed_to_index]; &array->As<uintptr_t*>()[pointed_to_index];
VerifyRead(descriptor, internal_field, array, v8::Integer::New(0)); VerifyRead(descriptor, internal_field, array,
v8::Integer::New(helper.isolate_, 0));
second_index += pointed_to_index*sizeof(uintptr_t)/sizeof(uint16_t); second_index += pointed_to_index*sizeof(uintptr_t)/sizeof(uint16_t);
array->As<uint16_t*>()[second_index] = expected; array->As<uint16_t*>()[second_index] = expected;
VerifyRead(descriptor, internal_field, array, v8::Integer::New(expected)); VerifyRead(descriptor, internal_field, array,
v8::Integer::New(helper.isolate_, expected));
} }
......
...@@ -96,6 +96,8 @@ class DeclarationContext { ...@@ -96,6 +96,8 @@ class DeclarationContext {
static void HandleQuery(Local<String> key, static void HandleQuery(Local<String> key,
const v8::PropertyCallbackInfo<v8::Integer>& info); const v8::PropertyCallbackInfo<v8::Integer>& info);
v8::Isolate* isolate() const { return CcTest::isolate(); }
private: private:
bool is_initialized_; bool is_initialized_;
Persistent<Context> context_; Persistent<Context> context_;
...@@ -244,7 +246,7 @@ TEST(Unknown) { ...@@ -244,7 +246,7 @@ TEST(Unknown) {
1, // access 1, // access
2, // declaration + initialization 2, // declaration + initialization
2, // declaration + initialization 2, // declaration + initialization
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
{ DeclarationContext context; { DeclarationContext context;
...@@ -278,7 +280,7 @@ TEST(Unknown) { ...@@ -278,7 +280,7 @@ TEST(Unknown) {
class PresentPropertyContext: public DeclarationContext { class PresentPropertyContext: public DeclarationContext {
protected: protected:
virtual v8::Handle<Integer> Query(Local<String> key) { virtual v8::Handle<Integer> Query(Local<String> key) {
return Integer::New(v8::None); return Integer::New(isolate(), v8::None);
} }
}; };
...@@ -300,7 +302,7 @@ TEST(Present) { ...@@ -300,7 +302,7 @@ TEST(Present) {
1, // access 1, // access
1, // initialization 1, // initialization
2, // declaration + initialization 2, // declaration + initialization
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
{ PresentPropertyContext context; { PresentPropertyContext context;
...@@ -324,7 +326,7 @@ TEST(Present) { ...@@ -324,7 +326,7 @@ TEST(Present) {
1, // access 1, // access
1, // initialization 1, // initialization
1, // (re-)declaration 1, // (re-)declaration
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
} }
...@@ -356,7 +358,7 @@ TEST(Absent) { ...@@ -356,7 +358,7 @@ TEST(Absent) {
1, // access 1, // access
2, // declaration + initialization 2, // declaration + initialization
2, // declaration + initialization 2, // declaration + initialization
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(isolate, 0));
} }
{ AbsentPropertyContext context; { AbsentPropertyContext context;
...@@ -416,7 +418,7 @@ class AppearingPropertyContext: public DeclarationContext { ...@@ -416,7 +418,7 @@ class AppearingPropertyContext: public DeclarationContext {
// 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.
state_ = UNKNOWN; state_ = UNKNOWN;
return Integer::New(v8::None); return Integer::New(isolate(), v8::None);
default: default:
CHECK(state_ == UNKNOWN); CHECK(state_ == UNKNOWN);
break; break;
...@@ -447,7 +449,7 @@ TEST(Appearing) { ...@@ -447,7 +449,7 @@ TEST(Appearing) {
1, // access 1, // access
2, // declaration + initialization 2, // declaration + initialization
2, // declaration + initialization 2, // declaration + initialization
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
{ AppearingPropertyContext context; { AppearingPropertyContext context;
...@@ -502,7 +504,7 @@ class ReappearingPropertyContext: public DeclarationContext { ...@@ -502,7 +504,7 @@ class ReappearingPropertyContext: public DeclarationContext {
// Ignore the second declaration by returning // Ignore the second declaration by returning
// that the property is already there. // that the property is already there.
state_ = INITIALIZE; state_ = INITIALIZE;
return Integer::New(v8::None); return Integer::New(isolate(), v8::None);
case INITIALIZE: case INITIALIZE:
// Force an initialization by returning that // Force an initialization by returning that
// the property is absent. This will make sure // the property is absent. This will make sure
...@@ -539,10 +541,12 @@ TEST(Reappearing) { ...@@ -539,10 +541,12 @@ TEST(Reappearing) {
class ExistsInPrototypeContext: public DeclarationContext { class ExistsInPrototypeContext: public DeclarationContext {
public:
ExistsInPrototypeContext() { InitializeIfNeeded(); }
protected: protected:
virtual v8::Handle<Integer> Query(Local<String> key) { virtual v8::Handle<Integer> Query(Local<String> 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(v8::None); return Integer::New(isolate(), v8::None);
} }
// Use the prototype as the holder for the interceptors. // Use the prototype as the holder for the interceptors.
...@@ -563,7 +567,7 @@ TEST(ExistsInPrototype) { ...@@ -563,7 +567,7 @@ TEST(ExistsInPrototype) {
0, 0,
0, 0,
0, 0,
EXPECT_RESULT, Number::New(87)); EXPECT_RESULT, Number::New(CcTest::isolate(), 87));
} }
{ ExistsInPrototypeContext context; { ExistsInPrototypeContext context;
...@@ -579,7 +583,7 @@ TEST(ExistsInPrototype) { ...@@ -579,7 +583,7 @@ TEST(ExistsInPrototype) {
0, 0,
0, 0,
0, 0,
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
{ ExistsInPrototypeContext context; { ExistsInPrototypeContext context;
...@@ -595,7 +599,7 @@ TEST(ExistsInPrototype) { ...@@ -595,7 +599,7 @@ TEST(ExistsInPrototype) {
0, 0,
0, 0,
0, 0,
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
} }
...@@ -641,7 +645,7 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext { ...@@ -641,7 +645,7 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext {
protected: protected:
virtual v8::Handle<Integer> Query(Local<String> key) { virtual v8::Handle<Integer> Query(Local<String> 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(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.
...@@ -680,7 +684,7 @@ TEST(ExistsInHiddenPrototype) { ...@@ -680,7 +684,7 @@ TEST(ExistsInHiddenPrototype) {
1, // access 1, // access
1, // initialization 1, // initialization
2, // declaration + initialization 2, // declaration + initialization
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
{ ExistsInHiddenPrototypeContext context; { ExistsInHiddenPrototypeContext context;
...@@ -706,7 +710,7 @@ TEST(ExistsInHiddenPrototype) { ...@@ -706,7 +710,7 @@ TEST(ExistsInHiddenPrototype) {
0, 0,
0, 0,
1, // (re-)declaration 1, // (re-)declaration
EXPECT_RESULT, Number::New(0)); EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
} }
} }
...@@ -759,40 +763,41 @@ class SimpleContext { ...@@ -759,40 +763,41 @@ class SimpleContext {
TEST(CrossScriptReferences) { TEST(CrossScriptReferences) {
HandleScope scope(CcTest::isolate()); v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
{ SimpleContext context; { SimpleContext context;
context.Check("var x = 1; x", context.Check("var x = 1; x",
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("var x = 2; x", context.Check("var x = 2; x",
EXPECT_RESULT, Number::New(2)); EXPECT_RESULT, Number::New(isolate, 2));
context.Check("const x = 3; x", context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(3)); EXPECT_RESULT, Number::New(isolate, 3));
context.Check("const x = 4; x", context.Check("const x = 4; x",
EXPECT_RESULT, Number::New(4)); EXPECT_RESULT, Number::New(isolate, 4));
context.Check("x = 5; x", context.Check("x = 5; x",
EXPECT_RESULT, Number::New(5)); EXPECT_RESULT, Number::New(isolate, 5));
context.Check("var x = 6; x", context.Check("var x = 6; x",
EXPECT_RESULT, Number::New(6)); EXPECT_RESULT, Number::New(isolate, 6));
context.Check("this.x", context.Check("this.x",
EXPECT_RESULT, Number::New(6)); EXPECT_RESULT, Number::New(isolate, 6));
context.Check("function x() { return 7 }; x()", context.Check("function x() { return 7 }; x()",
EXPECT_RESULT, Number::New(7)); EXPECT_RESULT, Number::New(isolate, 7));
} }
{ SimpleContext context; { SimpleContext context;
context.Check("const x = 1; x", context.Check("const x = 1; x",
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("var x = 2; x", // assignment ignored context.Check("var x = 2; x", // assignment ignored
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("const x = 3; x", context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("x = 4; x", // assignment ignored context.Check("x = 4; x", // assignment ignored
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("var x = 5; x", // assignment ignored context.Check("var x = 5; x", // assignment ignored
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("this.x", context.Check("this.x",
EXPECT_RESULT, Number::New(1)); EXPECT_RESULT, Number::New(isolate, 1));
context.Check("function x() { return 7 }; x", context.Check("function x() { return 7 }; x",
EXPECT_EXCEPTION); EXPECT_EXCEPTION);
} }
...@@ -804,7 +809,8 @@ TEST(CrossScriptReferencesHarmony) { ...@@ -804,7 +809,8 @@ TEST(CrossScriptReferencesHarmony) {
i::FLAG_harmony_scoping = true; i::FLAG_harmony_scoping = true;
i::FLAG_harmony_modules = true; i::FLAG_harmony_modules = true;
HandleScope scope(CcTest::isolate()); v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
const char* decs[] = { const char* decs[] = {
"var x = 1; x", "x", "this.x", "var x = 1; x", "x", "this.x",
...@@ -817,12 +823,14 @@ TEST(CrossScriptReferencesHarmony) { ...@@ -817,12 +823,14 @@ TEST(CrossScriptReferencesHarmony) {
for (int i = 0; decs[i] != NULL; i += 3) { for (int i = 0; decs[i] != NULL; i += 3) {
SimpleContext context; SimpleContext context;
context.Check(decs[i], EXPECT_RESULT, Number::New(1)); context.Check(decs[i], EXPECT_RESULT, Number::New(isolate, 1));
context.Check(decs[i+1], EXPECT_RESULT, Number::New(1)); context.Check(decs[i+1], EXPECT_RESULT, Number::New(isolate, 1));
// TODO(rossberg): The current ES6 draft spec does not reflect lexical // TODO(rossberg): The current ES6 draft spec does not reflect lexical
// bindings on the global object. However, this will probably change, in // bindings on the global object. However, this will probably change, in
// which case we reactivate the following test. // which case we reactivate the following test.
if (i/3 < 2) context.Check(decs[i+2], EXPECT_RESULT, Number::New(1)); if (i/3 < 2) {
context.Check(decs[i+2], EXPECT_RESULT, Number::New(isolate, 1));
}
} }
} }
...@@ -854,12 +862,14 @@ TEST(CrossScriptConflicts) { ...@@ -854,12 +862,14 @@ TEST(CrossScriptConflicts) {
for (int i = 0; firsts[i] != NULL; ++i) { for (int i = 0; firsts[i] != NULL; ++i) {
for (int j = 0; seconds[j] != NULL; ++j) { for (int j = 0; seconds[j] != NULL; ++j) {
SimpleContext context; SimpleContext context;
context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); context.Check(firsts[i], EXPECT_RESULT,
Number::New(CcTest::isolate(), 1));
// TODO(rossberg): All tests should actually be errors in Harmony, // TODO(rossberg): All tests should actually be errors in Harmony,
// but we currently do not detect the cases where the first declaration // but we currently do not detect the cases where the first declaration
// is not lexical. // is not lexical.
context.Check(seconds[j], context.Check(seconds[j],
i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); i < 2 ? EXPECT_RESULT : EXPECT_ERROR,
Number::New(CcTest::isolate(), 2));
} }
} }
} }
...@@ -334,8 +334,8 @@ TEST(EternalHandles) { ...@@ -334,8 +334,8 @@ TEST(EternalHandles) {
for (int i = 0; i < kArrayLength; i++) { for (int i = 0; i < kArrayLength; i++) {
indices[i] = -1; indices[i] = -1;
HandleScope scope(isolate); HandleScope scope(isolate);
v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
object->Set(i, v8::Integer::New(i, v8_isolate)); object->Set(i, v8::Integer::New(v8_isolate, i));
// Create with internal api // Create with internal api
eternal_handles->Create( eternal_handles->Create(
isolate, *v8::Utils::OpenHandle(*object), &indices[i]); isolate, *v8::Utils::OpenHandle(*object), &indices[i]);
...@@ -370,7 +370,7 @@ TEST(EternalHandles) { ...@@ -370,7 +370,7 @@ TEST(EternalHandles) {
// Create an eternal via the constructor // Create an eternal via the constructor
{ {
HandleScope scope(isolate); HandleScope scope(isolate);
v8::Local<v8::Object> object = v8::Object::New(); v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
v8::Eternal<v8::Object> eternal(v8_isolate, object); v8::Eternal<v8::Object> eternal(v8_isolate, object);
CHECK(!eternal.IsEmpty()); CHECK(!eternal.IsEmpty());
CHECK(object == eternal.Get(v8_isolate)); CHECK(object == eternal.Get(v8_isolate));
......
...@@ -39,7 +39,7 @@ TEST(StrictUndeclaredGlobalVariable) { ...@@ -39,7 +39,7 @@ TEST(StrictUndeclaredGlobalVariable) {
LocalContext context; LocalContext context;
v8::TryCatch try_catch; v8::TryCatch try_catch;
v8::Local<v8::Script> script = v8_compile("\"use strict\"; x = 42;"); v8::Local<v8::Script> script = v8_compile("\"use strict\"; x = 42;");
v8::Handle<v8::Object> proto = v8::Object::New(); v8::Handle<v8::Object> proto = v8::Object::New(CcTest::isolate());
v8::Handle<v8::Object> global = v8::Handle<v8::Object> global =
context->Global()->GetPrototype().As<v8::Object>(); context->Global()->GetPrototype().As<v8::Object>();
proto->Set(var_name, v8_num(100)); proto->Set(var_name, v8_num(100));
......
...@@ -472,7 +472,7 @@ TEST(HeapSnapshotInternalReferences) { ...@@ -472,7 +472,7 @@ TEST(HeapSnapshotInternalReferences) {
v8::Handle<v8::Object> global_proxy = env->Global(); v8::Handle<v8::Object> global_proxy = env->Global();
v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
CHECK_EQ(2, global->InternalFieldCount()); CHECK_EQ(2, global->InternalFieldCount());
v8::Local<v8::Object> obj = v8::Object::New(); v8::Local<v8::Object> obj = v8::Object::New(isolate);
global->SetInternalField(0, v8_num(17)); global->SetInternalField(0, v8_num(17));
global->SetInternalField(1, obj); global->SetInternalField(1, obj);
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
...@@ -1354,7 +1354,7 @@ class GraphWithImplicitRefs { ...@@ -1354,7 +1354,7 @@ class GraphWithImplicitRefs {
instance_ = this; instance_ = this;
isolate_ = (*env)->GetIsolate(); isolate_ = (*env)->GetIsolate();
for (int i = 0; i < kObjectsCount; i++) { for (int i = 0; i < kObjectsCount; i++) {
objects_[i].Reset(isolate_, v8::Object::New()); objects_[i].Reset(isolate_, v8::Object::New(isolate_));
} }
(*env)->Global()->Set(v8_str("root_object"), (*env)->Global()->Set(v8_str("root_object"),
v8::Local<v8::Value>::New(isolate_, objects_[0])); v8::Local<v8::Value>::New(isolate_, objects_[0]));
...@@ -1821,7 +1821,8 @@ TEST(WeakGlobalHandle) { ...@@ -1821,7 +1821,8 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle()); CHECK(!HasWeakGlobalHandle());
v8::Persistent<v8::Object>* handle = v8::Persistent<v8::Object>* handle =
new v8::Persistent<v8::Object>(env->GetIsolate(), v8::Object::New()); new v8::Persistent<v8::Object>(env->GetIsolate(),
v8::Object::New(env->GetIsolate()));
handle->SetWeak(handle, PersistentHandleCallback); handle->SetWeak(handle, PersistentHandleCallback);
CHECK(HasWeakGlobalHandle()); CHECK(HasWeakGlobalHandle());
...@@ -1995,8 +1996,9 @@ TEST(ManyLocalsInSharedContext) { ...@@ -1995,8 +1996,9 @@ TEST(ManyLocalsInSharedContext) {
TEST(AllocationSitesAreVisible) { TEST(AllocationSitesAreVisible) {
LocalContext env; LocalContext env;
v8::HandleScope scope(env->GetIsolate()); v8::Isolate* isolate = env->GetIsolate();
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); v8::HandleScope scope(isolate);
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
CompileRun( CompileRun(
"fun = function () { var a = [3, 2, 1]; return a; }\n" "fun = function () { var a = [3, 2, 1]; return a; }\n"
"fun();"); "fun();");
...@@ -2039,9 +2041,12 @@ TEST(AllocationSitesAreVisible) { ...@@ -2039,9 +2041,12 @@ TEST(AllocationSitesAreVisible) {
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val); v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val);
// Verify the array is "a" in the code above. // Verify the array is "a" in the code above.
CHECK_EQ(3, array->Length()); CHECK_EQ(3, array->Length());
CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0))); CHECK_EQ(v8::Integer::New(isolate, 3),
CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1))); array->Get(v8::Integer::New(isolate, 0)));
CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2))); CHECK_EQ(v8::Integer::New(isolate, 2),
array->Get(v8::Integer::New(isolate, 1)));
CHECK_EQ(v8::Integer::New(isolate, 1),
array->Get(v8::Integer::New(isolate, 2)));
} }
......
...@@ -1790,7 +1790,7 @@ TEST(LeakNativeContextViaMap) { ...@@ -1790,7 +1790,7 @@ TEST(LeakNativeContextViaMap) {
"%OptimizeFunctionOnNextCall(f);" "%OptimizeFunctionOnNextCall(f);"
"f();"); "f();");
CHECK_EQ(42, res->Int32Value()); CHECK_EQ(42, res->Int32Value());
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Global()->Set(v8_str("o"), v8::Int32::New(isolate, 0));
ctx2->Exit(); ctx2->Exit();
v8::Local<v8::Context>::New(isolate, ctx1)->Exit(); v8::Local<v8::Context>::New(isolate, ctx1)->Exit();
ctx1p.Reset(); ctx1p.Reset();
...@@ -1836,7 +1836,7 @@ TEST(LeakNativeContextViaFunction) { ...@@ -1836,7 +1836,7 @@ TEST(LeakNativeContextViaFunction) {
"%OptimizeFunctionOnNextCall(f);" "%OptimizeFunctionOnNextCall(f);"
"f(o);"); "f(o);");
CHECK_EQ(42, res->Int32Value()); CHECK_EQ(42, res->Int32Value());
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Global()->Set(v8_str("o"), v8::Int32::New(isolate, 0));
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1p.Reset(); ctx1p.Reset();
...@@ -1880,7 +1880,7 @@ TEST(LeakNativeContextViaMapKeyed) { ...@@ -1880,7 +1880,7 @@ TEST(LeakNativeContextViaMapKeyed) {
"%OptimizeFunctionOnNextCall(f);" "%OptimizeFunctionOnNextCall(f);"
"f();"); "f();");
CHECK_EQ(42, res->Int32Value()); CHECK_EQ(42, res->Int32Value());
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Global()->Set(v8_str("o"), v8::Int32::New(isolate, 0));
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1p.Reset(); ctx1p.Reset();
...@@ -1928,7 +1928,7 @@ TEST(LeakNativeContextViaMapProto) { ...@@ -1928,7 +1928,7 @@ TEST(LeakNativeContextViaMapProto) {
"%OptimizeFunctionOnNextCall(f);" "%OptimizeFunctionOnNextCall(f);"
"f();"); "f();");
CHECK_EQ(42, res->Int32Value()); CHECK_EQ(42, res->Int32Value());
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0)); ctx2->Global()->Set(v8_str("o"), v8::Int32::New(isolate, 0));
ctx2->Exit(); ctx2->Exit();
ctx1->Exit(); ctx1->Exit();
ctx1p.Reset(); ctx1p.Reset();
...@@ -2768,7 +2768,7 @@ TEST(Regress2211) { ...@@ -2768,7 +2768,7 @@ TEST(Regress2211) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
// Store identity hash first and common hidden property second. // Store identity hash first and common hidden property second.
v8::Handle<v8::Object> obj = v8::Object::New(); v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate());
Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj); Handle<JSObject> internal_obj = v8::Utils::OpenHandle(*obj);
CHECK(internal_obj->HasFastProperties()); CHECK(internal_obj->HasFastProperties());
...@@ -3337,7 +3337,7 @@ TEST(Regress169928) { ...@@ -3337,7 +3337,7 @@ TEST(Regress169928) {
v8_str("fastliteralcase(mote, 2.5);"); v8_str("fastliteralcase(mote, 2.5);");
v8::Local<v8::String> array_name = v8_str("mote"); v8::Local<v8::String> array_name = v8_str("mote");
CcTest::global()->Set(array_name, v8::Int32::New(0)); CcTest::global()->Set(array_name, v8::Int32::New(CcTest::isolate(), 0));
// First make sure we flip spaces // First make sure we flip spaces
CcTest::heap()->CollectGarbage(NEW_SPACE); CcTest::heap()->CollectGarbage(NEW_SPACE);
......
...@@ -332,27 +332,30 @@ static void ExpectRecords(v8::Isolate* isolate, ...@@ -332,27 +332,30 @@ static void ExpectRecords(v8::Isolate* isolate,
TEST(APITestBasicMutation) { TEST(APITestBasicMutation) {
HarmonyIsolate isolate; HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate()); v8::Isolate* v8_isolate = isolate.GetIsolate();
LocalContext context(isolate.GetIsolate()); HandleScope scope(v8_isolate);
LocalContext context(v8_isolate);
Handle<Object> obj = Handle<Object>::Cast(CompileRun( Handle<Object> obj = Handle<Object>::Cast(CompileRun(
"var records = [];" "var records = [];"
"var obj = {};" "var obj = {};"
"function observer(r) { [].push.apply(records, r); };" "function observer(r) { [].push.apply(records, r); };"
"Object.observe(obj, observer);" "Object.observe(obj, observer);"
"obj")); "obj"));
obj->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(7)); obj->Set(String::NewFromUtf8(v8_isolate, "foo"),
obj->Set(1, Number::New(2)); Number::New(v8_isolate, 7));
obj->Set(1, Number::New(v8_isolate, 2));
// ForceSet should work just as well as Set // ForceSet should work just as well as Set
obj->ForceSet(String::NewFromUtf8(isolate.GetIsolate(), "foo"), obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"),
Number::New(3)); Number::New(v8_isolate, 3));
obj->ForceSet(Number::New(1), Number::New(4)); obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4));
// Setting an indexed element via the property setting method // Setting an indexed element via the property setting method
obj->Set(Number::New(1), Number::New(5)); obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5));
// Setting with a non-String, non-uint32 key // Setting with a non-String, non-uint32 key
obj->Set(Number::New(1.1), Number::New(6), DontDelete); obj->Set(Number::New(v8_isolate, 1.1),
obj->Delete(String::NewFromUtf8(isolate.GetIsolate(), "foo")); Number::New(v8_isolate, 6), DontDelete);
obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
obj->Delete(1); obj->Delete(1);
obj->ForceDelete(Number::New(1.1)); obj->ForceDelete(Number::New(v8_isolate, 1.1));
// Force delivery // Force delivery
// TODO(adamk): Should the above set methods trigger delivery themselves? // TODO(adamk): Should the above set methods trigger delivery themselves?
...@@ -363,13 +366,13 @@ TEST(APITestBasicMutation) { ...@@ -363,13 +366,13 @@ TEST(APITestBasicMutation) {
{ obj, "add", "1", Handle<Value>() }, { obj, "add", "1", Handle<Value>() },
// Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug // Note: use 7 not 1 below, as the latter triggers a nifty VS10 compiler bug
// where instead of 1.0, a garbage value would be passed into Number::New. // where instead of 1.0, a garbage value would be passed into Number::New.
{ obj, "update", "foo", Number::New(7) }, { obj, "update", "foo", Number::New(v8_isolate, 7) },
{ obj, "update", "1", Number::New(2) }, { obj, "update", "1", Number::New(v8_isolate, 2) },
{ obj, "update", "1", Number::New(4) }, { obj, "update", "1", Number::New(v8_isolate, 4) },
{ obj, "add", "1.1", Handle<Value>() }, { obj, "add", "1.1", Handle<Value>() },
{ obj, "delete", "foo", Number::New(3) }, { obj, "delete", "foo", Number::New(v8_isolate, 3) },
{ obj, "delete", "1", Number::New(5) }, { obj, "delete", "1", Number::New(v8_isolate, 5) },
{ obj, "delete", "1.1", Number::New(6) } { obj, "delete", "1.1", Number::New(v8_isolate, 6) }
}; };
EXPECT_RECORDS(CompileRun("records"), expected_records); EXPECT_RECORDS(CompileRun("records"), expected_records);
} }
...@@ -377,17 +380,18 @@ TEST(APITestBasicMutation) { ...@@ -377,17 +380,18 @@ TEST(APITestBasicMutation) {
TEST(HiddenPrototypeObservation) { TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate; HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate()); v8::Isolate* v8_isolate = isolate.GetIsolate();
LocalContext context(isolate.GetIsolate()); HandleScope scope(v8_isolate);
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate()); LocalContext context(v8_isolate);
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
tmpl->SetHiddenPrototype(true); tmpl->SetHiddenPrototype(true);
tmpl->InstanceTemplate()->Set( tmpl->InstanceTemplate()->Set(
String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75)); String::NewFromUtf8(v8_isolate, "foo"), Number::New(v8_isolate, 75));
Handle<Object> proto = tmpl->GetFunction()->NewInstance(); Handle<Object> proto = tmpl->GetFunction()->NewInstance();
Handle<Object> obj = Object::New(); Handle<Object> obj = Object::New(v8_isolate);
obj->SetPrototype(proto); obj->SetPrototype(proto);
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj); context->Global()->Set(String::NewFromUtf8(v8_isolate, "obj"), obj);
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"), context->Global()->Set(String::NewFromUtf8(v8_isolate, "proto"),
proto); proto);
CompileRun( CompileRun(
"var records;" "var records;"
...@@ -396,10 +400,10 @@ TEST(HiddenPrototypeObservation) { ...@@ -396,10 +400,10 @@ TEST(HiddenPrototypeObservation) {
"obj.foo = 41;" // triggers a notification "obj.foo = 41;" // triggers a notification
"proto.foo = 42;"); // does not trigger a notification "proto.foo = 42;"); // does not trigger a notification
const RecordExpectation expected_records[] = { const RecordExpectation expected_records[] = {
{ obj, "update", "foo", Number::New(75) } { obj, "update", "foo", Number::New(v8_isolate, 75) }
}; };
EXPECT_RECORDS(CompileRun("records"), expected_records); EXPECT_RECORDS(CompileRun("records"), expected_records);
obj->SetPrototype(Null(isolate.GetIsolate())); obj->SetPrototype(Null(v8_isolate));
CompileRun("obj.foo = 43"); CompileRun("obj.foo = 43");
const RecordExpectation expected_records2[] = { const RecordExpectation expected_records2[] = {
{ obj, "add", "foo", Handle<Value>() } { obj, "add", "foo", Handle<Value>() }
...@@ -561,7 +565,8 @@ TEST(NamedAccessCheck) { ...@@ -561,7 +565,8 @@ TEST(NamedAccessCheck) {
{ instance, "add", "foo", Handle<Value>() }, { instance, "add", "foo", Handle<Value>() },
{ instance, "update", "foo", { instance, "update", "foo",
String::NewFromUtf8(isolate.GetIsolate(), "bar") }, String::NewFromUtf8(isolate.GetIsolate(), "bar") },
{ instance, "reconfigure", "foo", Number::New(5) }, { instance, "reconfigure", "foo",
Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "bar", Handle<Value>() }, { instance, "add", "bar", Handle<Value>() },
{ obj_no_check, "add", "baz", Handle<Value>() }, { obj_no_check, "add", "baz", Handle<Value>() },
}; };
...@@ -585,7 +590,7 @@ TEST(IndexedAccessCheck) { ...@@ -585,7 +590,7 @@ TEST(IndexedAccessCheck) {
g_access_block_type = types[i]; g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject( Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed, isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(7)); IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 7));
CompileRun("var records = null;" CompileRun("var records = null;"
"var objNoCheck = {};" "var objNoCheck = {};"
"var observer = function(r) { records = r };" "var observer = function(r) { records = r };"
...@@ -612,7 +617,7 @@ TEST(IndexedAccessCheck) { ...@@ -612,7 +617,7 @@ TEST(IndexedAccessCheck) {
{ instance, "add", "7", Handle<Value>() }, { instance, "add", "7", Handle<Value>() },
{ instance, "update", "7", { instance, "update", "7",
String::NewFromUtf8(isolate.GetIsolate(), "foo") }, String::NewFromUtf8(isolate.GetIsolate(), "foo") },
{ instance, "reconfigure", "7", Number::New(5) }, { instance, "reconfigure", "7", Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "8", Handle<Value>() }, { instance, "add", "8", Handle<Value>() },
{ obj_no_check, "add", "42", Handle<Value>() } { obj_no_check, "add", "42", Handle<Value>() }
}; };
...@@ -634,7 +639,7 @@ TEST(SpliceAccessCheck) { ...@@ -634,7 +639,7 @@ TEST(SpliceAccessCheck) {
g_access_block_type = ACCESS_GET; g_access_block_type = ACCESS_GET;
Handle<Object> instance = CreateAccessCheckedObject( Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed, isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(1)); IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 1));
CompileRun("var records = null;" CompileRun("var records = null;"
"obj[1] = 'foo';" "obj[1] = 'foo';"
"obj.length = 2;" "obj.length = 2;"
......
...@@ -960,7 +960,8 @@ TEST(ExternalShortStringAdd) { ...@@ -960,7 +960,8 @@ TEST(ExternalShortStringAdd) {
v8::Local<v8::String> ascii_external_string = v8::Local<v8::String> ascii_external_string =
v8::String::NewExternal(CcTest::isolate(), ascii_resource); v8::String::NewExternal(CcTest::isolate(), ascii_resource);
ascii_external_strings->Set(v8::Integer::New(i), ascii_external_string); ascii_external_strings->Set(v8::Integer::New(CcTest::isolate(), i),
ascii_external_string);
uc16* non_ascii = zone.NewArray<uc16>(i + 1); uc16* non_ascii = zone.NewArray<uc16>(i + 1);
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
non_ascii[j] = 0x1234; non_ascii[j] = 0x1234;
...@@ -970,7 +971,7 @@ TEST(ExternalShortStringAdd) { ...@@ -970,7 +971,7 @@ TEST(ExternalShortStringAdd) {
Resource* resource = new(&zone) Resource(Vector<const uc16>(non_ascii, i)); Resource* resource = new(&zone) Resource(Vector<const uc16>(non_ascii, i));
v8::Local<v8::String> non_ascii_external_string = v8::Local<v8::String> non_ascii_external_string =
v8::String::NewExternal(CcTest::isolate(), resource); v8::String::NewExternal(CcTest::isolate(), resource);
non_ascii_external_strings->Set(v8::Integer::New(i), non_ascii_external_strings->Set(v8::Integer::New(CcTest::isolate(), i),
non_ascii_external_string); non_ascii_external_string);
} }
...@@ -978,7 +979,8 @@ TEST(ExternalShortStringAdd) { ...@@ -978,7 +979,8 @@ TEST(ExternalShortStringAdd) {
v8::Handle<v8::Object> global = context->Global(); v8::Handle<v8::Object> global = context->Global();
global->Set(v8_str("external_ascii"), ascii_external_strings); global->Set(v8_str("external_ascii"), ascii_external_strings);
global->Set(v8_str("external_non_ascii"), non_ascii_external_strings); global->Set(v8_str("external_non_ascii"), non_ascii_external_strings);
global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength)); global->Set(v8_str("max_length"),
v8::Integer::New(CcTest::isolate(), kMaxLength));
// Add short external ascii and non-ascii strings checking the result. // Add short external ascii and non-ascii strings checking the result.
static const char* source = static const char* source =
......
...@@ -208,9 +208,9 @@ void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -208,9 +208,9 @@ void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::V8::TerminateExecution(args.GetIsolate()); v8::V8::TerminateExecution(args.GetIsolate());
return; return;
} }
v8::Local<v8::Object> result = v8::Object::New(); v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate());
result->Set(v8::String::NewFromUtf8(args.GetIsolate(), "x"), result->Set(v8::String::NewFromUtf8(args.GetIsolate(), "x"),
v8::Integer::New(42)); v8::Integer::New(args.GetIsolate(), 42));
args.GetReturnValue().Set(result); args.GetReturnValue().Set(result);
} }
......
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