diff options
Diffstat (limited to 'deps/v8/test/cctest')
-rw-r--r-- | deps/v8/test/cctest/cctest.cc | 2 | ||||
-rw-r--r-- | deps/v8/test/cctest/cctest.gyp | 1 | ||||
-rw-r--r-- | deps/v8/test/cctest/cctest.status | 13 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-api.cc | 447 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-assembler-arm.cc | 9 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-compare-nil-ic-stub.cc | 86 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-conversions.cc | 19 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-cpu-profiler.cc | 74 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-debug.cc | 10 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-deoptimization.cc | 4 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-disasm-arm.cc | 2 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-heap-profiler.cc | 20 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-heap.cc | 7 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-lockers.cc | 2 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-mark-compact.cc | 11 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-parsing.cc | 3 |
16 files changed, 613 insertions, 97 deletions
diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 1cdaca440..5507ac6f3 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -98,6 +98,8 @@ v8::Isolate* CcTest::default_isolate_; int main(int argc, char* argv[]) { v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); + v8::internal::FLAG_harmony_array_buffer = true; + v8::internal::FLAG_harmony_typed_arrays = true; CcTest::set_default_isolate(v8::Isolate::GetCurrent()); CHECK(CcTest::default_isolate() != NULL); int tests_run = 0; diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index ecffeaa6f..0a91ed5e7 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -53,6 +53,7 @@ 'test-bignum.cc', 'test-bignum-dtoa.cc', 'test-circular-queue.cc', + 'test-compare-nil-ic-stub.cc', 'test-compiler.cc', 'test-conversions.cc', 'test-cpu-profiler.cc', diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index e5523b282..d1925dc25 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -39,8 +39,8 @@ test-api/ApplyInterruption: PASS || TIMEOUT # when snapshot is on, so I am marking it PASS || FAIL test-heap-profiler/HeapSnapshotsDiff: PASS || FAIL -# BUG(2628): This test is flaky and sometimes fails, but should not crash. -test-cpu-profiler/CollectCpuProfile: PASS || FAIL +# BUG(2628): These tests are flaky and sometimes fail, but should not crash. +test-cpu-profiler/SampleWhenFrameIsNotSetup: PASS || FAIL # These tests always fail. They are here to test test.py. If # they don't fail then test.py has failed. @@ -81,6 +81,15 @@ test-serialize/DeserializeAndRunScript2: SKIP test-serialize/DeserializeFromSecondSerialization: SKIP ############################################################################## +[ $arch == arm || $arch == mipsel ] + +# BUG(2628): Signal may come when pc is close to frame enter/exit code and on +# simulator the stack frame is not set up when it is expected to be for the pc +# value. +test-cpu-profiler/CollectCpuProfile: PASS || FAIL +test-cpu-profiler/SampleWhenFrameIsNotSetup: PASS || FAIL + +############################################################################## [ $arch == android_arm || $arch == android_ia32 ] # Tests crash as there is no /tmp directory in Android. diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index c9685f8f4..c8f67de0a 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -80,8 +80,8 @@ using ::v8::Value; static void ExpectString(const char* code, const char* expected) { Local<Value> result = CompileRun(code); CHECK(result->IsString()); - String::AsciiValue ascii(result); - CHECK_EQ(expected, *ascii); + String::Utf8Value utf8(result); + CHECK_EQ(expected, *utf8); } static void ExpectInt32(const char* code, int expected) { @@ -805,62 +805,299 @@ THREADED_TEST(GlobalProperties) { } +template<typename T> +static void CheckReturnValue(const T& t) { + v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); + i::Object** o = *reinterpret_cast<i::Object***>(&rv); + CHECK_EQ(t.GetIsolate(), v8::Isolate::GetCurrent()); + CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); +} + static v8::Handle<Value> handle_call(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); + args.GetReturnValue().Set(v8_str("bad value")); return v8_num(102); } +static v8::Handle<Value> handle_call_indirect(const v8::Arguments& args) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); + args.GetReturnValue().Set(v8_str("bad value")); + args.GetReturnValue().Set(v8_num(102)); + return v8::Handle<Value>(); +} + +static void handle_callback(const v8::FunctionCallbackInfo<Value>& info) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + info.GetReturnValue().Set(v8_str("bad value")); + info.GetReturnValue().Set(v8_num(102)); +} + static v8::Handle<Value> construct_call(const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); args.This()->Set(v8_str("x"), v8_num(1)); args.This()->Set(v8_str("y"), v8_num(2)); + args.GetReturnValue().Set(v8_str("bad value")); return args.This(); } -static v8::Handle<Value> Return239(Local<String> name, const AccessorInfo&) { +static v8::Handle<Value> construct_call_indirect(const v8::Arguments& args) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); + args.This()->Set(v8_str("x"), v8_num(1)); + args.This()->Set(v8_str("y"), v8_num(2)); + args.GetReturnValue().Set(v8_str("bad value")); + args.GetReturnValue().Set(args.This()); + return v8::Handle<Value>(); +} + +static void construct_callback( + const v8::FunctionCallbackInfo<Value>& info) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + info.This()->Set(v8_str("x"), v8_num(1)); + info.This()->Set(v8_str("y"), v8_num(2)); + info.GetReturnValue().Set(v8_str("bad value")); + info.GetReturnValue().Set(info.This()); +} + + +static v8::Handle<Value> Return239( + Local<String> name, const AccessorInfo& info) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + info.GetReturnValue().Set(v8_str("bad value")); return v8_num(239); } +static v8::Handle<Value> Return239Indirect( + Local<String> name, const AccessorInfo& info) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + Handle<Value> value = v8_num(239); + info.GetReturnValue().Set(v8_str("bad value")); + info.GetReturnValue().Set(value); + return v8::Handle<Value>(); +} -THREADED_TEST(FunctionTemplate) { - LocalContext env; - v8::HandleScope scope(env->GetIsolate()); +static void Return239Callback( + Local<String> name, const v8::PropertyCallbackInfo<Value>& info) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + info.GetReturnValue().Set(v8_str("bad value")); + info.GetReturnValue().Set(v8_num(239)); +} + + +template<typename Handler> +static void TestFunctionTemplateInitializer(Handler handler) { + // Test constructor calls. { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); Local<v8::FunctionTemplate> fun_templ = - v8::FunctionTemplate::New(handle_call); + v8::FunctionTemplate::New(handler); Local<Function> fun = fun_templ->GetFunction(); env->Global()->Set(v8_str("obj"), fun); Local<Script> script = v8_compile("obj()"); - CHECK_EQ(102, script->Run()->Int32Value()); + for (int i = 0; i < 30; i++) { + CHECK_EQ(102, script->Run()->Int32Value()); + } } // Use SetCallHandler to initialize a function template, should work like the // previous one. { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); - fun_templ->SetCallHandler(handle_call); + fun_templ->SetCallHandler(handler); Local<Function> fun = fun_templ->GetFunction(); env->Global()->Set(v8_str("obj"), fun); Local<Script> script = v8_compile("obj()"); - CHECK_EQ(102, script->Run()->Int32Value()); + for (int i = 0; i < 30; i++) { + CHECK_EQ(102, script->Run()->Int32Value()); + } } - // Test constructor calls. - { - Local<v8::FunctionTemplate> fun_templ = - v8::FunctionTemplate::New(construct_call); - fun_templ->SetClassName(v8_str("funky")); - fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), Return239); - Local<Function> fun = fun_templ->GetFunction(); - env->Global()->Set(v8_str("obj"), fun); - Local<Script> script = v8_compile("var s = new obj(); s.x"); +} + + +template<typename Constructor, typename Accessor> +static void TestFunctionTemplateAccessor(Constructor constructor, + Accessor accessor) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + Local<v8::FunctionTemplate> fun_templ = + v8::FunctionTemplate::New(constructor); + fun_templ->SetClassName(v8_str("funky")); + fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), accessor); + Local<Function> fun = fun_templ->GetFunction(); + env->Global()->Set(v8_str("obj"), fun); + Local<Value> result = v8_compile("(new obj()).toString()")->Run(); + CHECK_EQ(v8_str("[object funky]"), result); + CompileRun("var obj_instance = new obj();"); + Local<Script> script; + script = v8_compile("obj_instance.x"); + for (int i = 0; i < 30; i++) { CHECK_EQ(1, script->Run()->Int32Value()); + } + script = v8_compile("obj_instance.m"); + for (int i = 0; i < 30; i++) { + CHECK_EQ(239, script->Run()->Int32Value()); + } +} + - Local<Value> result = v8_compile("(new obj()).toString()")->Run(); - CHECK_EQ(v8_str("[object funky]"), result); +THREADED_TEST(FunctionTemplate) { + TestFunctionTemplateInitializer(handle_call); + TestFunctionTemplateInitializer(handle_call_indirect); + TestFunctionTemplateInitializer(handle_callback); - result = v8_compile("(new obj()).m")->Run(); - CHECK_EQ(239, result->Int32Value()); + TestFunctionTemplateAccessor(construct_call, Return239); + TestFunctionTemplateAccessor(construct_call_indirect, Return239Indirect); + TestFunctionTemplateAccessor(construct_callback, Return239Callback); +} + + +static v8::Handle<v8::Value> SimpleDirectCallback(const v8::Arguments& args) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); + args.GetReturnValue().Set(v8_str("bad value")); + return v8_num(51423 + args.Length()); +} + +static v8::Handle<v8::Value> SimpleIndirectCallback(const v8::Arguments& args) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); + args.GetReturnValue().Set(v8_num(51423 + args.Length())); + return v8::Handle<v8::Value>(); +} + +static void SimpleCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { + ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); + info.GetReturnValue().Set(v8_num(51423 + info.Length())); +} + + +template<typename Callback> +static void TestSimpleCallback(Callback callback) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New(); + object_template->Set("callback", v8::FunctionTemplate::New(callback)); + v8::Local<v8::Object> object = object_template->NewInstance(); + (*env)->Global()->Set(v8_str("callback_object"), object); + v8::Handle<v8::Script> script; + script = v8_compile("callback_object.callback(17)"); + for (int i = 0; i < 30; i++) { + CHECK_EQ(51424, script->Run()->Int32Value()); + } + script = v8_compile("callback_object.callback(17, 24)"); + for (int i = 0; i < 30; i++) { + CHECK_EQ(51425, script->Run()->Int32Value()); + } +} + + +THREADED_TEST(SimpleCallback) { + TestSimpleCallback(SimpleDirectCallback); + TestSimpleCallback(SimpleIndirectCallback); + TestSimpleCallback(SimpleCallback); +} + + +template<typename T> +void FastReturnValueCallback(const v8::FunctionCallbackInfo<v8::Value>& info); + +// constant return values +static const int32_t kFastReturnValueInt32 = 471; +static const uint32_t kFastReturnValueUint32 = 571; +static const double kFastReturnValueDouble = 2.7; +// variable return values +static bool fast_return_value_bool = false; +static bool fast_return_value_void_is_null = false; + +template<> +void FastReturnValueCallback<int32_t>( + const v8::FunctionCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(info.GetIsolate(), kFastReturnValueInt32); +} + +template<> +void FastReturnValueCallback<uint32_t>( + const v8::FunctionCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(info.GetIsolate(), kFastReturnValueUint32); +} + +template<> +void FastReturnValueCallback<double>( + const v8::FunctionCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(info.GetIsolate(), kFastReturnValueDouble); +} + +template<> +void FastReturnValueCallback<bool>( + const v8::FunctionCallbackInfo<v8::Value>& info) { + info.GetReturnValue().Set(info.GetIsolate(), fast_return_value_bool); +} + +template<> +void FastReturnValueCallback<void>( + const v8::FunctionCallbackInfo<v8::Value>& info) { + if (fast_return_value_void_is_null) { + info.GetReturnValue().SetNull(info.GetIsolate()); + } else { + info.GetReturnValue().SetUndefined(info.GetIsolate()); + } +} + +template<typename T> +Handle<Value> TestFastReturnValues() { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New(); + v8::FunctionCallback callback = &FastReturnValueCallback<T>; + object_template->Set("callback", v8::FunctionTemplate::New(callback)); + v8::Local<v8::Object> object = object_template->NewInstance(); + (*env)->Global()->Set(v8_str("callback_object"), object); + return scope.Close(CompileRun("callback_object.callback()")); +} + +THREADED_TEST(FastReturnValues) { + v8::HandleScope scope(v8::Isolate::GetCurrent()); + v8::Handle<v8::Value> value; + // check int_32 + value = TestFastReturnValues<int32_t>(); + CHECK(value->IsInt32()); + CHECK_EQ(kFastReturnValueInt32, value->Int32Value()); + // check uint32_t + value = TestFastReturnValues<uint32_t>(); + CHECK(value->IsInt32()); + CHECK_EQ(kFastReturnValueUint32, value->Int32Value()); + // check double + value = TestFastReturnValues<double>(); + CHECK(value->IsNumber()); + CHECK_EQ(kFastReturnValueDouble, value->ToNumber()->Value()); + // check bool values + for (int i = 0; i < 2; i++) { + fast_return_value_bool = i == 0; + value = TestFastReturnValues<bool>(); + CHECK(value->IsBoolean()); + CHECK_EQ(fast_return_value_bool, value->ToBoolean()->Value()); + } + // check oddballs + for (int i = 0; i < 2; i++) { + fast_return_value_void_is_null = i == 0; + value = TestFastReturnValues<void>(); + if (fast_return_value_void_is_null) { + CHECK(value->IsNull()); + } else { + CHECK(value->IsUndefined()); + } } } @@ -1440,8 +1677,8 @@ Handle<Value> EmptyInterceptorSetter(Local<String> name, Handle<Value> InterceptorGetter(Local<String> name, const AccessorInfo& info) { // Intercept names that start with 'interceptor_'. - String::AsciiValue ascii(name); - char* name_str = *ascii; + String::Utf8Value utf8(name); + char* name_str = *utf8; char prefix[] = "interceptor_"; int i; for (i = 0; name_str[i] && prefix[i]; ++i) { @@ -1701,7 +1938,7 @@ THREADED_TEST(NamedPropertyHandlerGetter) { CHECK_EQ(echo_named_call_count, 1); const char* code = "var str = 'oddle'; obj[str] + obj.poddle;"; v8::Handle<Value> str = CompileRun(code); - String::AsciiValue value(str); + String::Utf8Value value(str); CHECK_EQ(*value, "oddlepoddle"); // Check default behavior CHECK_EQ(v8_compile("obj.flob = 10;")->Run()->Int32Value(), 10); @@ -2539,6 +2776,30 @@ THREADED_TEST(ResettingGlobalHandleToEmpty) { } +THREADED_TEST(ClearAndLeakGlobal) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::internal::GlobalHandles* global_handles = NULL; + int initial_handle_count = 0; + v8::Persistent<String> global; + { + v8::HandleScope scope(isolate); + Local<String> str = v8_str("str"); + global_handles = + reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); + initial_handle_count = global_handles->NumberOfGlobalHandles(); + global = v8::Persistent<String>::New(isolate, str); + } + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); + String* str = global.ClearAndLeak(); + CHECK(global.IsEmpty()); + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); + v8::Persistent<String>* new_global = + reinterpret_cast<v8::Persistent<String>*>(&str); + new_global->Dispose(); + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); +} + + THREADED_TEST(LocalHandle) { v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Local<String> local = v8::Local<String>::New(v8_str("str")); @@ -3162,7 +3423,7 @@ THREADED_TEST(ScriptException) { Local<Value> result = script->Run(); CHECK(result.IsEmpty()); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ(*exception_value, "panama!"); } @@ -3323,7 +3584,7 @@ THREADED_TEST(PropertyAttributes) { CompileRun("({ toString: function() { throw 'exception';} })"); CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception)); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ("exception", *exception_value); try_catch.Reset(); } @@ -3614,7 +3875,7 @@ THREADED_TEST(ConstructCall) { static void CheckUncle(v8::TryCatch* try_catch) { CHECK(try_catch->HasCaught()); - String::AsciiValue str_value(try_catch->Exception()); + String::Utf8Value str_value(try_catch->Exception()); CHECK_EQ(*str_value, "uncle?"); try_catch->Reset(); } @@ -3992,7 +4253,7 @@ THREADED_TEST(ExternalScriptException) { Local<Value> result = script->Run(); CHECK(result.IsEmpty()); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ("konto", *exception_value); } @@ -4364,7 +4625,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) { v8::TryCatch try_catch; result = script_define->Run(); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x"); } @@ -4409,7 +4670,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) { v8::TryCatch try_catch; result = script_define->Run(); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x"); } @@ -4527,7 +4788,7 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) { CompileRun("Object.defineProperty(obj1, 'x'," "{get: function() { return 'func'; }})"); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x"); } { @@ -4535,7 +4796,7 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) { CompileRun("Object.defineProperty(obj2, 'x'," "{get: function() { return 'func'; }})"); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Exception()); + String::Utf8Value exception_value(try_catch.Exception()); CHECK_EQ(*exception_value, "TypeError: Cannot redefine property: x"); } } @@ -4625,7 +4886,10 @@ THREADED_TEST(SetterOnly) { THREADED_TEST(NoAccessors) { v8::HandleScope scope(v8::Isolate::GetCurrent()); Local<ObjectTemplate> templ = ObjectTemplate::New(); - templ->SetAccessor(v8_str("x"), NULL, NULL, v8_str("donut")); + templ->SetAccessor(v8_str("x"), + static_cast<v8::AccessorGetter>(NULL), + NULL, + v8_str("donut")); LocalContext context; context->Global()->Set(v8_str("obj"), templ->NewInstance()); Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x")); @@ -5284,8 +5548,7 @@ THREADED_TEST(UndetectableObject) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - Local<v8::FunctionTemplate> desc = - v8::FunctionTemplate::New(0, v8::Handle<Value>()); + Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable Local<v8::Object> obj = desc->GetFunction()->NewInstance(); @@ -5328,8 +5591,7 @@ THREADED_TEST(VoidLiteral) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - Local<v8::FunctionTemplate> desc = - v8::FunctionTemplate::New(0, v8::Handle<Value>()); + Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable Local<v8::Object> obj = desc->GetFunction()->NewInstance(); @@ -5372,8 +5634,7 @@ THREADED_TEST(ExtensibleOnUndetectable) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); - Local<v8::FunctionTemplate> desc = - v8::FunctionTemplate::New(0, v8::Handle<Value>()); + Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable Local<v8::Object> obj = desc->GetFunction()->NewInstance(); @@ -7162,10 +7423,10 @@ static void ExceptionInNativeScriptTestListener(v8::Handle<v8::Message> message, v8::Handle<Value>) { v8::Handle<v8::Value> name_val = message->GetScriptResourceName(); CHECK(!name_val.IsEmpty() && name_val->IsString()); - v8::String::AsciiValue name(message->GetScriptResourceName()); + v8::String::Utf8Value name(message->GetScriptResourceName()); CHECK_EQ(script_resource_name, *name); CHECK_EQ(3, message->GetLineNumber()); - v8::String::AsciiValue source_line(message->GetSourceLine()); + v8::String::Utf8Value source_line(message->GetSourceLine()); CHECK_EQ(" new o.foo();", *source_line); } @@ -9024,7 +9285,7 @@ THREADED_TEST(ConstructorForObject) { "(function() { var o = new obj('tipli'); return o.a; })()"); CHECK(!try_catch.HasCaught()); CHECK(value->IsString()); - String::AsciiValue string_value1(value->ToString()); + String::Utf8Value string_value1(value->ToString()); CHECK_EQ("tipli", *string_value1); Local<Value> args2[] = { v8_str("tipli") }; @@ -9034,7 +9295,7 @@ THREADED_TEST(ConstructorForObject) { value = object2->Get(v8_str("a")); CHECK(!try_catch.HasCaught()); CHECK(value->IsString()); - String::AsciiValue string_value2(value->ToString()); + String::Utf8Value string_value2(value->ToString()); CHECK_EQ("tipli", *string_value2); // Call the Object's constructor with a Boolean. @@ -9081,14 +9342,14 @@ THREADED_TEST(ConstructorForObject) { value = CompileRun("new obj2(28)"); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value1(try_catch.Exception()); + String::Utf8Value exception_value1(try_catch.Exception()); CHECK_EQ("TypeError: object is not a function", *exception_value1); try_catch.Reset(); Local<Value> args[] = { v8_num(29) }; value = instance->CallAsConstructor(1, args); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value2(try_catch.Exception()); + String::Utf8Value exception_value2(try_catch.Exception()); CHECK_EQ("TypeError: #<Object> is not a function", *exception_value2); try_catch.Reset(); } @@ -9104,14 +9365,14 @@ THREADED_TEST(ConstructorForObject) { value = CompileRun("new obj3(22)"); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value1(try_catch.Exception()); + String::Utf8Value exception_value1(try_catch.Exception()); CHECK_EQ("22", *exception_value1); try_catch.Reset(); Local<Value> args[] = { v8_num(23) }; value = instance->CallAsConstructor(1, args); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value2(try_catch.Exception()); + String::Utf8Value exception_value2(try_catch.Exception()); CHECK_EQ("23", *exception_value2); try_catch.Reset(); } @@ -9441,7 +9702,7 @@ THREADED_TEST(CallAsFunction) { value = CompileRun("obj2(28)"); CHECK(value.IsEmpty()); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value1(try_catch.Exception()); + String::Utf8Value exception_value1(try_catch.Exception()); CHECK_EQ("TypeError: Property 'obj2' of object #<Object> is not a function", *exception_value1); try_catch.Reset(); @@ -9452,7 +9713,7 @@ THREADED_TEST(CallAsFunction) { value = instance->CallAsFunction(instance, 1, args); CHECK(value.IsEmpty()); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value2(try_catch.Exception()); + String::Utf8Value exception_value2(try_catch.Exception()); CHECK_EQ("TypeError: [object Object] is not a function", *exception_value2); try_catch.Reset(); } @@ -9469,14 +9730,14 @@ THREADED_TEST(CallAsFunction) { // Catch the exception which is thrown by call-as-function handler value = CompileRun("obj3(22)"); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value1(try_catch.Exception()); + String::Utf8Value exception_value1(try_catch.Exception()); CHECK_EQ("22", *exception_value1); try_catch.Reset(); v8::Handle<Value> args[] = { v8_num(23) }; value = instance->CallAsFunction(instance, 1, args); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value2(try_catch.Exception()); + String::Utf8Value exception_value2(try_catch.Exception()); CHECK_EQ("23", *exception_value2); try_catch.Reset(); } @@ -10374,6 +10635,7 @@ THREADED_TEST(InterceptorCallICCachedFromGlobal) { static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, const AccessorInfo& info) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(info); int* call_count = reinterpret_cast<int*>(v8::External::Cast(*info.Data())->Value()); ++(*call_count); @@ -10386,6 +10648,7 @@ static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, static v8::Handle<Value> FastApiCallback_TrivialSignature( const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); v8::Isolate* isolate = v8::Isolate::GetCurrent(); CHECK_EQ(isolate, args.GetIsolate()); CHECK_EQ(args.This(), args.Holder()); @@ -10396,6 +10659,7 @@ static v8::Handle<Value> FastApiCallback_TrivialSignature( static v8::Handle<Value> FastApiCallback_SimpleSignature( const v8::Arguments& args) { ApiTestFuzzer::Fuzz(); + CheckReturnValue(args); v8::Isolate* isolate = v8::Isolate::GetCurrent(); CHECK_EQ(isolate, args.GetIsolate()); CHECK_EQ(args.This()->GetPrototype(), args.Holder()); @@ -10473,29 +10737,59 @@ THREADED_TEST(CallICFastApi_DirectCall_Throw) { } -v8::Handle<v8::Value> DirectGetterCallback(Local<String> name, - const v8::AccessorInfo& info) { +static Handle<Value> DoDirectGetter() { if (++p_getter_count % 3 == 0) { HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); GenerateSomeGarbage(); } + return v8_str("Direct Getter Result"); +} + +static v8::Handle<v8::Value> DirectGetter(Local<String> name, + const v8::AccessorInfo& info) { + CheckReturnValue(info); + info.GetReturnValue().Set(v8_str("Garbage")); + return DoDirectGetter(); +} + +static v8::Handle<v8::Value> DirectGetterIndirect( + Local<String> name, + const v8::AccessorInfo& info) { + CheckReturnValue(info); + info.GetReturnValue().Set(DoDirectGetter()); return v8::Handle<v8::Value>(); } +static void DirectGetterCallback( + Local<String> name, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CheckReturnValue(info); + info.GetReturnValue().Set(DoDirectGetter()); +} -THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { + +template<typename Accessor> +static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); - obj->SetAccessor(v8_str("p1"), DirectGetterCallback); + obj->SetAccessor(v8_str("p1"), accessor); context->Global()->Set(v8_str("o1"), obj->NewInstance()); p_getter_count = 0; - CompileRun( + v8::Handle<v8::Value> result = CompileRun( "function f() {" " for (var i = 0; i < 30; i++) o1.p1;" + " return o1.p1" "}" "f();"); - CHECK_EQ(30, p_getter_count); + CHECK_EQ(v8_str("Direct Getter Result"), result); + CHECK_EQ(31, p_getter_count); +} + +THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { + LoadICFastApi_DirectCall_GCMoveStub(DirectGetterIndirect); + LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); + LoadICFastApi_DirectCall_GCMoveStub(DirectGetter); } @@ -11174,7 +11468,7 @@ THREADED_TEST(InterceptorICSetterExceptions) { THREADED_TEST(NullNamedInterceptor) { v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); - templ->SetNamedPropertyHandler(0); + templ->SetNamedPropertyHandler(static_cast<v8::NamedPropertyGetter>(0)); LocalContext context; templ->Set("x", v8_num(42)); v8::Handle<v8::Object> obj = templ->NewInstance(); @@ -11189,7 +11483,7 @@ THREADED_TEST(NullNamedInterceptor) { THREADED_TEST(NullIndexedInterceptor) { v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); - templ->SetIndexedPropertyHandler(0); + templ->SetIndexedPropertyHandler(static_cast<v8::IndexedPropertyGetter>(0)); LocalContext context; templ->Set("42", v8_num(42)); v8::Handle<v8::Object> obj = templ->NewInstance(); @@ -12057,6 +12351,13 @@ static void RunLoopInNewEnv() { TEST(SetFunctionEntryHook) { + // FunctionEntryHook does not work well with experimental natives. + // Experimental natives are compiled during snapshot deserialization. + // This test breaks because InstallGetter (function from snapshot that + // only gets called from experimental natives) is compiled with entry hooks. + i::FLAG_harmony_typed_arrays = false; + i::FLAG_harmony_array_buffer = false; + i::FLAG_allow_natives_syntax = true; i::FLAG_use_inlining = false; @@ -12426,9 +12727,9 @@ static void CheckTryCatchSourceInfo(v8::Handle<v8::Script> script, CHECK_EQ(92, message->GetEndPosition()); CHECK_EQ(2, message->GetStartColumn()); CHECK_EQ(3, message->GetEndColumn()); - v8::String::AsciiValue line(message->GetSourceLine()); + v8::String::Utf8Value line(message->GetSourceLine()); CHECK_EQ(" throw 'nirk';", *line); - v8::String::AsciiValue name(message->GetScriptResourceName()); + v8::String::Utf8Value name(message->GetScriptResourceName()); CHECK_EQ(resource_name, *name); } @@ -12500,7 +12801,7 @@ THREADED_TEST(CallbackFunctionName) { context->Global()->Set(v8_str("obj"), t->NewInstance()); v8::Handle<v8::Value> value = CompileRun("obj.asdf.name"); CHECK(value->IsString()); - v8::String::AsciiValue name(value); + v8::String::Utf8Value name(value); CHECK_EQ("asdf", *name); } @@ -12972,7 +13273,7 @@ TEST(PreCompileInvalidPreparseDataError) { Local<String> source = String::New(script); Local<Script> compiled_script = Script::New(source, NULL, sd); CHECK(try_catch.HasCaught()); - String::AsciiValue exception_value(try_catch.Message()->Get()); + String::Utf8Value exception_value(try_catch.Message()->Get()); CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar", *exception_value); @@ -15852,9 +16153,12 @@ static uint32_t* ComputeStackLimit(uint32_t size) { } +// We need at least 165kB for an x64 debug build with clang and ASAN. +static const int stack_breathing_room = 256 * i::KB; + + TEST(SetResourceConstraints) { - static const int K = 1024; - uint32_t* set_limit = ComputeStackLimit(128 * K); + uint32_t* set_limit = ComputeStackLimit(stack_breathing_room); // Set stack limit. v8::ResourceConstraints constraints; @@ -15878,8 +16182,7 @@ TEST(SetResourceConstraintsInThread) { uint32_t* set_limit; { v8::Locker locker(CcTest::default_isolate()); - static const int K = 1024; - set_limit = ComputeStackLimit(128 * K); + set_limit = ComputeStackLimit(stack_breathing_room); // Set stack limit. v8::ResourceConstraints constraints; @@ -16241,11 +16544,11 @@ THREADED_TEST(ScriptOrigin) { env->Global()->Get(v8::String::New("g"))); v8::ScriptOrigin script_origin_f = f->GetScriptOrigin(); - CHECK_EQ("test", *v8::String::AsciiValue(script_origin_f.ResourceName())); + CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName())); CHECK_EQ(0, script_origin_f.ResourceLineOffset()->Int32Value()); v8::ScriptOrigin script_origin_g = g->GetScriptOrigin(); - CHECK_EQ("test", *v8::String::AsciiValue(script_origin_g.ResourceName())); + CHECK_EQ("test", *v8::String::Utf8Value(script_origin_g.ResourceName())); CHECK_EQ(0, script_origin_g.ResourceLineOffset()->Int32Value()); } @@ -16258,7 +16561,7 @@ THREADED_TEST(FunctionGetInferredName) { v8::Script::Compile(script, &origin)->Run(); v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( env->Global()->Get(v8::String::New("f"))); - CHECK_EQ("foo.bar.baz", *v8::String::AsciiValue(f->GetInferredName())); + CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName())); } THREADED_TEST(ScriptLineNumber) { diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 8cce08465..9acb90ab2 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -232,6 +232,7 @@ TEST(4) { double g; double h; int i; + double j; double m; double n; float x; @@ -294,6 +295,12 @@ TEST(4) { __ vcvt_f64_s32(d4, s31); __ vstr(d4, r4, OFFSET_OF(T, f)); + // Convert from fixed point to floating point. + __ mov(lr, Operand(1234)); + __ vmov(s8, lr); + __ vcvt_f64_s32(d4, 1); + __ vstr(d4, r4, OFFSET_OF(T, j)); + // Test vabs. __ vldr(d1, r4, OFFSET_OF(T, g)); __ vabs(d0, d1); @@ -332,6 +339,7 @@ TEST(4) { t.g = -2718.2818; t.h = 31415926.5; t.i = 0; + t.j = 0; t.m = -2718.2818; t.n = 123.456; t.x = 4.5; @@ -345,6 +353,7 @@ TEST(4) { CHECK_EQ(2, t.i); CHECK_EQ(2718.2818, t.g); CHECK_EQ(31415926.5, t.h); + CHECK_EQ(617.0, t.j); CHECK_EQ(42.0, t.f); CHECK_EQ(1.0, t.e); CHECK_EQ(1.000000059604644775390625, t.d); diff --git a/deps/v8/test/cctest/test-compare-nil-ic-stub.cc b/deps/v8/test/cctest/test-compare-nil-ic-stub.cc new file mode 100644 index 000000000..6177fde16 --- /dev/null +++ b/deps/v8/test/cctest/test-compare-nil-ic-stub.cc @@ -0,0 +1,86 @@ +// Copyright 2006-2013 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include <stdlib.h> + +#include "v8.h" +#include "cctest.h" +#include "code-stubs.h" + + +using namespace v8::internal; + +#define Types CompareNilICStub::Types + +TEST(TypeConstructors) { + Types types; + types.Add(CompareNilICStub::MONOMORPHIC_MAP); + Types types2(types); + CHECK_EQ(types.ToIntegral(), types2.ToIntegral()); +} + +TEST(ExternalICStateParsing) { + Types types; + types.Add(CompareNilICStub::UNDEFINED); + CompareNilICStub stub(kNonStrictEquality, kUndefinedValue, types); + CompareNilICStub stub2(stub.GetExtraICState()); + CHECK_EQ(stub.GetKind(), stub2.GetKind()); + CHECK_EQ(stub.GetNilValue(), stub2.GetNilValue()); + CHECK_EQ(stub.GetTypes().ToIntegral(), stub2.GetTypes().ToIntegral()); +} + +TEST(SettingTypes) { + Types state; + CHECK(state.IsEmpty()); + state.Add(CompareNilICStub::NULL_TYPE); + CHECK(!state.IsEmpty()); + CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); + CHECK(!state.Contains(CompareNilICStub::UNDEFINED)); + CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); + state.Add(CompareNilICStub::UNDEFINED); + CHECK(state.Contains(CompareNilICStub::UNDEFINED)); + CHECK(state.Contains(CompareNilICStub::NULL_TYPE)); + CHECK(!state.Contains(CompareNilICStub::UNDETECTABLE)); +} + +TEST(ClearTypes) { + Types state; + state.Add(CompareNilICStub::NULL_TYPE); + state.RemoveAll(); + CHECK(state.IsEmpty()); +} + +TEST(FullCompare) { + Types state; + CHECK(Types::FullCompare() != state); + state.Add(CompareNilICStub::UNDEFINED); + CHECK(state != Types::FullCompare()); + state.Add(CompareNilICStub::NULL_TYPE); + CHECK(state != Types::FullCompare()); + state.Add(CompareNilICStub::UNDETECTABLE); + CHECK(state == Types::FullCompare()); +} diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc index 651dc59d5..cf2092e4d 100644 --- a/deps/v8/test/cctest/test-conversions.cc +++ b/deps/v8/test/cctest/test-conversions.cc @@ -249,6 +249,7 @@ TEST(ExponentNumberStr) { CHECK_EQ(1e-106, StringToDouble(&uc, ".000001e-100", NO_FLAGS)); } + class OneBit1: public BitField<uint32_t, 0, 1> {}; class OneBit2: public BitField<uint32_t, 7, 1> {}; class EightBit1: public BitField<uint32_t, 0, 8> {}; @@ -286,3 +287,21 @@ TEST(BitField) { CHECK(!EightBit1::is_valid(256)); CHECK(!EightBit2::is_valid(256)); } + + +class UpperBits: public BitField64<int, 61, 3> {}; +class MiddleBits: public BitField64<int, 31, 2> {}; + +TEST(BitField64) { + uint64_t x; + + // Test most significant bits. + x = V8_2PART_UINT64_C(0xE0000000, 00000000); + CHECK(x == UpperBits::encode(7)); + CHECK_EQ(7, UpperBits::decode(x)); + + // Test the 32/64-bit boundary bits. + x = V8_2PART_UINT64_C(0x00000001, 80000000); + CHECK(x == MiddleBits::encode(3)); + CHECK_EQ(3, MiddleBits::decode(x)); +} diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index d73be1890..22af9e75b 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -122,7 +122,8 @@ TEST(CodeEvents) { 0, ToAddress(0x1000), 0x100, - ToAddress(0x10000)); + ToAddress(0x10000), + NULL); processor.CodeCreateEvent(i::Logger::BUILTIN_TAG, "bbb", ToAddress(0x1200), @@ -549,3 +550,74 @@ TEST(CollectCpuProfile) { cpu_profiler->DeleteAllCpuProfiles(); } + + + +static const char* cpu_profiler_test_source2 = "function loop() {}\n" +"function delay() { loop(); }\n" +"function start(count) {\n" +" var k = 0;\n" +" do {\n" +" delay();\n" +" } while (++k < count*100*1000);\n" +"}\n"; + +// Check that the profile tree doesn't contain unexpecte traces: +// - 'loop' can be called only by 'delay' +// - 'delay' may be called only by 'start' +// The profile will look like the following: +// +// [Top down]: +// 135 0 (root) [-1] #1 +// 121 72 start [-1] #3 +// 49 33 delay [-1] #4 +// 16 16 loop [-1] #5 +// 14 14 (program) [-1] #2 +TEST(SampleWhenFrameIsNotSetup) { + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + + v8::Script::Compile(v8::String::New(cpu_profiler_test_source2))->Run(); + v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( + env->Global()->Get(v8::String::New("start"))); + + v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); + v8::Local<v8::String> profile_name = v8::String::New("my_profile"); + + cpu_profiler->StartCpuProfiling(profile_name); + int32_t repeat_count = 100; +#if defined(USE_SIMULATOR) + // Simulators are much slower. + repeat_count = 1; +#endif + v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) }; + function->Call(env->Global(), ARRAY_SIZE(args), args); + const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name); + + CHECK_NE(NULL, profile); + // Dump collected profile to have a better diagnostic in case of failure. + reinterpret_cast<i::CpuProfile*>( + const_cast<v8::CpuProfile*>(profile))->Print(); + + const v8::CpuProfileNode* root = profile->GetTopDownRoot(); + + ScopedVector<v8::Handle<v8::String> > names(3); + names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName); + names[1] = v8::String::New(ProfileGenerator::kProgramEntryName); + names[2] = v8::String::New("start"); + CheckChildrenNames(root, names); + + const v8::CpuProfileNode* startNode = FindChild(root, "start"); + // On slow machines there may be no meaningfull samples at all, skip the + // check there. + if (startNode && startNode->GetChildrenCount() > 0) { + CHECK_EQ(1, startNode->GetChildrenCount()); + const v8::CpuProfileNode* delayNode = FindChild(startNode, "delay"); + if (delayNode->GetChildrenCount() > 0) { + CHECK_EQ(1, delayNode->GetChildrenCount()); + FindChild(delayNode, "loop"); + } + } + + cpu_profiler->DeleteAllCpuProfiles(); +} diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 1afe8901f..c4df73ebb 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -850,8 +850,8 @@ static void DebugEventEvaluate(v8::DebugEvent event, v8::Handle<v8::Value> result = evaluate_check_function->Call(exec_state, argc, argv); if (!result->IsTrue()) { - v8::String::AsciiValue ascii(checks[i].expected->ToString()); - V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *ascii); + v8::String::Utf8Value utf8(checks[i].expected->ToString()); + V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8); } } } @@ -923,7 +923,7 @@ static void DebugEventStepSequence(v8::DebugEvent event, v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, argc, argv); CHECK(result->IsString()); - v8::String::AsciiValue function_name(result->ToString()); + v8::String::Utf8Value function_name(result->ToString()); CHECK_EQ(1, StrLength(*function_name)); CHECK_EQ((*function_name)[0], expected_step_sequence[break_point_hit_count]); @@ -4285,7 +4285,7 @@ static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) { static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { - v8::String::AsciiValue n(name); + v8::String::Utf8Value n(name); if (strcmp(*n, "a") == 0) { return v8::String::New("AA"); } else if (strcmp(*n, "b") == 0) { @@ -7008,7 +7008,7 @@ v8::Handle<v8::Context> debugger_context; static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( v8::Local<v8::String> name, const v8::AccessorInfo& info) { - CHECK_EQ(0, strcmp(*v8::String::AsciiValue(name), "a")); + CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a")); v8::Handle<v8::Context> current = v8::Context::GetCurrent(); CHECK(current == debugee_context); CHECK(current != debugger_context); diff --git a/deps/v8/test/cctest/test-deoptimization.cc b/deps/v8/test/cctest/test-deoptimization.cc index 620f6fe1a..dfc27548b 100644 --- a/deps/v8/test/cctest/test-deoptimization.cc +++ b/deps/v8/test/cctest/test-deoptimization.cc @@ -376,8 +376,8 @@ TEST(DeoptimizeBinaryOperationADDString) { CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); v8::Handle<v8::Value> result = env->Global()->Get(v8_str("result")); CHECK(result->IsString()); - v8::String::AsciiValue ascii(result); - CHECK_EQ("a+an X", *ascii); + v8::String::Utf8Value utf8(result); + CHECK_EQ("a+an X", *utf8); CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(Isolate::Current())); } diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index 8cba75b8d..84f0d8630 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -578,6 +578,8 @@ TEST(Vfp) { "eeb80be0 vcvt.f64.s32 d0, s1"); COMPARE(vcvt_f32_s32(s0, s2), "eeb80ac1 vcvt.f32.s32 s0, s2"); + COMPARE(vcvt_f64_s32(d0, 1), + "eeba0bef vcvt.f64.s32 d0, d0, #1"); if (CpuFeatures::IsSupported(VFP32DREGS)) { COMPARE(vmov(d3, d27), diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index b2c9b7220..595a2069d 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -108,7 +108,7 @@ static const v8::HeapGraphNode* GetProperty(const v8::HeapGraphNode* node, const char* name) { for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { const v8::HeapGraphEdge* prop = node->GetChild(i); - v8::String::AsciiValue prop_name(prop->GetName()); + v8::String::Utf8Value prop_name(prop->GetName()); if (prop->GetType() == type && strcmp(name, *prop_name) == 0) return prop->GetToNode(); } @@ -121,7 +121,7 @@ static bool HasString(const v8::HeapGraphNode* node, const char* contents) { const v8::HeapGraphEdge* prop = node->GetChild(i); const v8::HeapGraphNode* node = prop->GetToNode(); if (node->GetType() == v8::HeapGraphNode::kString) { - v8::String::AsciiValue node_name(node->GetName()); + v8::String::Utf8Value node_name(node->GetName()); if (strcmp(contents, *node_name) == 0) return true; } } @@ -285,7 +285,7 @@ TEST(HeapSnapshotCodeObjects) { GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous"); CHECK_NE(NULL, anonymous); CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType()); - v8::String::AsciiValue anonymous_name(anonymous->GetName()); + v8::String::Utf8Value anonymous_name(anonymous->GetName()); CHECK_EQ("", *anonymous_name); // Find references to code. @@ -1079,16 +1079,16 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo { uint16_t class_id, v8::Handle<v8::Value> wrapper) { if (class_id == 1) { if (wrapper->IsString()) { - v8::String::AsciiValue ascii(wrapper); - if (strcmp(*ascii, "AAA") == 0) + v8::String::Utf8Value utf8(wrapper); + if (strcmp(*utf8, "AAA") == 0) return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100); - else if (strcmp(*ascii, "BBB") == 0) + else if (strcmp(*utf8, "BBB") == 0) return new TestRetainedObjectInfo(1, "aaa-group", "aaa", 100); } } else if (class_id == 2) { if (wrapper->IsString()) { - v8::String::AsciiValue ascii(wrapper); - if (strcmp(*ascii, "CCC") == 0) + v8::String::Utf8Value utf8(wrapper); + if (strcmp(*utf8, "CCC") == 0) return new TestRetainedObjectInfo(2, "ccc-group", "ccc"); } } @@ -1254,7 +1254,7 @@ TEST(HeapSnapshotImplicitReferences) { int implicit_targets_count = 0; for (int i = 0, count = obj1->GetChildrenCount(); i < count; ++i) { const v8::HeapGraphEdge* prop = obj1->GetChild(i); - v8::String::AsciiValue prop_name(prop->GetName()); + v8::String::Utf8Value prop_name(prop->GetName()); if (prop->GetType() == v8::HeapGraphEdge::kInternal && strcmp("native", *prop_name) == 0) { ++implicit_targets_count; @@ -1692,7 +1692,7 @@ TEST(AllStrongGcRootsHaveNames) { for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); - v8::String::AsciiValue name(edge->GetName()); + v8::String::Utf8Value name(edge->GetName()); CHECK(isalpha(**name)); } } diff --git a/deps/v8/test/cctest/test-heap.cc b/deps/v8/test/cctest/test-heap.cc index 0711454db..ca173c25a 100644 --- a/deps/v8/test/cctest/test-heap.cc +++ b/deps/v8/test/cctest/test-heap.cc @@ -2805,6 +2805,13 @@ TEST(Regress169209) { i::FLAG_stress_compaction = false; i::FLAG_allow_natives_syntax = true; i::FLAG_flush_code_incrementally = true; + + // Experimental natives are compiled during snapshot deserialization. + // This test breaks because heap layout changes in a way that closure + // is visited before shared function info. + i::FLAG_harmony_typed_arrays = false; + i::FLAG_harmony_array_buffer = false; + CcTest::InitializeVM(); Isolate* isolate = Isolate::Current(); Heap* heap = isolate->heap(); diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc index ca0f07313..5977f095c 100644 --- a/deps/v8/test/cctest/test-lockers.cc +++ b/deps/v8/test/cctest/test-lockers.cc @@ -648,7 +648,7 @@ TEST(Regress1433) { v8::Handle<String> source = v8::String::New("1+1"); v8::Handle<Script> script = v8::Script::Compile(source); v8::Handle<Value> result = script->Run(); - v8::String::AsciiValue ascii(result); + v8::String::Utf8Value utf8(result); } isolate->Dispose(); } diff --git a/deps/v8/test/cctest/test-mark-compact.cc b/deps/v8/test/cctest/test-mark-compact.cc index 2cb4646d5..dc21ac2e3 100644 --- a/deps/v8/test/cctest/test-mark-compact.cc +++ b/deps/v8/test/cctest/test-mark-compact.cc @@ -467,10 +467,17 @@ TEST(EmptyObjectGroups) { } +#if defined(__has_feature) +#if __has_feature(address_sanitizer) +#define V8_WITH_ASAN 1 +#endif +#endif + + // Here is a memory use test that uses /proc, and is therefore Linux-only. We // do not care how much memory the simulator uses, since it is only there for -// debugging purposes. -#if defined(__linux__) && !defined(USE_SIMULATOR) +// debugging purposes. Testing with ASAN doesn't make sense, either. +#if defined(__linux__) && !defined(USE_SIMULATOR) && !defined(V8_WITH_ASAN) static uintptr_t ReadLong(char* buffer, intptr_t* position, int base) { diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 05fea0bbb..170ec76a1 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -388,8 +388,7 @@ TEST(PreParseOverflow) { reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); size_t kProgramSize = 1024 * 1024; - i::SmartArrayPointer<char> program( - reinterpret_cast<char*>(malloc(kProgramSize + 1))); + i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1)); memset(*program, '(', kProgramSize); program[kProgramSize] = '\0'; |