OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 v8::HandleScope scope(env->GetIsolate()); | 796 v8::HandleScope scope(env->GetIsolate()); |
797 v8::Handle<v8::Object> global = env->Global(); | 797 v8::Handle<v8::Object> global = env->Global(); |
798 global->Set(v8_str("pi"), v8_num(3.1415926)); | 798 global->Set(v8_str("pi"), v8_num(3.1415926)); |
799 Local<Value> pi = global->Get(v8_str("pi")); | 799 Local<Value> pi = global->Get(v8_str("pi")); |
800 CHECK_EQ(3.1415926, pi->NumberValue()); | 800 CHECK_EQ(3.1415926, pi->NumberValue()); |
801 } | 801 } |
802 | 802 |
803 | 803 |
804 static v8::Handle<Value> handle_call(const v8::Arguments& args) { | 804 static v8::Handle<Value> handle_call(const v8::Arguments& args) { |
805 ApiTestFuzzer::Fuzz(); | 805 ApiTestFuzzer::Fuzz(); |
| 806 args.GetReturnValue().Set(v8_str("bad value")); |
806 return v8_num(102); | 807 return v8_num(102); |
807 } | 808 } |
808 | 809 |
| 810 static v8::Handle<Value> handle_call_indirect(const v8::Arguments& args) { |
| 811 ApiTestFuzzer::Fuzz(); |
| 812 args.GetReturnValue().Set(v8_str("bad value")); |
| 813 args.GetReturnValue().Set(v8_num(102)); |
| 814 return v8::Handle<Value>(); |
| 815 } |
| 816 |
| 817 static void handle_callback(const v8::FunctionCallbackInfo<Value>& info) { |
| 818 ApiTestFuzzer::Fuzz(); |
| 819 info.GetReturnValue().Set(v8_str("bad value")); |
| 820 info.GetReturnValue().Set(v8_num(102)); |
| 821 } |
| 822 |
809 | 823 |
810 static v8::Handle<Value> construct_call(const v8::Arguments& args) { | 824 static v8::Handle<Value> construct_call(const v8::Arguments& args) { |
811 ApiTestFuzzer::Fuzz(); | 825 ApiTestFuzzer::Fuzz(); |
812 args.This()->Set(v8_str("x"), v8_num(1)); | 826 args.This()->Set(v8_str("x"), v8_num(1)); |
813 args.This()->Set(v8_str("y"), v8_num(2)); | 827 args.This()->Set(v8_str("y"), v8_num(2)); |
| 828 args.GetReturnValue().Set(v8_str("bad value")); |
814 return args.This(); | 829 return args.This(); |
815 } | 830 } |
816 | 831 |
817 static v8::Handle<Value> Return239(Local<String> name, const AccessorInfo&) { | 832 static v8::Handle<Value> construct_call_indirect(const v8::Arguments& args) { |
818 ApiTestFuzzer::Fuzz(); | 833 ApiTestFuzzer::Fuzz(); |
| 834 args.This()->Set(v8_str("x"), v8_num(1)); |
| 835 args.This()->Set(v8_str("y"), v8_num(2)); |
| 836 args.GetReturnValue().Set(v8_str("bad value")); |
| 837 args.GetReturnValue().Set(args.This()); |
| 838 return v8::Handle<Value>(); |
| 839 } |
| 840 |
| 841 static void construct_callback( |
| 842 const v8::FunctionCallbackInfo<Value>& info) { |
| 843 ApiTestFuzzer::Fuzz(); |
| 844 info.This()->Set(v8_str("x"), v8_num(1)); |
| 845 info.This()->Set(v8_str("y"), v8_num(2)); |
| 846 info.GetReturnValue().Set(v8_str("bad value")); |
| 847 info.GetReturnValue().Set(info.This()); |
| 848 } |
| 849 |
| 850 |
| 851 static v8::Handle<Value> Return239( |
| 852 Local<String> name, const AccessorInfo& info) { |
| 853 ApiTestFuzzer::Fuzz(); |
| 854 info.GetReturnValue().Set(v8_str("bad value")); |
819 return v8_num(239); | 855 return v8_num(239); |
820 } | 856 } |
821 | 857 |
| 858 static v8::Handle<Value> Return239Indirect( |
| 859 Local<String> name, const AccessorInfo& info) { |
| 860 ApiTestFuzzer::Fuzz(); |
| 861 Handle<Value> value = v8_num(239); |
| 862 info.GetReturnValue().Set(v8_str("bad value")); |
| 863 info.GetReturnValue().Set(value); |
| 864 return v8::Handle<Value>(); |
| 865 } |
822 | 866 |
823 THREADED_TEST(FunctionTemplate) { | 867 static void Return239Callback( |
824 LocalContext env; | 868 Local<String> name, const v8::PropertyCallbackInfo<Value>& info) { |
825 v8::HandleScope scope(env->GetIsolate()); | 869 ApiTestFuzzer::Fuzz(); |
| 870 info.GetReturnValue().Set(v8_str("bad value")); |
| 871 info.GetReturnValue().Set(v8_num(239)); |
| 872 } |
| 873 |
| 874 |
| 875 template<typename Handler> |
| 876 static void TestFunctionTemplateInitializer(LocalContext* env, |
| 877 Handler handler) { |
| 878 // Test constructor calls. |
826 { | 879 { |
827 Local<v8::FunctionTemplate> fun_templ = | 880 Local<v8::FunctionTemplate> fun_templ = |
828 v8::FunctionTemplate::New(handle_call); | 881 v8::FunctionTemplate::New(handler); |
829 Local<Function> fun = fun_templ->GetFunction(); | 882 Local<Function> fun = fun_templ->GetFunction(); |
830 env->Global()->Set(v8_str("obj"), fun); | 883 (*env)->Global()->Set(v8_str("obj"), fun); |
831 Local<Script> script = v8_compile("obj()"); | 884 Local<Script> script = v8_compile("obj()"); |
832 CHECK_EQ(102, script->Run()->Int32Value()); | 885 CHECK_EQ(102, script->Run()->Int32Value()); |
833 } | 886 } |
834 // Use SetCallHandler to initialize a function template, should work like the | 887 // Use SetCallHandler to initialize a function template, should work like the |
835 // previous one. | 888 // previous one. |
836 { | 889 { |
837 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); | 890 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); |
838 fun_templ->SetCallHandler(handle_call); | 891 fun_templ->SetCallHandler(handler); |
839 Local<Function> fun = fun_templ->GetFunction(); | 892 Local<Function> fun = fun_templ->GetFunction(); |
840 env->Global()->Set(v8_str("obj"), fun); | 893 (*env)->Global()->Set(v8_str("obj"), fun); |
841 Local<Script> script = v8_compile("obj()"); | 894 Local<Script> script = v8_compile("obj()"); |
842 CHECK_EQ(102, script->Run()->Int32Value()); | 895 CHECK_EQ(102, script->Run()->Int32Value()); |
843 } | 896 } |
844 // Test constructor calls. | |
845 { | |
846 Local<v8::FunctionTemplate> fun_templ = | |
847 v8::FunctionTemplate::New(construct_call); | |
848 fun_templ->SetClassName(v8_str("funky")); | |
849 fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), Return239); | |
850 Local<Function> fun = fun_templ->GetFunction(); | |
851 env->Global()->Set(v8_str("obj"), fun); | |
852 Local<Script> script = v8_compile("var s = new obj(); s.x"); | |
853 CHECK_EQ(1, script->Run()->Int32Value()); | |
854 | |
855 Local<Value> result = v8_compile("(new obj()).toString()")->Run(); | |
856 CHECK_EQ(v8_str("[object funky]"), result); | |
857 | |
858 result = v8_compile("(new obj()).m")->Run(); | |
859 CHECK_EQ(239, result->Int32Value()); | |
860 } | |
861 } | 897 } |
862 | 898 |
863 | 899 |
| 900 template<typename Constructor, typename Accessor> |
| 901 static void TestFunctionTemplateAccessor(LocalContext* env, |
| 902 Constructor constructor, |
| 903 Accessor accessor) { |
| 904 Local<v8::FunctionTemplate> fun_templ = |
| 905 v8::FunctionTemplate::New(construct_call); |
| 906 fun_templ->SetClassName(v8_str("funky")); |
| 907 fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), accessor); |
| 908 Local<Function> fun = fun_templ->GetFunction(); |
| 909 (*env)->Global()->Set(v8_str("obj"), fun); |
| 910 Local<Script> script = v8_compile("var s = new obj(); s.x"); |
| 911 CHECK_EQ(1, script->Run()->Int32Value()); |
| 912 Local<Value> result = v8_compile("(new obj()).toString()")->Run(); |
| 913 CHECK_EQ(v8_str("[object funky]"), result); |
| 914 result = v8_compile("(new obj()).m")->Run(); |
| 915 CHECK_EQ(239, result->Int32Value()); |
| 916 } |
| 917 |
| 918 |
| 919 THREADED_TEST(FunctionTemplate) { |
| 920 LocalContext env; |
| 921 v8::HandleScope scope(env->GetIsolate()); |
| 922 |
| 923 TestFunctionTemplateInitializer(&env, handle_call); |
| 924 TestFunctionTemplateInitializer(&env, handle_call_indirect); |
| 925 TestFunctionTemplateInitializer(&env, handle_callback); |
| 926 |
| 927 TestFunctionTemplateAccessor(&env, construct_call, Return239); |
| 928 TestFunctionTemplateAccessor(&env, |
| 929 construct_call_indirect, |
| 930 Return239Indirect); |
| 931 TestFunctionTemplateAccessor(&env, construct_callback, Return239Callback); |
| 932 } |
| 933 |
| 934 |
864 THREADED_TEST(FunctionTemplateSetLength) { | 935 THREADED_TEST(FunctionTemplateSetLength) { |
865 LocalContext env; | 936 LocalContext env; |
866 v8::HandleScope scope(env->GetIsolate()); | 937 v8::HandleScope scope(env->GetIsolate()); |
867 { | 938 { |
868 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New( | 939 Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New( |
869 handle_call, Handle<v8::Value>(), Handle<v8::Signature>(), 23); | 940 handle_call, Handle<v8::Value>(), Handle<v8::Signature>(), 23); |
870 Local<Function> fun = fun_templ->GetFunction(); | 941 Local<Function> fun = fun_templ->GetFunction(); |
871 env->Global()->Set(v8_str("obj"), fun); | 942 env->Global()->Set(v8_str("obj"), fun); |
872 Local<Script> script = v8_compile("obj.length"); | 943 Local<Script> script = v8_compile("obj.length"); |
873 CHECK_EQ(23, script->Run()->Int32Value()); | 944 CHECK_EQ(23, script->Run()->Int32Value()); |
(...skipping 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4198 CHECK_EQ(v8_num(4), xValue); | 4269 CHECK_EQ(v8_num(4), xValue); |
4199 xValue.Dispose(context->GetIsolate()); | 4270 xValue.Dispose(context->GetIsolate()); |
4200 xValue = v8::Persistent<Value>(); | 4271 xValue = v8::Persistent<Value>(); |
4201 } | 4272 } |
4202 } | 4273 } |
4203 | 4274 |
4204 | 4275 |
4205 THREADED_TEST(NoAccessors) { | 4276 THREADED_TEST(NoAccessors) { |
4206 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 4277 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
4207 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 4278 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
4208 templ->SetAccessor(v8_str("x"), NULL, NULL, v8_str("donut")); | 4279 templ->SetAccessor(v8_str("x"), |
| 4280 static_cast<v8::AccessorGetter>(NULL), |
| 4281 NULL, |
| 4282 v8_str("donut")); |
4209 LocalContext context; | 4283 LocalContext context; |
4210 context->Global()->Set(v8_str("obj"), templ->NewInstance()); | 4284 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
4211 Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x")); | 4285 Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x")); |
4212 for (int i = 0; i < 10; i++) { | 4286 for (int i = 0; i < 10; i++) { |
4213 script->Run(); | 4287 script->Run(); |
4214 } | 4288 } |
4215 } | 4289 } |
4216 | 4290 |
4217 | 4291 |
4218 static v8::Handle<Value> XPropertyGetter(Local<String> property, | 4292 static v8::Handle<Value> XPropertyGetter(Local<String> property, |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4859 LocalContext env1; | 4933 LocalContext env1; |
4860 Local<Script> script1 = Script::Compile(source); | 4934 Local<Script> script1 = Script::Compile(source); |
4861 CHECK_EQ(8901.0, script1->Run()->NumberValue()); | 4935 CHECK_EQ(8901.0, script1->Run()->NumberValue()); |
4862 } | 4936 } |
4863 | 4937 |
4864 | 4938 |
4865 THREADED_TEST(UndetectableObject) { | 4939 THREADED_TEST(UndetectableObject) { |
4866 LocalContext env; | 4940 LocalContext env; |
4867 v8::HandleScope scope(env->GetIsolate()); | 4941 v8::HandleScope scope(env->GetIsolate()); |
4868 | 4942 |
4869 Local<v8::FunctionTemplate> desc = | 4943 Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); |
4870 v8::FunctionTemplate::New(0, v8::Handle<Value>()); | |
4871 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable | 4944 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
4872 | 4945 |
4873 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); | 4946 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
4874 env->Global()->Set(v8_str("undetectable"), obj); | 4947 env->Global()->Set(v8_str("undetectable"), obj); |
4875 | 4948 |
4876 ExpectString("undetectable.toString()", "[object Object]"); | 4949 ExpectString("undetectable.toString()", "[object Object]"); |
4877 ExpectString("typeof undetectable", "undefined"); | 4950 ExpectString("typeof undetectable", "undefined"); |
4878 ExpectString("typeof(undetectable)", "undefined"); | 4951 ExpectString("typeof(undetectable)", "undefined"); |
4879 ExpectBoolean("typeof undetectable == 'undefined'", true); | 4952 ExpectBoolean("typeof undetectable == 'undefined'", true); |
4880 ExpectBoolean("typeof undetectable == 'object'", false); | 4953 ExpectBoolean("typeof undetectable == 'object'", false); |
(...skipping 22 matching lines...) Expand all Loading... |
4903 ExpectBoolean("undetectable===undefined", false); | 4976 ExpectBoolean("undetectable===undefined", false); |
4904 ExpectBoolean("undefined===undetectable", false); | 4977 ExpectBoolean("undefined===undetectable", false); |
4905 ExpectBoolean("undetectable===undetectable", true); | 4978 ExpectBoolean("undetectable===undetectable", true); |
4906 } | 4979 } |
4907 | 4980 |
4908 | 4981 |
4909 THREADED_TEST(VoidLiteral) { | 4982 THREADED_TEST(VoidLiteral) { |
4910 LocalContext env; | 4983 LocalContext env; |
4911 v8::HandleScope scope(env->GetIsolate()); | 4984 v8::HandleScope scope(env->GetIsolate()); |
4912 | 4985 |
4913 Local<v8::FunctionTemplate> desc = | 4986 Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); |
4914 v8::FunctionTemplate::New(0, v8::Handle<Value>()); | |
4915 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable | 4987 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
4916 | 4988 |
4917 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); | 4989 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
4918 env->Global()->Set(v8_str("undetectable"), obj); | 4990 env->Global()->Set(v8_str("undetectable"), obj); |
4919 | 4991 |
4920 ExpectBoolean("undefined == void 0", true); | 4992 ExpectBoolean("undefined == void 0", true); |
4921 ExpectBoolean("undetectable == void 0", true); | 4993 ExpectBoolean("undetectable == void 0", true); |
4922 ExpectBoolean("null == void 0", true); | 4994 ExpectBoolean("null == void 0", true); |
4923 ExpectBoolean("undefined === void 0", true); | 4995 ExpectBoolean("undefined === void 0", true); |
4924 ExpectBoolean("undetectable === void 0", false); | 4996 ExpectBoolean("undetectable === void 0", false); |
(...skipping 22 matching lines...) Expand all Loading... |
4947 " }" | 5019 " }" |
4948 "})()", | 5020 "})()", |
4949 "ReferenceError: x is not defined"); | 5021 "ReferenceError: x is not defined"); |
4950 } | 5022 } |
4951 | 5023 |
4952 | 5024 |
4953 THREADED_TEST(ExtensibleOnUndetectable) { | 5025 THREADED_TEST(ExtensibleOnUndetectable) { |
4954 LocalContext env; | 5026 LocalContext env; |
4955 v8::HandleScope scope(env->GetIsolate()); | 5027 v8::HandleScope scope(env->GetIsolate()); |
4956 | 5028 |
4957 Local<v8::FunctionTemplate> desc = | 5029 Local<v8::FunctionTemplate> desc = v8::FunctionTemplate::New(); |
4958 v8::FunctionTemplate::New(0, v8::Handle<Value>()); | |
4959 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable | 5030 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
4960 | 5031 |
4961 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); | 5032 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
4962 env->Global()->Set(v8_str("undetectable"), obj); | 5033 env->Global()->Set(v8_str("undetectable"), obj); |
4963 | 5034 |
4964 Local<String> source = v8_str("undetectable.x = 42;" | 5035 Local<String> source = v8_str("undetectable.x = 42;" |
4965 "undetectable.x"); | 5036 "undetectable.x"); |
4966 | 5037 |
4967 Local<Script> script = Script::Compile(source); | 5038 Local<Script> script = Script::Compile(source); |
4968 | 5039 |
(...skipping 5085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10054 "function f() {" | 10125 "function f() {" |
10055 " for (var i = 1; i <= 5; i++) {" | 10126 " for (var i = 1; i <= 5; i++) {" |
10056 " try { nativeobject.callback(); } catch (e) { result += e; }" | 10127 " try { nativeobject.callback(); } catch (e) { result += e; }" |
10057 " }" | 10128 " }" |
10058 "}" | 10129 "}" |
10059 "f(); result;"); | 10130 "f(); result;"); |
10060 CHECK_EQ(v8_str("ggggg"), result); | 10131 CHECK_EQ(v8_str("ggggg"), result); |
10061 } | 10132 } |
10062 | 10133 |
10063 | 10134 |
10064 v8::Handle<v8::Value> DirectGetterCallback(Local<String> name, | 10135 static Handle<Value> DoDirectGetter() { |
10065 const v8::AccessorInfo& info) { | |
10066 if (++p_getter_count % 3 == 0) { | 10136 if (++p_getter_count % 3 == 0) { |
10067 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); | 10137 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
10068 GenerateSomeGarbage(); | 10138 GenerateSomeGarbage(); |
10069 } | 10139 } |
| 10140 return v8_str("Direct Getter Result"); |
| 10141 } |
| 10142 |
| 10143 static v8::Handle<v8::Value> DirectGetter(Local<String> name, |
| 10144 const v8::AccessorInfo& info) { |
| 10145 info.GetReturnValue().Set(v8_str("Garbage")); |
| 10146 return DoDirectGetter(); |
| 10147 } |
| 10148 |
| 10149 static v8::Handle<v8::Value> DirectGetterIndirect( |
| 10150 Local<String> name, |
| 10151 const v8::AccessorInfo& info) { |
| 10152 info.GetReturnValue().Set(DoDirectGetter()); |
10070 return v8::Handle<v8::Value>(); | 10153 return v8::Handle<v8::Value>(); |
10071 } | 10154 } |
10072 | 10155 |
| 10156 static void DirectGetterCallback( |
| 10157 Local<String> name, |
| 10158 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 10159 info.GetReturnValue().Set(DoDirectGetter()); |
| 10160 } |
10073 | 10161 |
10074 THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { | 10162 |
| 10163 template<typename Accessor> |
| 10164 static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) { |
10075 LocalContext context; | 10165 LocalContext context; |
10076 v8::HandleScope scope(context->GetIsolate()); | 10166 v8::HandleScope scope(context->GetIsolate()); |
10077 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); | 10167 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); |
10078 obj->SetAccessor(v8_str("p1"), DirectGetterCallback); | 10168 obj->SetAccessor(v8_str("p1"), accessor); |
10079 context->Global()->Set(v8_str("o1"), obj->NewInstance()); | 10169 context->Global()->Set(v8_str("o1"), obj->NewInstance()); |
10080 p_getter_count = 0; | 10170 p_getter_count = 0; |
10081 CompileRun( | 10171 v8::Handle<v8::Value> result = CompileRun( |
10082 "function f() {" | 10172 "function f() {" |
10083 " for (var i = 0; i < 30; i++) o1.p1;" | 10173 " for (var i = 0; i < 30; i++) o1.p1;" |
| 10174 " return o1.p1" |
10084 "}" | 10175 "}" |
10085 "f();"); | 10176 "f();"); |
10086 CHECK_EQ(30, p_getter_count); | 10177 CHECK_EQ(v8_str("Direct Getter Result"), result); |
| 10178 CHECK_EQ(31, p_getter_count); |
| 10179 } |
| 10180 |
| 10181 THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { |
| 10182 LoadICFastApi_DirectCall_GCMoveStub(DirectGetter); |
| 10183 LoadICFastApi_DirectCall_GCMoveStub(DirectGetterIndirect); |
| 10184 LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); |
10087 } | 10185 } |
10088 | 10186 |
10089 | 10187 |
10090 v8::Handle<v8::Value> ThrowingDirectGetterCallback( | 10188 v8::Handle<v8::Value> ThrowingDirectGetterCallback( |
10091 Local<String> name, const v8::AccessorInfo& info) { | 10189 Local<String> name, const v8::AccessorInfo& info) { |
10092 return v8::ThrowException(v8_str("g")); | 10190 return v8::ThrowException(v8_str("g")); |
10093 } | 10191 } |
10094 | 10192 |
10095 | 10193 |
10096 THREADED_TEST(LoadICFastApi_DirectCall_Throw) { | 10194 THREADED_TEST(LoadICFastApi_DirectCall_Throw) { |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10755 "};" | 10853 "};" |
10756 "f();"); | 10854 "f();"); |
10757 CHECK_EQ(true, value->BooleanValue()); | 10855 CHECK_EQ(true, value->BooleanValue()); |
10758 } | 10856 } |
10759 | 10857 |
10760 | 10858 |
10761 // Test that we ignore null interceptors. | 10859 // Test that we ignore null interceptors. |
10762 THREADED_TEST(NullNamedInterceptor) { | 10860 THREADED_TEST(NullNamedInterceptor) { |
10763 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 10861 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
10764 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); | 10862 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); |
10765 templ->SetNamedPropertyHandler(0); | 10863 templ->SetNamedPropertyHandler(static_cast<v8::NamedPropertyGetter>(0)); |
10766 LocalContext context; | 10864 LocalContext context; |
10767 templ->Set("x", v8_num(42)); | 10865 templ->Set("x", v8_num(42)); |
10768 v8::Handle<v8::Object> obj = templ->NewInstance(); | 10866 v8::Handle<v8::Object> obj = templ->NewInstance(); |
10769 context->Global()->Set(v8_str("obj"), obj); | 10867 context->Global()->Set(v8_str("obj"), obj); |
10770 v8::Handle<Value> value = CompileRun("obj.x"); | 10868 v8::Handle<Value> value = CompileRun("obj.x"); |
10771 CHECK(value->IsInt32()); | 10869 CHECK(value->IsInt32()); |
10772 CHECK_EQ(42, value->Int32Value()); | 10870 CHECK_EQ(42, value->Int32Value()); |
10773 } | 10871 } |
10774 | 10872 |
10775 | 10873 |
10776 // Test that we ignore null interceptors. | 10874 // Test that we ignore null interceptors. |
10777 THREADED_TEST(NullIndexedInterceptor) { | 10875 THREADED_TEST(NullIndexedInterceptor) { |
10778 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 10876 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
10779 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); | 10877 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); |
10780 templ->SetIndexedPropertyHandler(0); | 10878 templ->SetIndexedPropertyHandler(static_cast<v8::IndexedPropertyGetter>(0)); |
10781 LocalContext context; | 10879 LocalContext context; |
10782 templ->Set("42", v8_num(42)); | 10880 templ->Set("42", v8_num(42)); |
10783 v8::Handle<v8::Object> obj = templ->NewInstance(); | 10881 v8::Handle<v8::Object> obj = templ->NewInstance(); |
10784 context->Global()->Set(v8_str("obj"), obj); | 10882 context->Global()->Set(v8_str("obj"), obj); |
10785 v8::Handle<Value> value = CompileRun("obj[42]"); | 10883 v8::Handle<Value> value = CompileRun("obj[42]"); |
10786 CHECK(value->IsInt32()); | 10884 CHECK(value->IsInt32()); |
10787 CHECK_EQ(42, value->Int32Value()); | 10885 CHECK_EQ(42, value->Int32Value()); |
10788 } | 10886 } |
10789 | 10887 |
10790 | 10888 |
(...skipping 7603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18394 i::Semaphore* sem_; | 18492 i::Semaphore* sem_; |
18395 volatile int sem_value_; | 18493 volatile int sem_value_; |
18396 }; | 18494 }; |
18397 | 18495 |
18398 | 18496 |
18399 THREADED_TEST(SemaphoreInterruption) { | 18497 THREADED_TEST(SemaphoreInterruption) { |
18400 ThreadInterruptTest().RunTest(); | 18498 ThreadInterruptTest().RunTest(); |
18401 } | 18499 } |
18402 | 18500 |
18403 #endif // WIN32 | 18501 #endif // WIN32 |
OLD | NEW |