Revert r18449 "Reland r18383: More API cleanup." and r18450 "Unbreak build."

because of broken WebKit bots.

TBR=svenpanne@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18451 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2014-01-03 14:13:21 +00:00
parent 08354f8f07
commit 163386c700
22 changed files with 638 additions and 702 deletions

View File

@ -1668,6 +1668,7 @@ 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);
/**
@ -1962,6 +1963,8 @@ 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();
@ -1976,6 +1979,11 @@ 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:
@ -2329,7 +2337,8 @@ 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:
@ -3344,6 +3353,12 @@ 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();
@ -5783,7 +5798,7 @@ void ReturnValue<T>::Set(int32_t i) {
*value_ = I::IntToSmi(i);
return;
}
Set(Integer::New(GetIsolate(), i));
Set(Integer::New(i, GetIsolate()));
}
template<typename T>
@ -5795,7 +5810,7 @@ void ReturnValue<T>::Set(uint32_t i) {
Set(static_cast<int32_t>(i));
return;
}
Set(Integer::NewFromUnsigned(GetIsolate(), i));
Set(Integer::NewFromUnsigned(i, GetIsolate()));
}
template<typename T>

View File

@ -885,7 +885,7 @@ static void TemplateSet(i::Isolate* isolate,
Utils::OpenHandle(templ)->set_property_list(*list);
}
NeanderArray array(list);
array.add(isolate->factory()->NewNumberFromInt(length));
array.add(Utils::OpenHandle(*v8::Integer::New(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,11 +902,10 @@ 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(v8_isolate, attribute)};
v8::Integer::New(attribute)};
TemplateSet(isolate, this, kSize, data);
}
@ -923,13 +922,12 @@ 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(v8_isolate, attribute),
v8::Integer::New(v8_isolate, access_control)};
v8::Integer::New(attribute),
v8::Integer::New(access_control)};
TemplateSet(isolate, this, kSize, data);
}
@ -1010,6 +1008,14 @@ 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[]) {
@ -4110,11 +4116,10 @@ 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(isolate, script->line_offset()->value()),
v8::Integer::New(isolate, script->column_offset()->value()));
v8::Integer::New(script->line_offset()->value()),
v8::Integer::New(script->column_offset()->value()));
return origin;
}
return v8::ScriptOrigin(Handle<Value>());
@ -5345,6 +5350,16 @@ 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 {
@ -5407,7 +5422,7 @@ inline Local<String> NewString(Isolate* v8_isolate,
EnsureInitializedForIsolate(isolate, location);
LOG_API(isolate, env);
if (length == 0 && type != String::kUndetectableString) {
return String::Empty(v8_isolate);
return String::Empty();
}
ENTER_V8(isolate);
if (length == -1) length = StringLength(data);
@ -5638,6 +5653,11 @@ 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()");
@ -6123,6 +6143,13 @@ 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());
@ -6136,6 +6163,30 @@ 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());
@ -6154,7 +6205,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(isolate, static_cast<int32_t>(value));
return Integer::New(static_cast<int32_t>(value), isolate);
}
ENTER_V8(internal_isolate);
i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);

View File

@ -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(isolate, j)));
Handle<Value> arg(command_args->Get(Integer::New(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(isolate);
Handle<String> accumulator = String::Empty();
int fullness = 0;
static const int kStdoutReadBufferSize = 4096;

View File

@ -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(isolate, *counter->GetInternalPointer()));
v8::Number::New(*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(isolate, static_cast<double>(value)));
v8::Number::New(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(isolate, static_cast<double>(value)));
v8::Number::New(static_cast<double>(value)));
}
@ -82,7 +82,7 @@ void StatisticsExtension::GetCounters(
}
Counters* counters = isolate->counters();
v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate());
v8::Local<v8::Object> result = v8::Object::New();
#define ADD_COUNTER(name, caption) \
AddCounter(args.GetIsolate(), result, counters->name(), #name);

View File

@ -289,7 +289,7 @@ class LocalContext {
};
static inline v8::Local<v8::Value> v8_num(double x) {
return v8::Number::New(v8::Isolate::GetCurrent(), x);
return v8::Number::New(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(isolate, line_number),
v8::Integer::New(isolate, column_number));
v8::Integer::New(line_number),
v8::Integer::New(column_number));
return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin)
->Run();
}

View File

@ -39,11 +39,9 @@ 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(isolate,
ProfilerExtension::StartProfiling);
return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling);
} else if (name->Equals(v8::String::NewFromUtf8(isolate, "stopProfiling"))) {
return v8::FunctionTemplate::New(isolate,
ProfilerExtension::StopProfiling);
return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
} else {
CHECK(false);
return v8::Handle<v8::FunctionTemplate>();

View File

@ -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(isolate);
x_receiver = v8::Object::New();
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(isolate, i));
CHECK_EQ(v8::Integer::New(isolate, i), entry);
v8::Handle<Value> entry = array->Get(v8::Integer::New(i));
CHECK_EQ(v8::Integer::New(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(info.GetIsolate(), 100));
info.GetReturnValue().Set(v8::Integer::New(100));
}

File diff suppressed because it is too large Load Diff

View File

@ -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(CcTest::isolate(), res));
args.GetReturnValue().Set(v8::Integer::New(res));
}

View File

@ -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(CcTest::isolate(), res));
args.GetReturnValue().Set(v8::Integer::New(res));
}

View File

@ -369,7 +369,7 @@ TEST(OptimizedCodeSharing) {
for (int i = 0; i < 10; i++) {
LocalContext env;
env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"),
v8::Integer::New(CcTest::isolate(), i));
v8::Integer::New(i));
CompileRun("function MakeClosure() {"
" return function() { return x; };"
"}"

View File

@ -550,9 +550,7 @@ 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(env->GetIsolate(), profiling_interval_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
function->Call(env->Global(), ARRAY_SIZE(args), args);
@ -624,9 +622,7 @@ TEST(SampleWhenFrameIsNotSetup) {
// Simulators are much slower.
repeat_count = 1;
#endif
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), repeat_count)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -746,7 +742,7 @@ TEST(NativeAccessorUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 180);
@ -795,15 +791,13 @@ TEST(NativeAccessorMonomorphicIC) {
// profiling.
accessors.set_warming_up(true);
int32_t warm_up_iterations = 3;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(isolate, warm_up_iterations)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(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(isolate, repeat_count) };
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
@ -857,7 +851,7 @@ TEST(NativeMethodUninitializedIC) {
env->Global()->Get(v8::String::NewFromUtf8(isolate, "start")));
int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(isolate, repeat_count) };
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -906,15 +900,13 @@ TEST(NativeMethodMonomorphicIC) {
// profiling.
callbacks.set_warming_up(true);
int32_t warm_up_iterations = 3;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(isolate, warm_up_iterations)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(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(isolate, repeat_count) };
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -953,9 +945,7 @@ TEST(BoundFunctionCall) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -1014,9 +1004,7 @@ TEST(FunctionCallSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -1096,9 +1084,7 @@ TEST(FunctionApplySample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
@ -1205,9 +1191,7 @@ TEST(JsNativeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
@ -1291,9 +1275,7 @@ TEST(JsNativeJsRuntimeJsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);
@ -1386,9 +1368,7 @@ TEST(JsNative1JsNative2JsSample) {
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = {
v8::Integer::New(env->GetIsolate(), duration_ms)
};
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
const v8::CpuProfile* profile =
RunProfiler(env, function, args, ARRAY_SIZE(args), 10);

View File

@ -644,9 +644,7 @@ static void DebugEventBreakPointHitCount(
if (!frame_function_name.IsEmpty()) {
// Get the name of the function.
const int argc = 2;
v8::Handle<v8::Value> argv[argc] = {
exec_state, v8::Integer::New(CcTest::isolate(), 0)
};
v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) };
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv);
if (result->IsUndefined()) {
@ -893,9 +891,7 @@ static void DebugEventStepSequence(
CHECK(break_point_hit_count <
StrLength(expected_step_sequence));
const int argc = 2;
v8::Handle<v8::Value> argv[argc] = {
exec_state, v8::Integer::New(CcTest::isolate(), 0)
};
v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) };
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv);
CHECK(result->IsString());
@ -2100,7 +2096,7 @@ TEST(ScriptBreakPointLineOffset) {
// Create script origin both name and line offset.
v8::ScriptOrigin origin(
v8::String::NewFromUtf8(env->GetIsolate(), "test.html"),
v8::Integer::New(env->GetIsolate(), 7));
v8::Integer::New(7));
// Set two script break points before the script is loaded.
int sbp1 =
@ -2183,7 +2179,7 @@ TEST(ScriptBreakPointLine) {
break_point_hit_count = 0;
v8::ScriptOrigin origin(
v8::String::NewFromUtf8(env->GetIsolate(), "test.html"),
v8::Integer::New(env->GetIsolate(), 0));
v8::Integer::New(0));
v8::Script::Compile(script, &origin)->Run();
f = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
@ -2518,7 +2514,7 @@ TEST(DebugEvaluate) {
checks = checks_uu;
v8::Handle<v8::Value> argv_bar_1[2] = {
v8::Undefined(isolate),
v8::Number::New(isolate, barbar_break_position)
v8::Number::New(barbar_break_position)
};
bar->Call(env->Global(), 2, argv_bar_1);
@ -2527,7 +2523,7 @@ TEST(DebugEvaluate) {
checks = checks_hu;
v8::Handle<v8::Value> argv_bar_2[2] = {
v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!"),
v8::Number::New(env->GetIsolate(), barbar_break_position)
v8::Number::New(barbar_break_position)
};
bar->Call(env->Global(), 2, argv_bar_2);
@ -2536,7 +2532,7 @@ TEST(DebugEvaluate) {
checks = checks_hh;
v8::Handle<v8::Value> argv_bar_3[2] = {
v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!"),
v8::Number::New(env->GetIsolate(), barbar_break_position + 1)
v8::Number::New(barbar_break_position + 1)
};
bar->Call(env->Global(), 2, argv_bar_3);
@ -2869,8 +2865,7 @@ TEST(DebugStepKeyedLoadLoop) {
// Create array [0,1,2,3,4,5,6,7,8,9]
v8::Local<v8::Array> a = v8::Array::New(env->GetIsolate(), 10);
for (int i = 0; i < 10; i++) {
a->Set(v8::Number::New(env->GetIsolate(), i),
v8::Number::New(env->GetIsolate(), i));
a->Set(v8::Number::New(i), v8::Number::New(i));
}
// Call function without any break points to ensure inlining is in place.
@ -2917,8 +2912,7 @@ TEST(DebugStepKeyedStoreLoop) {
// Create array [0,1,2,3,4,5,6,7,8,9]
v8::Local<v8::Array> a = v8::Array::New(env->GetIsolate(), 10);
for (int i = 0; i < 10; i++) {
a->Set(v8::Number::New(env->GetIsolate(), i),
v8::Number::New(env->GetIsolate(), i));
a->Set(v8::Number::New(i), v8::Number::New(i));
}
// Call function without any break points to ensure inlining is in place.
@ -3184,8 +3178,7 @@ TEST(DebugStepIf) {
TEST(DebugStepSwitch) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3215,21 +3208,21 @@ TEST(DebugStepSwitch) {
// One case with fall-through.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_1[argc] = { v8::Number::New(isolate, 1) };
v8::Handle<v8::Value> argv_1[argc] = { v8::Number::New(1) };
foo->Call(env->Global(), argc, argv_1);
CHECK_EQ(6, break_point_hit_count);
// Another case.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_2[argc] = { v8::Number::New(isolate, 2) };
v8::Handle<v8::Value> argv_2[argc] = { v8::Number::New(2) };
foo->Call(env->Global(), argc, argv_2);
CHECK_EQ(5, break_point_hit_count);
// Last case.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_3[argc] = { v8::Number::New(isolate, 3) };
v8::Handle<v8::Value> argv_3[argc] = { v8::Number::New(3) };
foo->Call(env->Global(), argc, argv_3);
CHECK_EQ(7, break_point_hit_count);
@ -3241,8 +3234,7 @@ TEST(DebugStepSwitch) {
TEST(DebugStepWhile) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3263,14 +3255,14 @@ TEST(DebugStepWhile) {
// Looping 10 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(isolate, 10) };
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
foo->Call(env->Global(), argc, argv_10);
CHECK_EQ(22, break_point_hit_count);
// Looping 100 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(isolate, 100) };
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
foo->Call(env->Global(), argc, argv_100);
CHECK_EQ(202, break_point_hit_count);
@ -3282,8 +3274,7 @@ TEST(DebugStepWhile) {
TEST(DebugStepDoWhile) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3304,14 +3295,14 @@ TEST(DebugStepDoWhile) {
// Looping 10 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(isolate, 10) };
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
foo->Call(env->Global(), argc, argv_10);
CHECK_EQ(22, break_point_hit_count);
// Looping 100 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(isolate, 100) };
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
foo->Call(env->Global(), argc, argv_100);
CHECK_EQ(202, break_point_hit_count);
@ -3323,8 +3314,7 @@ TEST(DebugStepDoWhile) {
TEST(DebugStepFor) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3346,14 +3336,14 @@ TEST(DebugStepFor) {
// Looping 10 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(isolate, 10) };
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
foo->Call(env->Global(), argc, argv_10);
CHECK_EQ(23, break_point_hit_count);
// Looping 100 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(isolate, 100) };
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
foo->Call(env->Global(), argc, argv_100);
CHECK_EQ(203, break_point_hit_count);
@ -3365,8 +3355,7 @@ TEST(DebugStepFor) {
TEST(DebugStepForContinue) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3396,7 +3385,7 @@ TEST(DebugStepForContinue) {
// Looping 10 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(isolate, 10) };
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
result = foo->Call(env->Global(), argc, argv_10);
CHECK_EQ(5, result->Int32Value());
CHECK_EQ(52, break_point_hit_count);
@ -3404,7 +3393,7 @@ TEST(DebugStepForContinue) {
// Looping 100 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(isolate, 100) };
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
result = foo->Call(env->Global(), argc, argv_100);
CHECK_EQ(50, result->Int32Value());
CHECK_EQ(457, break_point_hit_count);
@ -3417,8 +3406,7 @@ TEST(DebugStepForContinue) {
TEST(DebugStepForBreak) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which steps and counts.
v8::Debug::SetDebugEventListener2(DebugEventStep);
@ -3449,7 +3437,7 @@ TEST(DebugStepForBreak) {
// Looping 10 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(isolate, 10) };
v8::Handle<v8::Value> argv_10[argc] = { v8::Number::New(10) };
result = foo->Call(env->Global(), argc, argv_10);
CHECK_EQ(9, result->Int32Value());
CHECK_EQ(55, break_point_hit_count);
@ -3457,7 +3445,7 @@ TEST(DebugStepForBreak) {
// Looping 100 times.
step_action = StepIn;
break_point_hit_count = 0;
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(isolate, 100) };
v8::Handle<v8::Value> argv_100[argc] = { v8::Number::New(100) };
result = foo->Call(env->Global(), argc, argv_100);
CHECK_EQ(99, result->Int32Value());
CHECK_EQ(505, break_point_hit_count);
@ -3532,7 +3520,7 @@ TEST(DebugStepWith) {
"}"
"foo()";
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "b"),
v8::Object::New(env->GetIsolate()));
v8::Object::New());
v8::Local<v8::Function> foo = CompileFunction(&env, src, "foo");
v8::Handle<v8::Value> result;
SetBreakPoint(foo, 8); // "var a = {};"
@ -3871,7 +3859,7 @@ TEST(PauseInScript) {
v8::ScriptOrigin origin(
v8::String::NewFromUtf8(env->GetIsolate(), script_name),
v8::Integer::New(env->GetIsolate(), 0));
v8::Integer::New(0));
v8::Handle<v8::Script> script = v8::Script::Compile(
v8::String::NewFromUtf8(env->GetIsolate(), src), &origin);
v8::Local<v8::Value> r = script->Run();
@ -4183,8 +4171,7 @@ TEST(DebugBreak) {
i::FLAG_verify_heap = true;
#endif
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HandleScope scope(env->GetIsolate());
// Register a debug event listener which sets the break flag and counts.
v8::Debug::SetDebugEventListener2(DebugEventBreak);
@ -4200,10 +4187,10 @@ TEST(DebugBreak) {
v8::Local<v8::Function> f3 = CompileFunction(&env, src, "f3");
// Call the function to make sure it is compiled.
v8::Handle<v8::Value> argv[] = { v8::Number::New(isolate, 1),
v8::Number::New(isolate, 1),
v8::Number::New(isolate, 1),
v8::Number::New(isolate, 1) };
v8::Handle<v8::Value> argv[] = { v8::Number::New(1),
v8::Number::New(1),
v8::Number::New(1),
v8::Number::New(1) };
// Call all functions to make sure that they are compiled.
f0->Call(env->Global(), 0, NULL);
@ -4307,21 +4294,20 @@ TEST(NoBreakWhenBootstrapping) {
static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 3);
result->Set(v8::Integer::New(info.GetIsolate(), 0),
result->Set(v8::Integer::New(0),
v8::String::NewFromUtf8(info.GetIsolate(), "a"));
result->Set(v8::Integer::New(info.GetIsolate(), 1),
result->Set(v8::Integer::New(1),
v8::String::NewFromUtf8(info.GetIsolate(), "b"));
result->Set(v8::Integer::New(info.GetIsolate(), 2),
result->Set(v8::Integer::New(2),
v8::String::NewFromUtf8(info.GetIsolate(), "c"));
info.GetReturnValue().Set(result);
}
static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Handle<v8::Array> result = v8::Array::New(isolate, 2);
result->Set(v8::Integer::New(isolate, 0), v8::Number::New(isolate, 1));
result->Set(v8::Integer::New(isolate, 1), v8::Number::New(isolate, 10));
v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2);
result->Set(v8::Integer::New(0), v8::Number::New(1));
result->Set(v8::Integer::New(1), v8::Number::New(10));
info.GetReturnValue().Set(result);
}
@ -4496,18 +4482,18 @@ TEST(HiddenPrototypePropertyMirror) {
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "x"),
v8::Number::New(isolate, 0));
v8::Number::New(0));
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "y"),
v8::Number::New(isolate, 1));
v8::Number::New(1));
v8::Handle<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "z"),
v8::Number::New(isolate, 2));
v8::Number::New(2));
v8::Handle<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
t3->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "u"),
v8::Number::New(isolate, 3));
v8::Number::New(3));
// Create object and set them on the global object.
v8::Handle<v8::Object> o0 = t0->GetFunction()->NewInstance();
@ -4685,7 +4671,7 @@ TEST(NoHiddenProperties) {
// Set a hidden property on the object.
obj->SetHiddenValue(
v8::String::NewFromUtf8(isolate, "v8::test-debug::a"),
v8::Int32::New(isolate, 11));
v8::Int32::New(11));
// Get mirror for the object with property getter.
CompileRun("var obj_mirror = debug.MakeMirror(obj);");
@ -4703,24 +4689,24 @@ TEST(NoHiddenProperties) {
// Object created by t0 will become hidden prototype of object 'obj'.
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "b"),
v8::Number::New(isolate, 2));
v8::Number::New(2));
t0->SetHiddenPrototype(true);
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(isolate, "c"),
v8::Number::New(isolate, 3));
v8::Number::New(3));
// Create proto objects, add hidden properties to them and set them on
// the global object.
v8::Handle<v8::Object> protoObj = t0->GetFunction()->NewInstance();
protoObj->SetHiddenValue(
v8::String::NewFromUtf8(isolate, "v8::test-debug::b"),
v8::Int32::New(isolate, 12));
v8::Int32::New(12));
env->Global()->Set(v8::String::NewFromUtf8(isolate, "protoObj"),
protoObj);
v8::Handle<v8::Object> grandProtoObj = t1->GetFunction()->NewInstance();
grandProtoObj->SetHiddenValue(
v8::String::NewFromUtf8(isolate, "v8::test-debug::c"),
v8::Int32::New(isolate, 13));
v8::Int32::New(13));
env->Global()->Set(
v8::String::NewFromUtf8(isolate, "grandProtoObj"),
grandProtoObj);
@ -5627,8 +5613,7 @@ TEST(CallFunctionInDebugger) {
// Calling a function through the debugger returns 0 frames if there are
// no JavaScript frames.
CHECK_EQ(v8::Integer::New(CcTest::isolate(), 0),
v8::Debug::Call(frame_count));
CHECK_EQ(v8::Integer::New(0), v8::Debug::Call(frame_count));
// Test that the number of frames can be retrieved.
v8::Script::Compile(
@ -5658,7 +5643,7 @@ TEST(CallFunctionInDebugger) {
// Test that the source line is correct when there is a line offset.
v8::ScriptOrigin origin(v8::String::NewFromUtf8(CcTest::isolate(), "test"),
v8::Integer::New(CcTest::isolate(), 7));
v8::Integer::New(7));
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine(7)"), &origin)
->Run();
@ -6459,9 +6444,7 @@ static void DebugEventDebugBreak(
if (!frame_function_name.IsEmpty()) {
// Get the name of the function.
const int argc = 2;
v8::Handle<v8::Value> argv[argc] = {
exec_state, v8::Integer::New(CcTest::isolate(), 0)
};
v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) };
v8::Handle<v8::Value> result = frame_function_name->Call(exec_state,
argc, argv);
if (result->IsUndefined()) {
@ -6877,8 +6860,8 @@ TEST(ProvisionalBreakpointOnLineOutOfRange) {
v8::ScriptOrigin origin(
v8::String::NewFromUtf8(env->GetIsolate(), resource_name),
v8::Integer::New(env->GetIsolate(), 10),
v8::Integer::New(env->GetIsolate(), 1));
v8::Integer::New(10),
v8::Integer::New(1));
// Compile a script whose first line number is greater than the breakpoints'
// lines.
v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script),
@ -7222,8 +7205,8 @@ static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
TEST(DebugEventContext) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
expected_callback_data = v8::Int32::New(2010);
expected_context = v8::Context::New(isolate);
expected_callback_data = v8::Int32::New(isolate, 2010);
v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
expected_callback_data);
v8::Context::Scope context_scope(expected_context);
@ -7320,9 +7303,7 @@ static void DebugEventBreakDeoptimize(
if (!frame_function_name.IsEmpty()) {
// Get the name of the function.
const int argc = 2;
v8::Handle<v8::Value> argv[argc] = {
exec_state, v8::Integer::New(CcTest::isolate(), 0)
};
v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) };
v8::Handle<v8::Value> result =
frame_function_name->Call(exec_state, argc, argv);
if (!result->IsUndefined()) {
@ -7386,9 +7367,7 @@ static void DebugEventBreakWithOptimizedStack(
if (!frame_function_name.IsEmpty()) {
for (int i = 0; i < 2; i++) {
const int argc = 2;
v8::Handle<v8::Value> argv[argc] = {
exec_state, v8::Integer::New(isolate, i)
};
v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(i) };
// Get the name of the function in frame i.
v8::Handle<v8::Value> result =
frame_function_name->Call(exec_state, argc, argv);

View File

@ -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(isolate, value);
return v8::Integer::New(value, isolate);
}
static v8::Handle<v8::Value> Convert(float value, v8::Isolate* isolate) {
return v8::Number::New(isolate, value);
static v8::Handle<v8::Value> Convert(float 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);
static v8::Handle<v8::Value> Convert(double value, v8::Isolate*) {
return v8::Number::New(value);
}
@ -277,12 +277,10 @@ 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(helper.isolate_, 0));
VerifyRead(descriptor, internal_field, array, v8::Integer::New(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(helper.isolate_, expected));
VerifyRead(descriptor, internal_field, array, v8::Integer::New(expected));
}

View File

@ -96,8 +96,6 @@ 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_;
@ -246,7 +244,7 @@ TEST(Unknown) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
{ DeclarationContext context;
@ -280,7 +278,7 @@ TEST(Unknown) {
class PresentPropertyContext: public DeclarationContext {
protected:
virtual v8::Handle<Integer> Query(Local<String> key) {
return Integer::New(isolate(), v8::None);
return Integer::New(v8::None);
}
};
@ -302,7 +300,7 @@ TEST(Present) {
1, // access
1, // initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
{ PresentPropertyContext context;
@ -326,7 +324,7 @@ TEST(Present) {
1, // access
1, // initialization
1, // (re-)declaration
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
}
@ -358,7 +356,7 @@ TEST(Absent) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(isolate, 0));
EXPECT_RESULT, Number::New(0));
}
{ AbsentPropertyContext context;
@ -418,7 +416,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(isolate(), v8::None);
return Integer::New(v8::None);
default:
CHECK(state_ == UNKNOWN);
break;
@ -449,7 +447,7 @@ TEST(Appearing) {
1, // access
2, // declaration + initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
{ AppearingPropertyContext context;
@ -504,7 +502,7 @@ class ReappearingPropertyContext: public DeclarationContext {
// Ignore the second declaration by returning
// that the property is already there.
state_ = INITIALIZE;
return Integer::New(isolate(), v8::None);
return Integer::New(v8::None);
case INITIALIZE:
// Force an initialization by returning that
// the property is absent. This will make sure
@ -541,12 +539,10 @@ 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(isolate(), v8::None);
return Integer::New(v8::None);
}
// Use the prototype as the holder for the interceptors.
@ -567,7 +563,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(CcTest::isolate(), 87));
EXPECT_RESULT, Number::New(87));
}
{ ExistsInPrototypeContext context;
@ -583,7 +579,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
{ ExistsInPrototypeContext context;
@ -599,7 +595,7 @@ TEST(ExistsInPrototype) {
0,
0,
0,
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
}
@ -645,7 +641,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(isolate(), v8::None);
return Integer::New(v8::None);
}
// Install the hidden prototype after the global object has been created.
@ -684,7 +680,7 @@ TEST(ExistsInHiddenPrototype) {
1, // access
1, // initialization
2, // declaration + initialization
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
{ ExistsInHiddenPrototypeContext context;
@ -710,7 +706,7 @@ TEST(ExistsInHiddenPrototype) {
0,
0,
1, // (re-)declaration
EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
EXPECT_RESULT, Number::New(0));
}
}
@ -763,41 +759,40 @@ class SimpleContext {
TEST(CrossScriptReferences) {
v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
HandleScope scope(CcTest::isolate());
{ SimpleContext context;
context.Check("var x = 1; x",
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("var x = 2; x",
EXPECT_RESULT, Number::New(isolate, 2));
EXPECT_RESULT, Number::New(2));
context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(isolate, 3));
EXPECT_RESULT, Number::New(3));
context.Check("const x = 4; x",
EXPECT_RESULT, Number::New(isolate, 4));
EXPECT_RESULT, Number::New(4));
context.Check("x = 5; x",
EXPECT_RESULT, Number::New(isolate, 5));
EXPECT_RESULT, Number::New(5));
context.Check("var x = 6; x",
EXPECT_RESULT, Number::New(isolate, 6));
EXPECT_RESULT, Number::New(6));
context.Check("this.x",
EXPECT_RESULT, Number::New(isolate, 6));
EXPECT_RESULT, Number::New(6));
context.Check("function x() { return 7 }; x()",
EXPECT_RESULT, Number::New(isolate, 7));
EXPECT_RESULT, Number::New(7));
}
{ SimpleContext context;
context.Check("const x = 1; x",
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("var x = 2; x", // assignment ignored
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("const x = 3; x",
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("x = 4; x", // assignment ignored
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("var x = 5; x", // assignment ignored
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("this.x",
EXPECT_RESULT, Number::New(isolate, 1));
EXPECT_RESULT, Number::New(1));
context.Check("function x() { return 7 }; x",
EXPECT_EXCEPTION);
}
@ -809,8 +804,7 @@ TEST(CrossScriptReferencesHarmony) {
i::FLAG_harmony_scoping = true;
i::FLAG_harmony_modules = true;
v8::Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
HandleScope scope(CcTest::isolate());
const char* decs[] = {
"var x = 1; x", "x", "this.x",
@ -823,14 +817,12 @@ TEST(CrossScriptReferencesHarmony) {
for (int i = 0; decs[i] != NULL; i += 3) {
SimpleContext context;
context.Check(decs[i], EXPECT_RESULT, Number::New(isolate, 1));
context.Check(decs[i+1], EXPECT_RESULT, Number::New(isolate, 1));
context.Check(decs[i], EXPECT_RESULT, Number::New(1));
context.Check(decs[i+1], EXPECT_RESULT, Number::New(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(isolate, 1));
}
if (i/3 < 2) context.Check(decs[i+2], EXPECT_RESULT, Number::New(1));
}
}
@ -862,14 +854,12 @@ 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(CcTest::isolate(), 1));
context.Check(firsts[i], EXPECT_RESULT, Number::New(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(CcTest::isolate(), 2));
i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2));
}
}
}

View File

@ -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(v8_isolate);
object->Set(i, v8::Integer::New(v8_isolate, i));
v8::Local<v8::Object> object = v8::Object::New();
object->Set(i, v8::Integer::New(i, v8_isolate));
// 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_isolate);
v8::Local<v8::Object> object = v8::Object::New();
v8::Eternal<v8::Object> eternal(v8_isolate, object);
CHECK(!eternal.IsEmpty());
CHECK(object == eternal.Get(v8_isolate));

View File

@ -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(CcTest::isolate());
v8::Handle<v8::Object> proto = v8::Object::New();
v8::Handle<v8::Object> global =
context->Global()->GetPrototype().As<v8::Object>();
proto->Set(var_name, v8_num(100));

View File

@ -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(isolate);
v8::Local<v8::Object> obj = v8::Object::New();
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(isolate_));
objects_[i].Reset(isolate_, v8::Object::New());
}
(*env)->Global()->Set(v8_str("root_object"),
v8::Local<v8::Value>::New(isolate_, objects_[0]));
@ -1821,8 +1821,7 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle());
v8::Persistent<v8::Object>* handle =
new v8::Persistent<v8::Object>(env->GetIsolate(),
v8::Object::New(env->GetIsolate()));
new v8::Persistent<v8::Object>(env->GetIsolate(), v8::Object::New());
handle->SetWeak(handle, PersistentHandleCallback);
CHECK(HasWeakGlobalHandle());
@ -1996,9 +1995,8 @@ TEST(ManyLocalsInSharedContext) {
TEST(AllocationSitesAreVisible) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
CompileRun(
"fun = function () { var a = [3, 2, 1]; return a; }\n"
"fun();");
@ -2041,12 +2039,9 @@ TEST(AllocationSitesAreVisible) {
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val);
// Verify the array is "a" in the code above.
CHECK_EQ(3, array->Length());
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)));
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)));
}

View File

@ -1790,7 +1790,7 @@ TEST(LeakNativeContextViaMap) {
"%OptimizeFunctionOnNextCall(f);"
"f();");
CHECK_EQ(42, res->Int32Value());
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(isolate, 0));
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(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(isolate, 0));
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(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(isolate, 0));
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(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(isolate, 0));
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(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(CcTest::isolate());
v8::Handle<v8::Object> obj = v8::Object::New();
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(CcTest::isolate(), 0));
CcTest::global()->Set(array_name, v8::Int32::New(0));
// First make sure we flip spaces
CcTest::heap()->CollectGarbage(NEW_SPACE);

View File

@ -332,30 +332,27 @@ static void ExpectRecords(v8::Isolate* isolate,
TEST(APITestBasicMutation) {
HarmonyIsolate isolate;
v8::Isolate* v8_isolate = isolate.GetIsolate();
HandleScope scope(v8_isolate);
LocalContext context(v8_isolate);
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
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(v8_isolate, "foo"),
Number::New(v8_isolate, 7));
obj->Set(1, Number::New(v8_isolate, 2));
obj->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(7));
obj->Set(1, Number::New(2));
// ForceSet should work just as well as Set
obj->ForceSet(String::NewFromUtf8(v8_isolate, "foo"),
Number::New(v8_isolate, 3));
obj->ForceSet(Number::New(v8_isolate, 1), Number::New(v8_isolate, 4));
obj->ForceSet(String::NewFromUtf8(isolate.GetIsolate(), "foo"),
Number::New(3));
obj->ForceSet(Number::New(1), Number::New(4));
// Setting an indexed element via the property setting method
obj->Set(Number::New(v8_isolate, 1), Number::New(v8_isolate, 5));
obj->Set(Number::New(1), Number::New(5));
// Setting with a non-String, non-uint32 key
obj->Set(Number::New(v8_isolate, 1.1),
Number::New(v8_isolate, 6), DontDelete);
obj->Delete(String::NewFromUtf8(v8_isolate, "foo"));
obj->Set(Number::New(1.1), Number::New(6), DontDelete);
obj->Delete(String::NewFromUtf8(isolate.GetIsolate(), "foo"));
obj->Delete(1);
obj->ForceDelete(Number::New(v8_isolate, 1.1));
obj->ForceDelete(Number::New(1.1));
// Force delivery
// TODO(adamk): Should the above set methods trigger delivery themselves?
@ -366,13 +363,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(v8_isolate, 7) },
{ obj, "update", "1", Number::New(v8_isolate, 2) },
{ obj, "update", "1", Number::New(v8_isolate, 4) },
{ obj, "update", "foo", Number::New(7) },
{ obj, "update", "1", Number::New(2) },
{ obj, "update", "1", Number::New(4) },
{ obj, "add", "1.1", Handle<Value>() },
{ 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) }
{ obj, "delete", "foo", Number::New(3) },
{ obj, "delete", "1", Number::New(5) },
{ obj, "delete", "1.1", Number::New(6) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
}
@ -380,18 +377,17 @@ TEST(APITestBasicMutation) {
TEST(HiddenPrototypeObservation) {
HarmonyIsolate isolate;
v8::Isolate* v8_isolate = isolate.GetIsolate();
HandleScope scope(v8_isolate);
LocalContext context(v8_isolate);
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(v8_isolate);
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
Handle<FunctionTemplate> tmpl = FunctionTemplate::New(isolate.GetIsolate());
tmpl->SetHiddenPrototype(true);
tmpl->InstanceTemplate()->Set(
String::NewFromUtf8(v8_isolate, "foo"), Number::New(v8_isolate, 75));
String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75));
Handle<Object> proto = tmpl->GetFunction()->NewInstance();
Handle<Object> obj = Object::New(v8_isolate);
Handle<Object> obj = Object::New();
obj->SetPrototype(proto);
context->Global()->Set(String::NewFromUtf8(v8_isolate, "obj"), obj);
context->Global()->Set(String::NewFromUtf8(v8_isolate, "proto"),
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"),
proto);
CompileRun(
"var records;"
@ -400,10 +396,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(v8_isolate, 75) }
{ obj, "update", "foo", Number::New(75) }
};
EXPECT_RECORDS(CompileRun("records"), expected_records);
obj->SetPrototype(Null(v8_isolate));
obj->SetPrototype(Null(isolate.GetIsolate()));
CompileRun("obj.foo = 43");
const RecordExpectation expected_records2[] = {
{ obj, "add", "foo", Handle<Value>() }
@ -565,8 +561,7 @@ TEST(NamedAccessCheck) {
{ instance, "add", "foo", Handle<Value>() },
{ instance, "update", "foo",
String::NewFromUtf8(isolate.GetIsolate(), "bar") },
{ instance, "reconfigure", "foo",
Number::New(isolate.GetIsolate(), 5) },
{ instance, "reconfigure", "foo", Number::New(5) },
{ instance, "add", "bar", Handle<Value>() },
{ obj_no_check, "add", "baz", Handle<Value>() },
};
@ -590,7 +585,7 @@ TEST(IndexedAccessCheck) {
g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 7));
IndexedAccessAllowUnlessBlocked, Number::New(7));
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
@ -617,7 +612,7 @@ TEST(IndexedAccessCheck) {
{ instance, "add", "7", Handle<Value>() },
{ instance, "update", "7",
String::NewFromUtf8(isolate.GetIsolate(), "foo") },
{ instance, "reconfigure", "7", Number::New(isolate.GetIsolate(), 5) },
{ instance, "reconfigure", "7", Number::New(5) },
{ instance, "add", "8", Handle<Value>() },
{ obj_no_check, "add", "42", Handle<Value>() }
};
@ -639,7 +634,7 @@ TEST(SpliceAccessCheck) {
g_access_block_type = ACCESS_GET;
Handle<Object> instance = CreateAccessCheckedObject(
isolate.GetIsolate(), NamedAccessAlwaysAllowed,
IndexedAccessAllowUnlessBlocked, Number::New(isolate.GetIsolate(), 1));
IndexedAccessAllowUnlessBlocked, Number::New(1));
CompileRun("var records = null;"
"obj[1] = 'foo';"
"obj.length = 2;"

View File

@ -960,8 +960,7 @@ TEST(ExternalShortStringAdd) {
v8::Local<v8::String> ascii_external_string =
v8::String::NewExternal(CcTest::isolate(), ascii_resource);
ascii_external_strings->Set(v8::Integer::New(CcTest::isolate(), i),
ascii_external_string);
ascii_external_strings->Set(v8::Integer::New(i), ascii_external_string);
uc16* non_ascii = zone.NewArray<uc16>(i + 1);
for (int j = 0; j < i; j++) {
non_ascii[j] = 0x1234;
@ -971,7 +970,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(CcTest::isolate(), i),
non_ascii_external_strings->Set(v8::Integer::New(i),
non_ascii_external_string);
}
@ -979,8 +978,7 @@ 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(CcTest::isolate(), kMaxLength));
global->Set(v8_str("max_length"), v8::Integer::New(kMaxLength));
// Add short external ascii and non-ascii strings checking the result.
static const char* source =

View File

@ -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(args.GetIsolate());
v8::Local<v8::Object> result = v8::Object::New();
result->Set(v8::String::NewFromUtf8(args.GetIsolate(), "x"),
v8::Integer::New(args.GetIsolate(), 42));
v8::Integer::New(42));
args.GetReturnValue().Set(result);
}