Fix gcc-4.6 warnings.

BUG=v8:1806

Review URL: http://codereview.chromium.org/8386072

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9867 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
keuchel@chromium.org 2011-11-03 08:59:01 +00:00
parent 224bbad462
commit 80d1b898fb
7 changed files with 106 additions and 114 deletions

View File

@ -11218,18 +11218,14 @@ class ScopeIterator {
// Global code
CompilationInfo info(script);
info.MarkAsGlobal();
bool result = ParserApi::Parse(&info);
ASSERT(result);
result = Scope::Analyze(&info);
ASSERT(result);
CHECK(ParserApi::Parse(&info));
CHECK(Scope::Analyze(&info));
scope = info.function()->scope();
} else {
// Function code
CompilationInfo info(shared_info);
bool result = ParserApi::Parse(&info);
ASSERT(result);
result = Scope::Analyze(&info);
ASSERT(result);
CHECK(ParserApi::Parse(&info));
CHECK(Scope::Analyze(&info));
scope = info.function()->scope();
}

View File

@ -1189,9 +1189,9 @@ THREADED_TEST(GlobalPrototype) {
templ->Set("x", v8_num(200));
templ->SetAccessor(v8_str("m"), GetM);
LocalContext env(0, templ);
v8::Handle<v8::Object> obj = env->Global();
v8::Handle<Script> script = v8_compile("dummy()");
v8::Handle<Value> result = script->Run();
v8::Handle<v8::Object> obj(env->Global());
v8::Handle<Script> script(v8_compile("dummy()"));
v8::Handle<Value> result(script->Run());
CHECK_EQ(13.4, result->NumberValue());
CHECK_EQ(200, v8_compile("x")->Run()->Int32Value());
CHECK_EQ(876, v8_compile("m")->Run()->Int32Value());
@ -1765,7 +1765,7 @@ THREADED_TEST(DeepCrossLanguageRecursion) {
env->Global()->Set(v8_str("depth"), v8::Integer::New(0));
call_recursively_script = v8_compile("callScriptRecursively()");
v8::Handle<Value> result = call_recursively_script->Run();
v8::Handle<Value> result(call_recursively_script->Run());
call_recursively_script = v8::Handle<Script>();
env->Global()->Set(v8_str("depth"), v8::Integer::New(0));
@ -4384,7 +4384,7 @@ THREADED_TEST(ExtensibleOnUndetectable) {
source = v8_str("undetectable.y = 2000;");
script = Script::Compile(source);
Local<Value> result = script->Run();
Local<Value> result(script->Run());
ExpectBoolean("undetectable.y == undefined", true);
}
@ -4736,7 +4736,7 @@ THREADED_TEST(NativeFunctionDeclarationError) {
"native\nfunction foo();"));
const char* extension_names[] = { name };
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Handle<Context> context = Context::New(&extensions);
v8::Handle<Context> context(Context::New(&extensions));
ASSERT(context.IsEmpty());
}
@ -4750,7 +4750,7 @@ THREADED_TEST(NativeFunctionDeclarationErrorEscape) {
"nativ\\u0065 function foo();"));
const char* extension_names[] = { name };
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Handle<Context> context = Context::New(&extensions);
v8::Handle<Context> context(Context::New(&extensions));
ASSERT(context.IsEmpty());
}
@ -4917,7 +4917,7 @@ TEST(RegexpOutOfMemory) {
Local<Script> script =
Script::Compile(String::New(js_code_causing_huge_string_flattening));
last_location = NULL;
Local<Value> result = script->Run();
Local<Value> result(script->Run());
CHECK(false); // Should not return.
}
@ -5695,7 +5695,7 @@ THREADED_TEST(ErrorConstruction) {
v8::Handle<String> message = v8_str("message");
v8::Handle<Value> range_error = v8::Exception::RangeError(foo);
CHECK(range_error->IsObject());
v8::Handle<v8::Object> range_obj = range_error.As<v8::Object>();
v8::Handle<v8::Object> range_obj(range_error.As<v8::Object>());
CHECK(range_error.As<v8::Object>()->Get(message)->Equals(foo));
v8::Handle<Value> reference_error = v8::Exception::ReferenceError(foo);
CHECK(reference_error->IsObject());
@ -7265,7 +7265,7 @@ THREADED_TEST(CallKnownGlobalReceiver) {
// Create new environment reusing the global object.
LocalContext env(NULL, instance_template, global_object);
env->Global()->Set(v8_str("foo"), foo);
Local<Value> value = Script::Compile(v8_str("foo()"))->Run();
Local<Value> value(Script::Compile(v8_str("foo()"))->Run());
}
}
@ -7536,7 +7536,7 @@ THREADED_TEST(Constructor) {
Local<Function> cons = templ->GetFunction();
context->Global()->Set(v8_str("Fun"), cons);
Local<v8::Object> inst = cons->NewInstance();
i::Handle<i::JSObject> obj = v8::Utils::OpenHandle(*inst);
i::Handle<i::JSObject> obj(v8::Utils::OpenHandle(*inst));
Local<Value> value = CompileRun("(new Fun()).constructor === Fun");
CHECK(value->BooleanValue());
}
@ -8007,7 +8007,7 @@ THREADED_TEST(CallAsFunction) {
}
{ Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New();
Local<ObjectTemplate> instance_template = t->InstanceTemplate();
Local<ObjectTemplate> instance_template(t->InstanceTemplate());
Local<v8::Object> instance = t->GetFunction()->NewInstance();
context->Global()->Set(v8_str("obj2"), instance);
v8::TryCatch try_catch;
@ -8112,7 +8112,7 @@ static int Recurse(int depth, int iterations) {
v8::HandleScope scope;
if (depth == 0) return CountHandles();
for (int i = 0; i < iterations; i++) {
Local<v8::Number> n = v8::Integer::New(42);
Local<v8::Number> n(v8::Integer::New(42));
}
return Recurse(depth - 1, iterations);
}
@ -8126,7 +8126,7 @@ THREADED_TEST(HandleIteration) {
v8::HandleScope scope1;
CHECK_EQ(0, CountHandles());
for (int i = 0; i < kIterations; i++) {
Local<v8::Number> n = v8::Integer::New(42);
Local<v8::Number> n(v8::Integer::New(42));
CHECK_EQ(i + 1, CountHandles());
}
@ -8134,7 +8134,7 @@ THREADED_TEST(HandleIteration) {
{
v8::HandleScope scope2;
for (int j = 0; j < kIterations; j++) {
Local<v8::Number> n = v8::Integer::New(42);
Local<v8::Number> n(v8::Integer::New(42));
CHECK_EQ(j + 1 + kIterations, CountHandles());
}
}
@ -8637,10 +8637,10 @@ THREADED_TEST(InterceptorStoreIC) {
0, 0, 0, v8_str("data"));
LocalContext context;
context->Global()->Set(v8_str("o"), templ->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"for (var i = 0; i < 1000; i++) {"
" o.x = 42;"
"}");
"}"));
}
@ -9066,11 +9066,11 @@ THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"var result = 0;"
"for (var i = 0; i < 100; i++) {"
" result = o.method(41);"
"}");
"}"));
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(100, interceptor_call_count);
}
@ -9093,14 +9093,14 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
"var result = 0;"
"for (var i = 0; i < 100; i++) {"
" result = receiver.method(41);"
"}");
"}"));
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(100, interceptor_call_count);
}
@ -9123,7 +9123,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9135,7 +9135,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
" saved_result = result;"
" receiver = {method: function(x) { return x - 1 }};"
" }"
"}");
"}"));
CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
CHECK_GE(interceptor_call_count, 50);
@ -9159,7 +9159,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9171,7 +9171,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
" saved_result = result;"
" o.method = function(x) { return x - 1 };"
" }"
"}");
"}"));
CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
CHECK_GE(interceptor_call_count, 50);
@ -9196,7 +9196,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::TryCatch try_catch;
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9208,7 +9208,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
" saved_result = result;"
" receiver = 333;"
" }"
"}");
"}"));
CHECK(try_catch.HasCaught());
CHECK_EQ(v8_str("TypeError: Object 333 has no method 'method'"),
try_catch.Exception()->ToString());
@ -9235,7 +9235,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::TryCatch try_catch;
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9247,7 +9247,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
" saved_result = result;"
" receiver = {method: receiver.method};"
" }"
"}");
"}"));
CHECK(try_catch.HasCaught());
CHECK_EQ(v8_str("TypeError: Illegal invocation"),
try_catch.Exception()->ToString());
@ -9264,16 +9264,16 @@ THREADED_TEST(CallICFastApi_TrivialSignature) {
v8::Handle<v8::Signature>());
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
proto_templ->Set(v8_str("method"), method_templ);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"var result = 0;"
"for (var i = 0; i < 100; i++) {"
" result = o.method(41);"
"}");
"}"));
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9287,19 +9287,19 @@ THREADED_TEST(CallICFastApi_SimpleSignature) {
v8::Signature::New(fun_templ));
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
proto_templ->Set(v8_str("method"), method_templ);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
"var result = 0;"
"for (var i = 0; i < 100; i++) {"
" result = receiver.method(41);"
"}");
"}"));
CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9313,12 +9313,12 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
v8::Signature::New(fun_templ));
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
proto_templ->Set(v8_str("method"), method_templ);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9330,7 +9330,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
" saved_result = result;"
" receiver = {method: function(x) { return x - 1 }};"
" }"
"}");
"}"));
CHECK_EQ(40, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
@ -9344,13 +9344,13 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
v8::Signature::New(fun_templ));
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
proto_templ->Set(v8_str("method"), method_templ);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
v8::TryCatch try_catch;
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o.foo = 17;"
"var receiver = {};"
"receiver.__proto__ = o;"
@ -9362,7 +9362,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
" saved_result = result;"
" receiver = 333;"
" }"
"}");
"}"));
CHECK(try_catch.HasCaught());
CHECK_EQ(v8_str("TypeError: Object 333 has no method 'method'"),
try_catch.Exception()->ToString());
@ -9390,7 +9390,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChange1) {
templ->SetNamedPropertyHandler(NoBlockGetterX);
LocalContext context;
context->Global()->Set(v8_str("o"), templ->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"proto = new Object();"
"proto.y = function(x) { return x + 1; };"
"proto.z = function(x) { return x - 1; };"
@ -9400,7 +9400,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChange1) {
"for (var i = 0; i < 10; i++) {"
" if (i == 5) { method = 'z'; };"
" result += o[method](41);"
"}");
"}"));
CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9416,7 +9416,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChange2) {
context->Global()->Set(v8_str("proto1"), templ->NewInstance());
keyed_call_ic_function =
v8_compile("function f(x) { return x - 1; }; f")->Run();
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"o = new Object();"
"proto2 = new Object();"
"o.y = function(x) { return x + 1; };"
@ -9428,7 +9428,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChange2) {
"for (var i = 0; i < 10; i++) {"
" if (i == 5) { method = 'y'; };"
" result += o[method](41);"
"}");
"}"));
CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9441,7 +9441,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChangeOnGlobal) {
templ->SetNamedPropertyHandler(NoBlockGetterX);
LocalContext context;
context->Global()->Set(v8_str("o"), templ->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"function inc(x) { return x + 1; };"
"inc(1);"
"function dec(x) { return x - 1; };"
@ -9454,7 +9454,7 @@ THREADED_TEST(InterceptorKeyedCallICKeyChangeOnGlobal) {
"for (var i = 0; i < 10; i++) {"
" if (i == 5) { method = 'y'; };"
" result += o[method](41);"
"}");
"}"));
CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9467,7 +9467,7 @@ THREADED_TEST(InterceptorKeyedCallICFromGlobal) {
LocalContext context;
context->Global()->Set(v8_str("o"), templ_o->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"function len(x) { return x.length; };"
"o.__proto__ = this;"
"var m = 'parseFloat';"
@ -9478,7 +9478,7 @@ THREADED_TEST(InterceptorKeyedCallICFromGlobal) {
" saved_result = result;"
" };"
" result = o[m]('239');"
"}");
"}"));
CHECK_EQ(3, context->Global()->Get(v8_str("result"))->Int32Value());
CHECK_EQ(239, context->Global()->Get(v8_str("saved_result"))->Int32Value());
}
@ -9491,7 +9491,7 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeBefore) {
LocalContext context;
context->Global()->Set(v8_str("proto"), templ_o->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"var o = new Object();"
"o.__proto__ = proto;"
"o.method = function(x) { return x + 1; };"
@ -9500,7 +9500,7 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeBefore) {
"for (var i = 0; i < 10; i++) {"
" if (i == 5) { o.method = function(x) { return x - 1; }; };"
" result += o[m](41);"
"}");
"}"));
CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -9513,7 +9513,7 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) {
LocalContext context;
context->Global()->Set(v8_str("o"), templ_o->NewInstance());
v8::Handle<Value> value = CompileRun(
v8::Handle<Value> value(CompileRun(
"var proto = new Object();"
"o.__proto__ = proto;"
"proto.method = function(x) { return x + 1; };"
@ -9522,7 +9522,7 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) {
"for (var i = 0; i < 10; i++) {"
" if (i == 5) { proto.method = function(x) { return x - 1; }; };"
" result += o[m](41);"
"}");
"}"));
CHECK_EQ(42*5 + 40*5, context->Global()->Get(v8_str("result"))->Int32Value());
}
@ -10438,7 +10438,7 @@ THREADED_TEST(NestedHandleScopeAndContexts) {
v8::Persistent<Context> env = Context::New();
env->Enter();
v8::Handle<Value> value = NestedScope(env);
v8::Handle<String> str = value->ToString();
v8::Handle<String> str(value->ToString());
env->Exit();
env.Dispose();
}
@ -10446,7 +10446,7 @@ THREADED_TEST(NestedHandleScopeAndContexts) {
THREADED_TEST(ExternalAllocatedMemory) {
v8::HandleScope outer;
v8::Persistent<Context> env = Context::New();
v8::Persistent<Context> env(Context::New());
const int kSize = 1024*1024;
CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(kSize), kSize);
CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(-kSize), 0);
@ -10784,7 +10784,7 @@ THREADED_TEST(AccessControlRepeatedContextCreation) {
i::Handle<i::FunctionTemplateInfo> constructor(
i::FunctionTemplateInfo::cast(internal_template->constructor()));
CHECK(!constructor->access_check_info()->IsUndefined());
v8::Persistent<Context> context0 = Context::New(NULL, global_template);
v8::Persistent<Context> context0(Context::New(NULL, global_template));
CHECK(!constructor->access_check_info()->IsUndefined());
}
@ -12860,11 +12860,11 @@ static void ExternalArrayTestHelper(v8::ExternalArrayType array_type,
const int kLargeElementCount = kXSize * kYSize * 4;
ElementType* large_array_data =
static_cast<ElementType*>(malloc(kLargeElementCount * element_size));
i::Handle<ExternalArrayClass> large_array =
i::Handle<ExternalArrayClass> large_array(
i::Handle<ExternalArrayClass>::cast(
FACTORY->NewExternalArray(kLargeElementCount,
array_type,
array_data));
array_type,
array_data)));
v8::Handle<v8::Object> large_obj = v8::Object::New();
// Set the elements to be the external array.
large_obj->SetIndexedPropertiesToExternalArrayData(large_array_data,
@ -13263,8 +13263,8 @@ TEST(CaptureStackTrace) {
"}\n"
"var x;eval('new foo();');";
v8::Handle<v8::String> overview_src = v8::String::New(overview_source);
v8::Handle<Value> overview_result =
v8::Script::New(overview_src, origin)->Run();
v8::Handle<Value> overview_result(
v8::Script::New(overview_src, origin)->Run());
ASSERT(!overview_result.IsEmpty());
ASSERT(overview_result->IsObject());
@ -13284,7 +13284,7 @@ TEST(CaptureStackTrace) {
v8::ScriptOrigin detailed_origin(origin, line_offset, column_offset);
v8::Handle<v8::Script> detailed_script(
v8::Script::New(detailed_src, &detailed_origin));
v8::Handle<Value> detailed_result = detailed_script->Run();
v8::Handle<Value> detailed_result(detailed_script->Run());
ASSERT(!detailed_result.IsEmpty());
ASSERT(detailed_result->IsObject());
}
@ -13586,7 +13586,7 @@ THREADED_TEST(QuietSignalingNaNs) {
static v8::Handle<Value> SpaghettiIncident(const v8::Arguments& args) {
v8::HandleScope scope;
v8::TryCatch tc;
v8::Handle<v8::String> str = args[0]->ToString();
v8::Handle<v8::String> str(args[0]->ToString());
if (tc.HasCaught())
return tc.ReThrow();
return v8::Undefined();
@ -14849,7 +14849,7 @@ TEST(RegExp) {
// RegExps are objects on which you can set properties.
re->Set(v8_str("property"), v8::Integer::New(32));
v8::Handle<v8::Value> value = CompileRun("re.property");
v8::Handle<v8::Value> value(CompileRun("re.property"));
ASSERT_EQ(32, value->Int32Value());
v8::TryCatch try_catch;

View File

@ -270,8 +270,8 @@ TEST(UncaughtThrow) {
CHECK(!fun.is_null());
bool has_pending_exception;
Handle<JSObject> global(Isolate::Current()->context()->global());
Handle<Object> result =
Execution::Call(fun, global, 0, NULL, &has_pending_exception);
Handle<Object> result(
Execution::Call(fun, global, 0, NULL, &has_pending_exception));
CHECK(has_pending_exception);
CHECK_EQ(42.0, Isolate::Current()->pending_exception()->
ToObjectChecked()->Number());

View File

@ -856,7 +856,7 @@ static void DebugEventRemoveBreakPoint(v8::DebugEvent event,
if (event == v8::Break) {
break_point_hit_count++;
v8::Handle<v8::Function> fun = v8::Handle<v8::Function>::Cast(data);
v8::Handle<v8::Function> fun(v8::Handle<v8::Function>::Cast(data));
ClearBreakPoint(debug_event_remove_break_point);
}
}
@ -1447,8 +1447,8 @@ TEST(BreakPointSurviveGC) {
// Test IC store break point with garbage collection.
{
v8::Local<v8::Function> bar =
CompileFunction(&env, "function foo(){}", "foo");
v8::Local<v8::Function> bar(
CompileFunction(&env, "function foo(){}", "foo"));
foo = CompileFunction(&env, "function foo(){bar=0;}", "foo");
SetBreakPoint(foo, 0);
}
@ -1456,8 +1456,8 @@ TEST(BreakPointSurviveGC) {
// Test IC load break point with garbage collection.
{
v8::Local<v8::Function> bar =
CompileFunction(&env, "function foo(){}", "foo");
v8::Local<v8::Function> bar(
CompileFunction(&env, "function foo(){}", "foo"));
foo = CompileFunction(&env, "bar=1;function foo(){var x=bar;}", "foo");
SetBreakPoint(foo, 0);
}
@ -1465,8 +1465,8 @@ TEST(BreakPointSurviveGC) {
// Test IC call break point with garbage collection.
{
v8::Local<v8::Function> bar =
CompileFunction(&env, "function foo(){}", "foo");
v8::Local<v8::Function> bar(
CompileFunction(&env, "function foo(){}", "foo"));
foo = CompileFunction(&env,
"function bar(){};function foo(){bar();}",
"foo");
@ -1476,8 +1476,8 @@ TEST(BreakPointSurviveGC) {
// Test return break point with garbage collection.
{
v8::Local<v8::Function> bar =
CompileFunction(&env, "function foo(){}", "foo");
v8::Local<v8::Function> bar(
CompileFunction(&env, "function foo(){}", "foo"));
foo = CompileFunction(&env, "function foo(){}", "foo");
SetBreakPoint(foo, 0);
}
@ -1485,8 +1485,8 @@ TEST(BreakPointSurviveGC) {
// Test non IC break point with garbage collection.
{
v8::Local<v8::Function> bar =
CompileFunction(&env, "function foo(){}", "foo");
v8::Local<v8::Function> bar(
CompileFunction(&env, "function foo(){}", "foo"));
foo = CompileFunction(&env, "function foo(){var bar=0;}", "foo");
SetBreakPoint(foo, 0);
}
@ -3751,8 +3751,8 @@ TEST(BreakOnException) {
v8::internal::Isolate::Current()->TraceException(false);
// Create functions for testing break on exception.
v8::Local<v8::Function> throws =
CompileFunction(&env, "function throws(){throw 1;}", "throws");
v8::Local<v8::Function> throws(
CompileFunction(&env, "function throws(){throw 1;}", "throws"));
v8::Local<v8::Function> caught =
CompileFunction(&env,
"function caught(){try {throws();} catch(e) {};}",
@ -5547,10 +5547,10 @@ TEST(DebuggerUnload) {
v8::HandleScope scope;
// Get the test functions again.
v8::Local<v8::Function> foo =
v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
v8::Local<v8::Function> bar =
v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
v8::Local<v8::Function> foo(v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::New("foo"))));
v8::Local<v8::Function> bar(v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::New("foo"))));
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
@ -6027,7 +6027,7 @@ TEST(DebugGetLoadedScripts) {
EmptyExternalStringResource source_ext_str;
v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str);
v8::Handle<v8::Script> evil_script = v8::Script::Compile(source);
v8::Handle<v8::Script> evil_script(v8::Script::Compile(source));
Handle<i::ExternalTwoByteString> i_source(
i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source)));
// This situation can happen if source was an external string disposed
@ -6675,7 +6675,7 @@ static void BreakMessageHandler(const v8::Debug::Message& message) {
break_point_hit_count++;
v8::HandleScope scope;
v8::Handle<v8::String> json = message.GetJSON();
v8::Handle<v8::String> json(message.GetJSON());
SendContinueCommand();
} else if (message.IsEvent() && message.GetEvent() == v8::AfterCompile) {
@ -6686,7 +6686,7 @@ static void BreakMessageHandler(const v8::Debug::Message& message) {
isolate->stack_guard()->DebugBreak();
// Force serialization to trigger some internal JS execution.
v8::Handle<v8::String> json = message.GetJSON();
v8::Handle<v8::String> json(message.GetJSON());
// Restore previous state.
if (is_debug_break) {

View File

@ -237,7 +237,7 @@ TEST(DeoptimizeRecursive) {
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun);
Handle<v8::internal::JSFunction> f(v8::Utils::OpenHandle(*fun));
}

View File

@ -667,23 +667,23 @@ TEST(JSArray) {
Handle<JSObject> object = FACTORY->NewJSObject(function);
Handle<JSArray> array = Handle<JSArray>::cast(object);
// We just initialized the VM, no heap allocation failure yet.
Object* ok = array->Initialize(0)->ToObjectChecked();
array->Initialize(0)->ToObjectChecked();
// Set array length to 0.
ok = array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
array->SetElementsLength(Smi::FromInt(0))->ToObjectChecked();
CHECK_EQ(Smi::FromInt(0), array->length());
// Must be in fast mode.
CHECK(array->HasFastTypeElements());
// array[length] = name.
ok = array->SetElement(0, *name, kNonStrictMode, true)->ToObjectChecked();
array->SetElement(0, *name, kNonStrictMode, true)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(1), array->length());
CHECK_EQ(array->GetElement(0), *name);
// Set array length with larger than smi value.
Handle<Object> length =
FACTORY->NewNumberFromUint(static_cast<uint32_t>(Smi::kMaxValue) + 1);
ok = array->SetElementsLength(*length)->ToObjectChecked();
array->SetElementsLength(*length)->ToObjectChecked();
uint32_t int_length = 0;
CHECK(length->ToArrayIndex(&int_length));
@ -691,8 +691,7 @@ TEST(JSArray) {
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
ok = array->SetElement(
int_length, *name, kNonStrictMode, true)->ToObjectChecked();
array->SetElement(int_length, *name, kNonStrictMode, true)->ToObjectChecked();
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
@ -719,10 +718,8 @@ TEST(JSObjectCopy) {
obj->SetProperty(
*second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
Object* ok =
obj->SetElement(0, *first, kNonStrictMode, true)->ToObjectChecked();
ok = obj->SetElement(1, *second, kNonStrictMode, true)->ToObjectChecked();
obj->SetElement(0, *first, kNonStrictMode, true)->ToObjectChecked();
obj->SetElement(1, *second, kNonStrictMode, true)->ToObjectChecked();
// Make the clone.
Handle<JSObject> clone = Copy(obj);
@ -740,8 +737,8 @@ TEST(JSObjectCopy) {
clone->SetProperty(
*second, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
ok = clone->SetElement(0, *second, kNonStrictMode, true)->ToObjectChecked();
ok = clone->SetElement(1, *first, kNonStrictMode, true)->ToObjectChecked();
clone->SetElement(0, *second, kNonStrictMode, true)->ToObjectChecked();
clone->SetElement(1, *first, kNonStrictMode, true)->ToObjectChecked();
CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
CHECK_EQ(obj->GetElement(0), clone->GetElement(1));

View File

@ -229,7 +229,7 @@ TEST(Preparsing) {
CHECK_EQ(11, error_location.end_pos);
// Should not crash.
const char* message = pre_impl->BuildMessage();
i::Vector<const char*> args = pre_impl->BuildArgs();
i::Vector<const char*> args(pre_impl->BuildArgs());
CHECK_GT(strlen(message), 0);
}
@ -844,12 +844,11 @@ TEST(ScopePositions) {
int kSuffixLen = i::StrLength(source_data[i].outer_suffix);
int kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
int length;
length = i::OS::SNPrintF(program, "%s%s%s",
source_data[i].outer_prefix,
source_data[i].inner_source,
source_data[i].outer_suffix);
ASSERT(length == kProgramSize);
int length = i::OS::SNPrintF(program, "%s%s%s",
source_data[i].outer_prefix,
source_data[i].inner_source,
source_data[i].outer_suffix);
CHECK(length == kProgramSize);
// Parse program source.
i::Handle<i::String> source(