| 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 10240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10251 Local<Function> function = function_template->GetFunction(); | 10251 Local<Function> function = function_template->GetFunction(); |
| 10252 Local<Object> instance = function; | 10252 Local<Object> instance = function; |
| 10253 v8::TryCatch try_catch(isolate); | 10253 v8::TryCatch try_catch(isolate); |
| 10254 | 10254 |
| 10255 CHECK(instance->IsCallable()); | 10255 CHECK(instance->IsCallable()); |
| 10256 CHECK(!try_catch.HasCaught()); | 10256 CHECK(!try_catch.HasCaught()); |
| 10257 } | 10257 } |
| 10258 } | 10258 } |
| 10259 | 10259 |
| 10260 | 10260 |
| 10261 THREADED_TEST(Regress567998) { |
| 10262 LocalContext env; |
| 10263 v8::HandleScope scope(env->GetIsolate()); |
| 10264 |
| 10265 Local<v8::FunctionTemplate> desc = |
| 10266 v8::FunctionTemplate::New(env->GetIsolate()); |
| 10267 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
| 10268 desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable |
| 10269 |
| 10270 Local<v8::Object> obj = desc->GetFunction(env.local()) |
| 10271 .ToLocalChecked() |
| 10272 ->NewInstance(env.local()) |
| 10273 .ToLocalChecked(); |
| 10274 CHECK( |
| 10275 env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust()); |
| 10276 |
| 10277 ExpectString("undetectable.toString()", "[object Object]"); |
| 10278 ExpectString("typeof undetectable", "undefined"); |
| 10279 ExpectString("typeof(undetectable)", "undefined"); |
| 10280 ExpectBoolean("typeof undetectable == 'undefined'", true); |
| 10281 ExpectBoolean("typeof undetectable == 'object'", false); |
| 10282 ExpectBoolean("if (undetectable) { true; } else { false; }", false); |
| 10283 ExpectBoolean("!undetectable", true); |
| 10284 |
| 10285 ExpectObject("true&&undetectable", obj); |
| 10286 ExpectBoolean("false&&undetectable", false); |
| 10287 ExpectBoolean("true||undetectable", true); |
| 10288 ExpectObject("false||undetectable", obj); |
| 10289 |
| 10290 ExpectObject("undetectable&&true", obj); |
| 10291 ExpectObject("undetectable&&false", obj); |
| 10292 ExpectBoolean("undetectable||true", true); |
| 10293 ExpectBoolean("undetectable||false", false); |
| 10294 |
| 10295 ExpectBoolean("undetectable==null", true); |
| 10296 ExpectBoolean("null==undetectable", true); |
| 10297 ExpectBoolean("undetectable==undefined", true); |
| 10298 ExpectBoolean("undefined==undetectable", true); |
| 10299 ExpectBoolean("undetectable==undetectable", true); |
| 10300 |
| 10301 ExpectBoolean("undetectable===null", false); |
| 10302 ExpectBoolean("null===undetectable", false); |
| 10303 ExpectBoolean("undetectable===undefined", false); |
| 10304 ExpectBoolean("undefined===undetectable", false); |
| 10305 ExpectBoolean("undetectable===undetectable", true); |
| 10306 } |
| 10307 |
| 10308 |
| 10261 static int Recurse(v8::Isolate* isolate, int depth, int iterations) { | 10309 static int Recurse(v8::Isolate* isolate, int depth, int iterations) { |
| 10262 v8::HandleScope scope(isolate); | 10310 v8::HandleScope scope(isolate); |
| 10263 if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate); | 10311 if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate); |
| 10264 for (int i = 0; i < iterations; i++) { | 10312 for (int i = 0; i < iterations; i++) { |
| 10265 Local<v8::Number> n(v8::Integer::New(isolate, 42)); | 10313 Local<v8::Number> n(v8::Integer::New(isolate, 42)); |
| 10266 } | 10314 } |
| 10267 return Recurse(isolate, depth - 1, iterations); | 10315 return Recurse(isolate, depth - 1, iterations); |
| 10268 } | 10316 } |
| 10269 | 10317 |
| 10270 | 10318 |
| (...skipping 11585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21856 timeout_thread.Join(); | 21904 timeout_thread.Join(); |
| 21857 } | 21905 } |
| 21858 | 21906 |
| 21859 | 21907 |
| 21860 TEST(EstimatedContextSize) { | 21908 TEST(EstimatedContextSize) { |
| 21861 v8::Isolate* isolate = CcTest::isolate(); | 21909 v8::Isolate* isolate = CcTest::isolate(); |
| 21862 v8::HandleScope scope(isolate); | 21910 v8::HandleScope scope(isolate); |
| 21863 LocalContext env; | 21911 LocalContext env; |
| 21864 CHECK(50000 < env->EstimatedSize()); | 21912 CHECK(50000 < env->EstimatedSize()); |
| 21865 } | 21913 } |
| OLD | NEW |