Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: test/cctest/test-api.cc

Issue 11885019: Removed deprecated functions from v8's external API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // We want to test our deprecated API entries, too.
29 #define V8_DISABLE_DEPRECATIONS 1
30
31 #include <limits.h> 28 #include <limits.h>
32 29
33 #ifndef WIN32 30 #ifndef WIN32
34 #include <signal.h> // kill 31 #include <signal.h> // kill
35 #include <unistd.h> // getpid 32 #include <unistd.h> // getpid
36 #endif // WIN32 33 #endif // WIN32
37 34
38 #include "v8.h" 35 #include "v8.h"
39 36
40 #include "api.h" 37 #include "api.h"
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 Local<Function> fun = fun_templ->GetFunction(); 877 Local<Function> fun = fun_templ->GetFunction();
881 env->Global()->Set(v8_str("obj"), fun); 878 env->Global()->Set(v8_str("obj"), fun);
882 Local<Script> script = v8_compile("obj.length"); 879 Local<Script> script = v8_compile("obj.length");
883 CHECK_EQ(0, script->Run()->Int32Value()); 880 CHECK_EQ(0, script->Run()->Int32Value());
884 } 881 }
885 } 882 }
886 883
887 884
888 static void* expected_ptr; 885 static void* expected_ptr;
889 static v8::Handle<v8::Value> callback(const v8::Arguments& args) { 886 static v8::Handle<v8::Value> callback(const v8::Arguments& args) {
890 void* ptr = v8::External::Unwrap(args.Data()); 887 void* ptr = v8::External::Cast(*args.Data())->Value();
891 CHECK_EQ(expected_ptr, ptr); 888 CHECK_EQ(expected_ptr, ptr);
892 return v8::True(); 889 return v8::True();
893 } 890 }
894 891
895 892
896 static void TestExternalPointerWrapping() { 893 static void TestExternalPointerWrapping() {
897 v8::HandleScope scope; 894 v8::HandleScope scope;
898 LocalContext env; 895 LocalContext env;
899 896
900 v8::Handle<v8::Value> data = v8::External::Wrap(expected_ptr); 897 v8::Handle<v8::Value> data = v8::External::New(expected_ptr);
901 898
902 v8::Handle<v8::Object> obj = v8::Object::New(); 899 v8::Handle<v8::Object> obj = v8::Object::New();
903 obj->Set(v8_str("func"), 900 obj->Set(v8_str("func"),
904 v8::FunctionTemplate::New(callback, data)->GetFunction()); 901 v8::FunctionTemplate::New(callback, data)->GetFunction());
905 env->Global()->Set(v8_str("obj"), obj); 902 env->Global()->Set(v8_str("obj"), obj);
906 903
907 CHECK(CompileRun( 904 CHECK(CompileRun(
908 "function foo() {\n" 905 "function foo() {\n"
909 " for (var i = 0; i < 13; i++) obj.func();\n" 906 " for (var i = 0; i < 13; i++) obj.func();\n"
910 "}\n" 907 "}\n"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 LocalContext env(NULL, global_template); 2015 LocalContext env(NULL, global_template);
2019 v8::Handle<v8::Object> global_proxy = env->Global(); 2016 v8::Handle<v8::Object> global_proxy = env->Global();
2020 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); 2017 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
2021 CHECK_EQ(1, global->InternalFieldCount()); 2018 CHECK_EQ(1, global->InternalFieldCount());
2022 CHECK(global->GetInternalField(0)->IsUndefined()); 2019 CHECK(global->GetInternalField(0)->IsUndefined());
2023 global->SetInternalField(0, v8_num(17)); 2020 global->SetInternalField(0, v8_num(17));
2024 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); 2021 CHECK_EQ(17, global->GetInternalField(0)->Int32Value());
2025 } 2022 }
2026 2023
2027 2024
2028 THREADED_TEST(InternalFieldsNativePointers) {
2029 v8::HandleScope scope;
2030 LocalContext env;
2031
2032 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
2033 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
2034 instance_templ->SetInternalFieldCount(1);
2035 Local<v8::Object> obj = templ->GetFunction()->NewInstance();
2036 CHECK_EQ(1, obj->InternalFieldCount());
2037 CHECK(obj->GetPointerFromInternalField(0) == NULL);
2038
2039 char* data = new char[100];
2040
2041 void* aligned = data;
2042 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1));
2043 void* unaligned = data + 1;
2044 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
2045
2046 // Check reading and writing aligned pointers.
2047 obj->SetPointerInInternalField(0, aligned);
2048 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2049 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
2050
2051 // Check reading and writing unaligned pointers.
2052 obj->SetPointerInInternalField(0, unaligned);
2053 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2054 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
2055
2056 delete[] data;
2057 }
2058
2059
2060 THREADED_TEST(InternalFieldsNativePointersAndExternal) {
2061 v8::HandleScope scope;
2062 LocalContext env;
2063
2064 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
2065 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
2066 instance_templ->SetInternalFieldCount(1);
2067 Local<v8::Object> obj = templ->GetFunction()->NewInstance();
2068 CHECK_EQ(1, obj->InternalFieldCount());
2069 CHECK(obj->GetPointerFromInternalField(0) == NULL);
2070
2071 char* data = new char[100];
2072
2073 void* aligned = data;
2074 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(aligned) & 0x1));
2075 void* unaligned = data + 1;
2076 CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
2077
2078 obj->SetPointerInInternalField(0, aligned);
2079 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2080 CHECK_EQ(aligned, v8::External::Unwrap(obj->GetInternalField(0)));
2081
2082 obj->SetPointerInInternalField(0, unaligned);
2083 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2084 CHECK_EQ(unaligned, v8::External::Unwrap(obj->GetInternalField(0)));
2085
2086 obj->SetInternalField(0, v8::External::Wrap(aligned));
2087 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2088 CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
2089
2090 obj->SetInternalField(0, v8::External::Wrap(unaligned));
2091 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2092 CHECK_EQ(unaligned, obj->GetPointerFromInternalField(0));
2093
2094 delete[] data;
2095 }
2096
2097
2098 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj, 2025 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj,
2099 void* value) { 2026 void* value) {
2100 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); 2027 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
2101 obj->SetPointerInInternalField(0, value); 2028 obj->SetAlignedPointerInInternalField(0, value);
2102 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 2029 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2103 CHECK_EQ(value, obj->GetPointerFromInternalField(0)); 2030 CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0));
2104 } 2031 }
2105 2032
2106 2033
2107 THREADED_TEST(InternalFieldsAlignedPointers) { 2034 THREADED_TEST(InternalFieldsAlignedPointers) {
2108 v8::HandleScope scope; 2035 v8::HandleScope scope;
2109 LocalContext env; 2036 LocalContext env;
2110 2037
2111 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(); 2038 Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
2112 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate(); 2039 Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
2113 instance_templ->SetInternalFieldCount(1); 2040 instance_templ->SetInternalFieldCount(1);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 env->Global()->Set(v8_str("ext"), ext); 2275 env->Global()->Set(v8_str("ext"), ext);
2349 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run(); 2276 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run();
2350 v8::Handle<v8::External> reext = reext_obj.As<v8::External>(); 2277 v8::Handle<v8::External> reext = reext_obj.As<v8::External>();
2351 int* ptr = static_cast<int*>(reext->Value()); 2278 int* ptr = static_cast<int*>(reext->Value());
2352 CHECK_EQ(x, 3); 2279 CHECK_EQ(x, 3);
2353 *ptr = 10; 2280 *ptr = 10;
2354 CHECK_EQ(x, 10); 2281 CHECK_EQ(x, 10);
2355 2282
2356 // Make sure unaligned pointers are wrapped properly. 2283 // Make sure unaligned pointers are wrapped properly.
2357 char* data = i::StrDup("0123456789"); 2284 char* data = i::StrDup("0123456789");
2358 Local<v8::Value> zero = v8::External::Wrap(&data[0]); 2285 Local<v8::Value> zero = v8::External::New(&data[0]);
2359 Local<v8::Value> one = v8::External::Wrap(&data[1]); 2286 Local<v8::Value> one = v8::External::New(&data[1]);
2360 Local<v8::Value> two = v8::External::Wrap(&data[2]); 2287 Local<v8::Value> two = v8::External::New(&data[2]);
2361 Local<v8::Value> three = v8::External::Wrap(&data[3]); 2288 Local<v8::Value> three = v8::External::New(&data[3]);
2362 2289
2363 char* char_ptr = reinterpret_cast<char*>(v8::External::Unwrap(zero)); 2290 char* char_ptr = reinterpret_cast<char*>(v8::External::Cast(*zero)->Value());
2364 CHECK_EQ('0', *char_ptr); 2291 CHECK_EQ('0', *char_ptr);
2365 char_ptr = reinterpret_cast<char*>(v8::External::Unwrap(one)); 2292 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*one)->Value());
2366 CHECK_EQ('1', *char_ptr); 2293 CHECK_EQ('1', *char_ptr);
2367 char_ptr = reinterpret_cast<char*>(v8::External::Unwrap(two)); 2294 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*two)->Value());
2368 CHECK_EQ('2', *char_ptr); 2295 CHECK_EQ('2', *char_ptr);
2369 char_ptr = reinterpret_cast<char*>(v8::External::Unwrap(three)); 2296 char_ptr = reinterpret_cast<char*>(v8::External::Cast(*three)->Value());
2370 CHECK_EQ('3', *char_ptr); 2297 CHECK_EQ('3', *char_ptr);
2371 i::DeleteArray(data); 2298 i::DeleteArray(data);
2372 } 2299 }
2373 2300
2374 2301
2375 THREADED_TEST(GlobalHandle) { 2302 THREADED_TEST(GlobalHandle) {
2376 v8::Persistent<String> global; 2303 v8::Persistent<String> global;
2377 { 2304 {
2378 v8::HandleScope scope; 2305 v8::HandleScope scope;
2379 Local<String> str = v8_str("str"); 2306 Local<String> str = v8_str("str");
(...skipping 7517 matching lines...) Expand 10 before | Expand all | Expand 10 after
9897 " result" 9824 " result"
9898 "} catch(e) {" 9825 "} catch(e) {"
9899 " e" 9826 " e"
9900 "};"); 9827 "};");
9901 CHECK_EQ(239 * 10, value->Int32Value()); 9828 CHECK_EQ(239 * 10, value->Int32Value());
9902 } 9829 }
9903 9830
9904 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name, 9831 static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name,
9905 const AccessorInfo& info) { 9832 const AccessorInfo& info) {
9906 ApiTestFuzzer::Fuzz(); 9833 ApiTestFuzzer::Fuzz();
9907 int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data())); 9834 int* call_count =
9835 reinterpret_cast<int*>(v8::External::Cast(*info.Data())->Value());
9908 ++(*call_count); 9836 ++(*call_count);
9909 if ((*call_count) % 20 == 0) { 9837 if ((*call_count) % 20 == 0) {
9910 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 9838 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
9911 } 9839 }
9912 return v8::Handle<Value>(); 9840 return v8::Handle<Value>();
9913 } 9841 }
9914 9842
9915 static v8::Handle<Value> FastApiCallback_TrivialSignature( 9843 static v8::Handle<Value> FastApiCallback_TrivialSignature(
9916 const v8::Arguments& args) { 9844 const v8::Arguments& args) {
9917 ApiTestFuzzer::Fuzz(); 9845 ApiTestFuzzer::Fuzz();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
10056 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); 9984 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
10057 v8::Handle<v8::FunctionTemplate> method_templ = 9985 v8::Handle<v8::FunctionTemplate> method_templ =
10058 v8::FunctionTemplate::New(FastApiCallback_TrivialSignature, 9986 v8::FunctionTemplate::New(FastApiCallback_TrivialSignature,
10059 v8_str("method_data"), 9987 v8_str("method_data"),
10060 v8::Handle<v8::Signature>()); 9988 v8::Handle<v8::Signature>());
10061 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 9989 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10062 proto_templ->Set(v8_str("method"), method_templ); 9990 proto_templ->Set(v8_str("method"), method_templ);
10063 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 9991 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10064 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 9992 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10065 NULL, NULL, NULL, NULL, 9993 NULL, NULL, NULL, NULL,
10066 v8::External::Wrap(&interceptor_call_count)); 9994 v8::External::New(&interceptor_call_count));
10067 LocalContext context; 9995 LocalContext context;
10068 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 9996 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10069 GenerateSomeGarbage(); 9997 GenerateSomeGarbage();
10070 context->Global()->Set(v8_str("o"), fun->NewInstance()); 9998 context->Global()->Set(v8_str("o"), fun->NewInstance());
10071 CompileRun( 9999 CompileRun(
10072 "var result = 0;" 10000 "var result = 0;"
10073 "for (var i = 0; i < 100; i++) {" 10001 "for (var i = 0; i < 100; i++) {"
10074 " result = o.method(41);" 10002 " result = o.method(41);"
10075 "}"); 10003 "}");
10076 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value()); 10004 CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
10077 CHECK_EQ(100, interceptor_call_count); 10005 CHECK_EQ(100, interceptor_call_count);
10078 } 10006 }
10079 10007
10080 THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) { 10008 THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
10081 int interceptor_call_count = 0; 10009 int interceptor_call_count = 0;
10082 v8::HandleScope scope; 10010 v8::HandleScope scope;
10083 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(); 10011 v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
10084 v8::Handle<v8::FunctionTemplate> method_templ = 10012 v8::Handle<v8::FunctionTemplate> method_templ =
10085 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, 10013 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
10086 v8_str("method_data"), 10014 v8_str("method_data"),
10087 v8::Signature::New(fun_templ)); 10015 v8::Signature::New(fun_templ));
10088 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 10016 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10089 proto_templ->Set(v8_str("method"), method_templ); 10017 proto_templ->Set(v8_str("method"), method_templ);
10090 fun_templ->SetHiddenPrototype(true); 10018 fun_templ->SetHiddenPrototype(true);
10091 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 10019 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10092 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 10020 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10093 NULL, NULL, NULL, NULL, 10021 NULL, NULL, NULL, NULL,
10094 v8::External::Wrap(&interceptor_call_count)); 10022 v8::External::New(&interceptor_call_count));
10095 LocalContext context; 10023 LocalContext context;
10096 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 10024 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10097 GenerateSomeGarbage(); 10025 GenerateSomeGarbage();
10098 context->Global()->Set(v8_str("o"), fun->NewInstance()); 10026 context->Global()->Set(v8_str("o"), fun->NewInstance());
10099 CompileRun( 10027 CompileRun(
10100 "o.foo = 17;" 10028 "o.foo = 17;"
10101 "var receiver = {};" 10029 "var receiver = {};"
10102 "receiver.__proto__ = o;" 10030 "receiver.__proto__ = o;"
10103 "var result = 0;" 10031 "var result = 0;"
10104 "for (var i = 0; i < 100; i++) {" 10032 "for (var i = 0; i < 100; i++) {"
(...skipping 10 matching lines...) Expand all
10115 v8::Handle<v8::FunctionTemplate> method_templ = 10043 v8::Handle<v8::FunctionTemplate> method_templ =
10116 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, 10044 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
10117 v8_str("method_data"), 10045 v8_str("method_data"),
10118 v8::Signature::New(fun_templ)); 10046 v8::Signature::New(fun_templ));
10119 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 10047 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10120 proto_templ->Set(v8_str("method"), method_templ); 10048 proto_templ->Set(v8_str("method"), method_templ);
10121 fun_templ->SetHiddenPrototype(true); 10049 fun_templ->SetHiddenPrototype(true);
10122 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 10050 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10123 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 10051 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10124 NULL, NULL, NULL, NULL, 10052 NULL, NULL, NULL, NULL,
10125 v8::External::Wrap(&interceptor_call_count)); 10053 v8::External::New(&interceptor_call_count));
10126 LocalContext context; 10054 LocalContext context;
10127 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 10055 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10128 GenerateSomeGarbage(); 10056 GenerateSomeGarbage();
10129 context->Global()->Set(v8_str("o"), fun->NewInstance()); 10057 context->Global()->Set(v8_str("o"), fun->NewInstance());
10130 CompileRun( 10058 CompileRun(
10131 "o.foo = 17;" 10059 "o.foo = 17;"
10132 "var receiver = {};" 10060 "var receiver = {};"
10133 "receiver.__proto__ = o;" 10061 "receiver.__proto__ = o;"
10134 "var result = 0;" 10062 "var result = 0;"
10135 "var saved_result = 0;" 10063 "var saved_result = 0;"
(...skipping 16 matching lines...) Expand all
10152 v8::Handle<v8::FunctionTemplate> method_templ = 10080 v8::Handle<v8::FunctionTemplate> method_templ =
10153 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, 10081 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
10154 v8_str("method_data"), 10082 v8_str("method_data"),
10155 v8::Signature::New(fun_templ)); 10083 v8::Signature::New(fun_templ));
10156 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 10084 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10157 proto_templ->Set(v8_str("method"), method_templ); 10085 proto_templ->Set(v8_str("method"), method_templ);
10158 fun_templ->SetHiddenPrototype(true); 10086 fun_templ->SetHiddenPrototype(true);
10159 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 10087 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10160 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 10088 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10161 NULL, NULL, NULL, NULL, 10089 NULL, NULL, NULL, NULL,
10162 v8::External::Wrap(&interceptor_call_count)); 10090 v8::External::New(&interceptor_call_count));
10163 LocalContext context; 10091 LocalContext context;
10164 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 10092 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10165 GenerateSomeGarbage(); 10093 GenerateSomeGarbage();
10166 context->Global()->Set(v8_str("o"), fun->NewInstance()); 10094 context->Global()->Set(v8_str("o"), fun->NewInstance());
10167 CompileRun( 10095 CompileRun(
10168 "o.foo = 17;" 10096 "o.foo = 17;"
10169 "var receiver = {};" 10097 "var receiver = {};"
10170 "receiver.__proto__ = o;" 10098 "receiver.__proto__ = o;"
10171 "var result = 0;" 10099 "var result = 0;"
10172 "var saved_result = 0;" 10100 "var saved_result = 0;"
(...skipping 16 matching lines...) Expand all
10189 v8::Handle<v8::FunctionTemplate> method_templ = 10117 v8::Handle<v8::FunctionTemplate> method_templ =
10190 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, 10118 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
10191 v8_str("method_data"), 10119 v8_str("method_data"),
10192 v8::Signature::New(fun_templ)); 10120 v8::Signature::New(fun_templ));
10193 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 10121 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10194 proto_templ->Set(v8_str("method"), method_templ); 10122 proto_templ->Set(v8_str("method"), method_templ);
10195 fun_templ->SetHiddenPrototype(true); 10123 fun_templ->SetHiddenPrototype(true);
10196 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 10124 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10197 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 10125 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10198 NULL, NULL, NULL, NULL, 10126 NULL, NULL, NULL, NULL,
10199 v8::External::Wrap(&interceptor_call_count)); 10127 v8::External::New(&interceptor_call_count));
10200 LocalContext context; 10128 LocalContext context;
10201 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 10129 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10202 GenerateSomeGarbage(); 10130 GenerateSomeGarbage();
10203 context->Global()->Set(v8_str("o"), fun->NewInstance()); 10131 context->Global()->Set(v8_str("o"), fun->NewInstance());
10204 v8::TryCatch try_catch; 10132 v8::TryCatch try_catch;
10205 CompileRun( 10133 CompileRun(
10206 "o.foo = 17;" 10134 "o.foo = 17;"
10207 "var receiver = {};" 10135 "var receiver = {};"
10208 "receiver.__proto__ = o;" 10136 "receiver.__proto__ = o;"
10209 "var result = 0;" 10137 "var result = 0;"
(...skipping 19 matching lines...) Expand all
10229 v8::Handle<v8::FunctionTemplate> method_templ = 10157 v8::Handle<v8::FunctionTemplate> method_templ =
10230 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature, 10158 v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
10231 v8_str("method_data"), 10159 v8_str("method_data"),
10232 v8::Signature::New(fun_templ)); 10160 v8::Signature::New(fun_templ));
10233 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate(); 10161 v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
10234 proto_templ->Set(v8_str("method"), method_templ); 10162 proto_templ->Set(v8_str("method"), method_templ);
10235 fun_templ->SetHiddenPrototype(true); 10163 fun_templ->SetHiddenPrototype(true);
10236 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate(); 10164 v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
10237 templ->SetNamedPropertyHandler(InterceptorCallICFastApi, 10165 templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
10238 NULL, NULL, NULL, NULL, 10166 NULL, NULL, NULL, NULL,
10239 v8::External::Wrap(&interceptor_call_count)); 10167 v8::External::New(&interceptor_call_count));
10240 LocalContext context; 10168 LocalContext context;
10241 v8::Handle<v8::Function> fun = fun_templ->GetFunction(); 10169 v8::Handle<v8::Function> fun = fun_templ->GetFunction();
10242 GenerateSomeGarbage(); 10170 GenerateSomeGarbage();
10243 context->Global()->Set(v8_str("o"), fun->NewInstance()); 10171 context->Global()->Set(v8_str("o"), fun->NewInstance());
10244 v8::TryCatch try_catch; 10172 v8::TryCatch try_catch;
10245 CompileRun( 10173 CompileRun(
10246 "o.foo = 17;" 10174 "o.foo = 17;"
10247 "var receiver = {};" 10175 "var receiver = {};"
10248 "receiver.__proto__ = o;" 10176 "receiver.__proto__ = o;"
10249 "var result = 0;" 10177 "var result = 0;"
(...skipping 5215 matching lines...) Expand 10 before | Expand all | Expand 10 after
15465 15393
15466 // Context-dependent context data creates reference from the compilation 15394 // Context-dependent context data creates reference from the compilation
15467 // cache to the global object. 15395 // cache to the global object.
15468 const char* source_simple = "1"; 15396 const char* source_simple = "1";
15469 context = Context::New(); 15397 context = Context::New();
15470 { 15398 {
15471 v8::HandleScope scope; 15399 v8::HandleScope scope;
15472 15400
15473 context->Enter(); 15401 context->Enter();
15474 Local<v8::String> obj = v8::String::New(""); 15402 Local<v8::String> obj = v8::String::New("");
15475 context->SetData(obj); 15403 context->SetEmbedderData(0, obj);
15476 CompileRun(source_simple); 15404 CompileRun(source_simple);
15477 context->Exit(); 15405 context->Exit();
15478 } 15406 }
15479 context.Dispose(); 15407 context.Dispose();
15480 v8::V8::ContextDisposedNotification(); 15408 v8::V8::ContextDisposedNotification();
15481 for (gc_count = 1; gc_count < 10; gc_count++) { 15409 for (gc_count = 1; gc_count < 10; gc_count++) {
15482 other_context->Enter(); 15410 other_context->Enter();
15483 CompileRun(source_simple); 15411 CompileRun(source_simple);
15484 other_context->Exit(); 15412 other_context->Exit();
15485 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 15413 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
(...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after
18189 18117
18190 i::Semaphore* sem_; 18118 i::Semaphore* sem_;
18191 volatile int sem_value_; 18119 volatile int sem_value_;
18192 }; 18120 };
18193 18121
18194 18122
18195 THREADED_TEST(SemaphoreInterruption) { 18123 THREADED_TEST(SemaphoreInterruption) {
18196 ThreadInterruptTest().RunTest(); 18124 ThreadInterruptTest().RunTest();
18197 } 18125 }
18198 #endif // WIN32 18126 #endif // WIN32
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698