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 are prepared, BTW.

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

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fdbf271b
......@@ -1668,7 +1668,6 @@ class V8_EXPORT String : public Primitive {
/**
* A zero length string.
*/
static v8::Local<v8::String> Empty();
V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
/**
......@@ -1963,8 +1962,6 @@ class V8_EXPORT Number : public Primitive {
public:
double Value() const;
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);
private:
Number();
......@@ -1979,11 +1976,6 @@ class V8_EXPORT Integer : public Number {
public:
static Local<Integer> New(Isolate* isolate, int32_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;
V8_INLINE static Integer* Cast(v8::Value* obj);
private:
......@@ -2337,8 +2329,7 @@ class V8_EXPORT Object : public Value {
Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
static Local<Object> New(Isolate* isolate);
// Will be deprecated soon.
static Local<Object> New();
V8_INLINE static Object* Cast(Value* obj);
private:
......@@ -3347,12 +3338,6 @@ class V8_EXPORT FunctionTemplate : public Template {
Handle<Value> data = Handle<Value>(),
Handle<Signature> signature = Handle<Signature>(),
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.*/
Local<Function> GetFunction();
......@@ -5792,7 +5777,7 @@ void ReturnValue<T>::Set(int32_t i) {
*value_ = I::IntToSmi(i);
return;
}
Set(Integer::New(i, GetIsolate()));
Set(Integer::New(GetIsolate(), i));
}
template<typename T>
......@@ -5804,7 +5789,7 @@ void ReturnValue<T>::Set(uint32_t i) {
Set(static_cast<int32_t>(i));
return;
}
Set(Integer::NewFromUnsigned(i, GetIsolate()));
Set(Integer::NewFromUnsigned(GetIsolate(), i));
}
template<typename T>
......
......@@ -885,7 +885,7 @@ static void TemplateSet(i::Isolate* isolate,
Utils::OpenHandle(templ)->set_property_list(*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++) {
i::Handle<i::Object> value = data[i].IsEmpty() ?
i::Handle<i::Object>(isolate->factory()->undefined_value()) :
......@@ -902,10 +902,11 @@ void Template::Set(v8::Handle<String> name,
ENTER_V8(isolate);
i::HandleScope scope(isolate);
const int kSize = 3;
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = {
name,
value,
v8::Integer::New(attribute)};
v8::Integer::New(v8_isolate, attribute)};
TemplateSet(isolate, this, kSize, data);
}
......@@ -922,12 +923,13 @@ void Template::SetAccessorProperty(
ASSERT(!getter.IsEmpty() || !setter.IsEmpty());
i::HandleScope scope(isolate);
const int kSize = 5;
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8::Handle<v8::Data> data[kSize] = {
name,
getter,
setter,
v8::Integer::New(attribute),
v8::Integer::New(access_control)};
v8::Integer::New(v8_isolate, attribute),
v8::Integer::New(v8_isolate, access_control)};
TemplateSet(isolate, this, kSize, data);
}
......@@ -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,
Handle<FunctionTemplate> receiver, int argc,
Handle<FunctionTemplate> argv[]) {
......@@ -4124,10 +4118,11 @@ ScriptOrigin Function::GetScriptOrigin() const {
if (func->shared()->script()->IsScript()) {
i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script);
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(func->GetIsolate());
v8::ScriptOrigin origin(
Utils::ToLocal(scriptName),
v8::Integer::New(script->line_offset()->value()),
v8::Integer::New(script->column_offset()->value()));
v8::Integer::New(isolate, script->line_offset()->value()),
v8::Integer::New(isolate, script->column_offset()->value()));
return origin;
}
return v8::ScriptOrigin(Handle<Value>());
......@@ -5344,16 +5339,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
namespace {
......@@ -5416,7 +5401,7 @@ inline Local<String> NewString(Isolate* v8_isolate,
EnsureInitializedForIsolate(isolate, location);
LOG_API(isolate, env);
if (length == 0 && type != String::kUndetectableString) {
return String::Empty();
return String::Empty(v8_isolate);
}
ENTER_V8(isolate);
if (length == -1) length = StringLength(data);
......@@ -5647,11 +5632,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) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
EnsureInitializedForIsolate(i_isolate, "v8::NumberObject::New()");
......@@ -6137,13 +6117,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) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized());
......@@ -6157,30 +6130,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) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
ASSERT(internal_isolate->IsInitialized());
......@@ -6199,7 +6148,7 @@ Local<Integer> v8::Integer::NewFromUnsigned(Isolate* isolate, uint32_t value) {
ASSERT(internal_isolate->IsInitialized());
bool fits_into_int32_t = (value & (1 << 31)) == 0;
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);
i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
......
......@@ -202,7 +202,7 @@ class ExecArgs {
exec_args_[0] = c_arg;
int i = 1;
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);
if (*utf8_arg == NULL) {
exec_args_[i] = NULL; // Consistent state for destructor.
......@@ -314,7 +314,7 @@ static Handle<Value> GetStdout(Isolate* isolate,
struct timeval& start_time,
int read_timeout,
int total_timeout) {
Handle<String> accumulator = String::Empty();
Handle<String> accumulator = String::Empty(isolate);
int fullness = 0;
static const int kStdoutReadBufferSize = 4096;
......
......@@ -48,7 +48,7 @@ static void AddCounter(v8::Isolate* isolate,
const char* name) {
if (counter->Enabled()) {
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,
intptr_t value,
const char* 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,
int64_t value,
const char* 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(
}
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) \
AddCounter(args.GetIsolate(), result, counters->name(), #name);
......
......@@ -289,7 +289,7 @@ class LocalContext {
};
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,
int column_number) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url),
v8::Integer::New(line_number),
v8::Integer::New(column_number));
v8::Integer::New(isolate, line_number),
v8::Integer::New(isolate, column_number));
return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin)
->Run();
}
......
......@@ -39,9 +39,11 @@ const char* ProfilerExtension::kSource =
v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<v8::String> name) {
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"))) {
return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StopProfiling);
} else {
CHECK(false);
return v8::Handle<v8::FunctionTemplate>();
......
......@@ -201,7 +201,7 @@ THREADED_TEST(AccessorIC) {
v8::FunctionTemplate::New(isolate, XSetter));
x_holder = obj->NewInstance();
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);
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(CompileRun(
"obj.__proto__ = holder;"
......@@ -222,8 +222,8 @@ THREADED_TEST(AccessorIC) {
"result"));
CHECK_EQ(40, array->Length());
for (int i = 0; i < 40; i++) {
v8::Handle<Value> entry = array->Get(v8::Integer::New(i));
CHECK_EQ(v8::Integer::New(i), entry);
v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i));
CHECK_EQ(v8::Integer::New(isolate, i), entry);
}
}
......@@ -524,7 +524,7 @@ static void AllocateHandles(Local<String> name,
for (int i = 0; i < i::kHandleBlockSize + 1; i++) {
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) {
F0 f = FUNCTION_CAST<F0>(Code::cast(code)->entry());
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) {
F0 f = FUNCTION_CAST<F0>(code->entry());
int res = f();
args.GetReturnValue().Set(v8::Integer::New(res));
args.GetReturnValue().Set(v8::Integer::New(CcTest::isolate(), res));
}
......
......@@ -370,7 +370,7 @@ TEST(OptimizedCodeSharing) {
for (int i = 0; i < 10; i++) {
LocalContext env;
env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"),
v8::Integer::New(i));
v8::Integer::New(CcTest::isolate(), i));
CompileRun("function MakeClosure() {"
" return function() { return x; };"
"}"
......
......@@ -550,7 +550,9 @@ TEST(CollectCpuProfile) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
function->Call(env->Global(), ARRAY_SIZE(args), args);
......@@ -622,7 +624,9 @@ TEST(SampleWhenFrameIsNotSetup) {
// Simulators are much slower.
repeat_count = 1;
#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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -742,7 +746,7 @@ TEST(NativeAccessorUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 180);
......@@ -791,13 +795,15 @@ TEST(NativeAccessorMonomorphicIC) {
// profiling.
accessors.set_warming_up(true);
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);
accessors.set_warming_up(false);
}
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
......@@ -851,7 +857,7 @@ TEST(NativeMethodUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -900,13 +906,15 @@ TEST(NativeMethodMonomorphicIC) {
// profiling.
callbacks.set_warming_up(true);
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);
callbacks.set_warming_up(false);
}
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -945,7 +953,9 @@ TEST(BoundFunctionCall) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -1004,7 +1014,9 @@ TEST(FunctionCallSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -1084,7 +1096,9 @@ TEST(FunctionApplySample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
......@@ -1191,7 +1205,9 @@ TEST(JsNativeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
......@@ -1275,7 +1291,9 @@ TEST(JsNativeJsRuntimeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
......@@ -1368,7 +1386,9 @@ TEST(JsNative1JsNative2JsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
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 =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
......
This diff is collapsed.
......@@ -147,17 +147,17 @@ static void VerifyRead(v8::Handle<v8::DeclaredAccessorDescriptor> descriptor,
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*) {
return v8::Number::New(value);
static v8::Handle<v8::Value> Convert(float value, v8::Isolate* isolate) {
return v8::Number::New(isolate, value);
}
static v8::Handle<v8::Value> Convert(double value, v8::Isolate*) {
return v8::Number::New(value);
static v8::Handle<v8::Value> Convert(double value, v8::Isolate* isolate) {
return v8::Number::New(isolate, value);
}
......@@ -277,10 +277,12 @@ TEST(PointerDereferenceRead) {
AlignedArray* array = helper.array_.get();
array->As<uintptr_t**>()[first_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);
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 {
static void HandleQuery(Local<String> key,
const v8::PropertyCallbackInfo<v8::Integer>& info);
v8::Isolate* isolate() const { return CcTest::isolate(); }
private:
bool is_initialized_;
Persistent<Context> context_;
......@@ -244,7 +246,7 @@ TEST(Unknown) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
{ DeclarationContext context;
......@@ -278,7 +280,7 @@ TEST(Unknown) {
class PresentPropertyContext: public DeclarationContext {
protected:
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) {
1, // access
1, // initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
{ PresentPropertyContext context;
......@@ -324,7 +326,7 @@ TEST(Present) {
1, // access
1, // initialization
1, // (re-)declaration
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
}
......@@ -356,7 +358,7 @@ TEST(Absent) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(isolate, 0));
}
{ AbsentPropertyContext context;
......@@ -416,7 +418,7 @@ class AppearingPropertyContext: public DeclarationContext {
// Return that the property is present so we only get the
// setter called when initializing with a value.
state_ = UNKNOWN;
return Integer::New(v8::None);
return Integer::New(isolate(), v8::None);
default:
CHECK(state_ == UNKNOWN);
break;
......@@ -447,7 +449,7 @@ TEST(Appearing) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
{ AppearingPropertyContext context;
......@@ -502,7 +504,7 @@ class ReappearingPropertyContext: public DeclarationContext {
// Ignore the second declaration by returning
// that the property is already there.
state_ = INITIALIZE;
return Integer::New(v8::None);
return Integer::New(isolate(), v8::None);
case INITIALIZE:
// Force an initialization by returning that
// the property is absent. This will make sure
......@@ -539,10 +541,12 @@ TEST(Reappearing) {
class ExistsInPrototypeContext: public DeclarationContext {
public:
ExistsInPrototypeContext() { InitializeIfNeeded(); }
protected:
virtual v8::Handle<Integer> Query(Local<String> key) {
// 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.
......@@ -563,7 +567,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(87));
EXPECT_RESULT, Number::New(CcTest::isolate(), 87));
}
{ ExistsInPrototypeContext context;
......@@ -579,7 +583,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
{ ExistsInPrototypeContext context;
......@@ -595,7 +599,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
}
......@@ -641,7 +645,7 @@ class ExistsInHiddenPrototypeContext: public DeclarationContext {
protected:
virtual v8::Handle<Integer> Query(Local<String> key) {
// 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.
......@@ -680,7 +684,7 @@ TEST(ExistsInHiddenPrototype) {
1, // access
1, // initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
{ ExistsInHiddenPrototypeContext context;
......@@ -706,7 +710,7 @@ TEST(ExistsInHiddenPrototype) {
0,
0,
1, // (re-)declaration
EXPECT_RESULT, Number::New(0));
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
}
}
......@@ -759,40 +763,41 @@ class SimpleContext {
TEST(CrossScriptReferences) {
HandleScope scope(CcTest::isolate());
v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
{ SimpleContext context;
context.Check("var x = 1; x",
EXPECT_RESULT, Number::New(1));
EXPECT_RESULT, Number::New(isolate, 1));
context.Check("var x = 2; x",
EXPECT_RESULT, Number::New(2));
EXPECT_RESULT, Number::New(isolate, 2));
context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(3));
EXPECT_RESULT, Number::New(isolate, 3));
context.Check("const x = 4; x",
EXPECT_RESULT, Number::New(4));
EXPECT_RESULT, Number::New(isolate, 4));
context.Check("x = 5; x",
EXPECT_RESULT, Number::New(5));
EXPECT_RESULT, Number::New(isolate, 5));
context.Check("var x = 6; x",
EXPECT_RESULT, Number::New(6));
EXPECT_RESULT, Number::New(isolate, 6));
context.Check("this.x",
EXPECT_RESULT, Number::New(6));
EXPECT_RESULT, Number::New(isolate, 6));
context.Check("function x() { return 7 }; x()",
EXPECT_RESULT, Number::New(7));
EXPECT_RESULT, Number::New(isolate, 7));
}
{ SimpleContext context;
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
EXPECT_RESULT, Number::New(1));
EXPECT_RESULT, Number::New(isolate, 1));
context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(1));
EXPECT_RESULT, Number::New(isolate, 1));
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
EXPECT_RESULT, Number::New(1));
EXPECT_RESULT, Number::New(isolate, 1));
context.Check("this.x",
EXPECT_RESULT, Number::New(1));
EXPECT_RESULT, Number::New(isolate, 1));
context.Check("function x() { return 7 }; x",
EXPECT_EXCEPTION);
}
......@@ -804,7 +809,8 @@ TEST(CrossScriptReferencesHarmony) {
i::FLAG_harmony_scoping = true;
i::FLAG_harmony_modules = true;
HandleScope scope(CcTest::isolate());
v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
const char* decs[] = {
"var x = 1; x", "x", "this.x",
......@@ -817,12 +823,14 @@ TEST(CrossScriptReferencesHarmony) {
for (int i = 0; decs[i] != NULL; i += 3) {
SimpleContext context;
context.Check(decs[i], EXPECT_RESULT, Number::New(1));
context.Check(decs[i+1], EXPECT_RESULT, Number::New(1));
context.Check(decs[i], EXPECT_RESULT, Number::New(isolate, 1));
context.Check(decs[i+1], EXPECT_RESULT, Number::New(isolate, 1));
// TODO(rossberg): The current ES6 draft spec does not reflect lexical
// bindings on the global object. However, this will probably change, in
// 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) {
for (int i = 0; firsts[i] != NULL; ++i) {
for (int j = 0; seconds[j] != NULL; ++j) {
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,
// but we currently do not detect the cases where the first declaration
// is not lexical.
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) {
for (int i = 0; i < kArrayLength; i++) {
indices[i] = -1;
HandleScope scope(isolate);
v8::Local<v8::Object> object = v8::Object::New();
object->Set(i, v8::Integer::New(i, v8_isolate));
v8::Local<v8::Object> object = v8::Object::New(v8_isolate);
object->Set(i, v8::Integer::New(v8_isolate, i));
// Create with internal api
eternal_handles->Create(
isolate, *v8::Utils::OpenHandle(*object), &indices[i]);
......@@ -370,7 +370,7 @@ TEST(EternalHandles) {
// Create an eternal via the constructor
{
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);
CHECK(!eternal.IsEmpty());
CHECK(object == eternal.Get(v8_isolate));
......
......@@ -39,7 +39,7 @@ TEST(StrictUndeclaredGlobalVariable) {
LocalContext context;
v8::TryCatch try_catch;
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 =
context->Global()->GetPrototype().As<v8::Object>();
proto->Set(var_name, v8_num(100));
......
......@@ -472,7 +472,7 @@ TEST(HeapSnapshotInternalReferences) {
v8::Handle<v8::Object> global_proxy = env->Global();
v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
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(1, obj);
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
......@@ -1354,7 +1354,7 @@ class GraphWithImplicitRefs {
instance_ = this;
isolate_ = (*env)->GetIsolate();
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"),
v8::Local<v8::Value>::New(isolate_, objects_[0]));
......@@ -1820,7 +1820,8 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle());
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);
CHECK(HasWeakGlobalHandle());
......@@ -1994,8 +1995,9 @@ TEST(ManyLocalsInSharedContext) {
TEST(AllocationSitesAreVisible) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
CompileRun(
"fun = function () { var a = [3, 2, 1]; return a; }\n"
"fun();");
......@@ -2037,9 +2039,12 @@ TEST(AllocationSitesAreVisible) {
transition_info->GetHeapValue());
// Verify the array is "a" in the code above.
CHECK_EQ(3, array->Length());
CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0)));
CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1)));
CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2)));
CHECK_EQ(v8::Integer::New(isolate, 3),
array->Get(v8::Integer::New(isolate, 0)));
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) {
"%OptimizeFunctionOnNextCall(f);"
"f();");
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();
v8::Local<v8::Context>::New(isolate, ctx1)->Exit();
ctx1p.Reset();
......@@ -1836,7 +1836,7 @@ TEST(LeakNativeContextViaFunction) {
"%OptimizeFunctionOnNextCall(f);"
"f(o);");
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();
ctx1->Exit();
ctx1p.Reset();
......@@ -1880,7 +1880,7 @@ TEST(LeakNativeContextViaMapKeyed) {
"%OptimizeFunctionOnNextCall(f);"
"f();");
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();
ctx1->Exit();
ctx1p.Reset();
......@@ -1928,7 +1928,7 @@ TEST(LeakNativeContextViaMapProto) {
"%OptimizeFunctionOnNextCall(f);"
"f();");
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();
ctx1->Exit();
ctx1p.Reset();
......@@ -2768,7 +2768,7 @@ TEST(Regress2211) {
for (int i = 0; i < 2; i++) {
// 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);
CHECK(internal_obj->HasFastProperties());
......@@ -3337,7 +3337,7 @@ TEST(Regress169928) {
v8_str("fastliteralcase(mote, 2.5);");
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
CcTest::heap()->CollectGarbage(NEW_SPACE);
......
......@@ -332,27 +332,30 @@ static void ExpectRecords(v8::Isolate* isolate,
TEST(APITestBasicMutation) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
v8::Isolate* v8_isolate = isolate.GetIsolate();
HandleScope scope(v8_isolate);
LocalContext context(v8_isolate);
Handle<Object> obj = Handle<Object>::Cast(CompileRun(
"var records = [];"
"var obj = {};"
"function observer(r) { [].push.apply(records, r); };"
"Object.observe(obj, observer);"
"obj"));
obj->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(7));
obj->Set(1, Number::New(2));
obj->Set(String::NewFromUtf8(v8_isolate, "foo"),
Number::New(v8_isolate, 7));
obj->Set(1, Number::New(v8_isolate, 2));
// ForceSet should work just as well as Set
obj->ForceSet(String::NewFromUtf8(isolate.GetIsolate(), "foo"),
Number::New(3));
obj->ForceSet(Number::New(1), Number::New(4));
obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"),
Number::New(v8_isolate, 3));
obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4));
// 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
obj->Set(Number::New(1.1), Number::New(6), DontDelete);
obj->Delete(String::NewFromUtf8(isolate.GetIsolate(), "foo"));
obj->Set(Number::New(v8_isolate, 1.1),
Number::New(v8_isolate, 6), DontDelete);
obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
obj->Delete(1);
obj->ForceDelete(Number::New(1.1));
obj->ForceDelete(Number::New(v8_isolate, 1.1));
// Force delivery
// TODO(adamk): Should the above set methods trigger delivery themselves?
......@@ -363,13 +366,13 @@ TEST(APITestBasicMutation) {
{ obj, "add", "1", Handle<Value>() },
// 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.
{ obj, "update", "foo", Number::New(7) },
{ obj, "update", "1", Number::New(2) },
{ obj, "update", "1", Number::New(4) },
{ obj, "update", "foo", Number::New(v8_isolate, 7) },
{ obj, "update", "1", Number::New(v8_isolate, 2) },
{ obj, "update", "1", Number::New(v8_isolate, 4) },
{ obj, "add", "1.1", Handle<Value>() },
{ obj, "delete", "foo", Number::New(3) },
{ obj, "delete", "1", Number::New(5) },
{ obj, "delete", "1.1", Number::New(6) }
{ obj, "delete", "foo", Number::New(v8_isolate, 3) },
{ obj, "delete", "1", Number::New(v8_isolate, 5) },
{ obj, "delete", "1.1", Number::New(v8_isolate, 6) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
}
......@@ -377,17 +380,18 @@ TEST(APITestBasicMutation) {
TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate;
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate());
v8::Isolate* v8_isolate = isolate.GetIsolate();
HandleScope scope(v8_isolate);
LocalContext context(v8_isolate);
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
tmpl->SetHiddenPrototype(true);
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> obj = Object::New();
Handle<Object> obj = Object::New(v8_isolate);
obj->SetPrototype(proto);
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"),
context->Global()->Set(String::NewFromUtf8(v8_isolate, "obj"), obj);
context->Global()->Set(String::NewFromUtf8(v8_isolate, "proto"),
proto);
CompileRun(
"var records;"
......@@ -396,10 +400,10 @@ TEST(HiddenPrototypeObservation) {
"obj.foo = 41;" // triggers a notification
"proto.foo = 42;"); // does not trigger a notification
const RecordExpectation expected_records[] = {
{ obj, "update", "foo", Number::New(75) }
{ obj, "update", "foo", Number::New(v8_isolate, 75) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
obj->SetPrototype(Null(isolate.GetIsolate()));
obj->SetPrototype(Null(v8_isolate));
CompileRun("obj.foo = 43");
const RecordExpectation expected_records2[] = {
{ obj, "add", "foo", Handle<Value>() }
......@@ -561,7 +565,8 @@ TEST(NamedAccessCheck) {
{ instance, "add", "foo", Handle<Value>() },
{ instance, "update", "foo",
String::NewFromUtf8(isolate.GetIsolate(), "bar") },
{ instance, "reconfigure", "foo", Number::New(5) },
{ instance, "reconfigure", "foo",
Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "bar", Handle<Value>() },
{ obj_no_check, "add", "baz", Handle<Value>() },
};
......@@ -585,7 +590,7 @@ TEST(IndexedAccessCheck) {
g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(7));
IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 7));
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
......@@ -612,7 +617,7 @@ TEST(IndexedAccessCheck) {
{ instance, "add", "7", Handle<Value>() },
{ instance, "update", "7",
String::NewFromUtf8(isolate.GetIsolate(), "foo") },
{ instance, "reconfigure", "7", Number::New(5) },
{ instance, "reconfigure", "7", Number::New(isolate.GetIsolate(), 5) },
{ instance, "add", "8", Handle<Value>() },
{ obj_no_check, "add", "42", Handle<Value>() }
};
......@@ -634,7 +639,7 @@ TEST(SpliceAccessCheck) {
g_access_block_type = ACCESS_GET;
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(1));
IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 1));
CompileRun("var records = null;"
"obj[1] = 'foo';"
"obj.length = 2;"
......
......@@ -960,7 +960,8 @@ TEST(ExternalShortStringAdd) {
v8::Local<v8::String> ascii_external_string =
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);
for (int j = 0; j < i; j++) {
non_ascii[j] = 0x1234;
......@@ -970,7 +971,7 @@ TEST(ExternalShortStringAdd) {
Resource* resource = new(&zone) Resource(Vector<const uc16>(non_ascii, i));
v8::Local<v8::String> non_ascii_external_string =
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);
}
......@@ -978,7 +979,8 @@ TEST(ExternalShortStringAdd) {
v8::Handle<v8::Object> global = context->Global();
global->Set(v8_str("external_ascii"), 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.
static const char* source =
......
......@@ -208,9 +208,9 @@ void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::V8::TerminateExecution(args.GetIsolate());
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"),
v8::Integer::New(42));
v8::Integer::New(args.GetIsolate(), 42));
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