| 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 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 | 2471 |
| 2472 THREADED_TEST(UndefinedIsNotEnumerable) { | 2472 THREADED_TEST(UndefinedIsNotEnumerable) { |
| 2473 LocalContext env; | 2473 LocalContext env; |
| 2474 v8::HandleScope scope(env->GetIsolate()); | 2474 v8::HandleScope scope(env->GetIsolate()); |
| 2475 v8::Local<Value> result = CompileRun("this.propertyIsEnumerable(undefined)"); | 2475 v8::Local<Value> result = CompileRun("this.propertyIsEnumerable(undefined)"); |
| 2476 CHECK(result->IsFalse()); | 2476 CHECK(result->IsFalse()); |
| 2477 } | 2477 } |
| 2478 | 2478 |
| 2479 | 2479 |
| 2480 v8::Local<Script> call_recursively_script; | 2480 v8::Local<Script> call_recursively_script; |
| 2481 static const int kTargetRecursionDepth = 150; // near maximum | 2481 static const int kTargetRecursionDepth = 100; // near maximum |
| 2482 | |
| 2483 | 2482 |
| 2484 static void CallScriptRecursivelyCall( | 2483 static void CallScriptRecursivelyCall( |
| 2485 const v8::FunctionCallbackInfo<v8::Value>& args) { | 2484 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 2486 ApiTestFuzzer::Fuzz(); | 2485 ApiTestFuzzer::Fuzz(); |
| 2487 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); | 2486 v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); |
| 2488 int depth = args.This() | 2487 int depth = args.This() |
| 2489 ->Get(context, v8_str("depth")) | 2488 ->Get(context, v8_str("depth")) |
| 2490 .ToLocalChecked() | 2489 .ToLocalChecked() |
| 2491 ->Int32Value(context) | 2490 ->Int32Value(context) |
| 2492 .FromJust(); | 2491 .FromJust(); |
| (...skipping 11307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13800 | 13799 |
| 13801 | 13800 |
| 13802 void ApiTestFuzzer::TearDown() { | 13801 void ApiTestFuzzer::TearDown() { |
| 13803 fuzzing_ = false; | 13802 fuzzing_ = false; |
| 13804 for (int i = 0; i < RegisterThreadedTest::count(); i++) { | 13803 for (int i = 0; i < RegisterThreadedTest::count(); i++) { |
| 13805 ApiTestFuzzer *fuzzer = RegisterThreadedTest::nth(i)->fuzzer_; | 13804 ApiTestFuzzer *fuzzer = RegisterThreadedTest::nth(i)->fuzzer_; |
| 13806 if (fuzzer != NULL) fuzzer->Join(); | 13805 if (fuzzer != NULL) fuzzer->Join(); |
| 13807 } | 13806 } |
| 13808 } | 13807 } |
| 13809 | 13808 |
| 13809 void ApiTestFuzzer::CallTest() { |
| 13810 v8::Isolate::Scope scope(CcTest::isolate()); |
| 13811 if (kLogThreading) |
| 13812 printf("Start test %s #%d\n", |
| 13813 RegisterThreadedTest::nth(test_number_)->name(), test_number_); |
| 13814 CallTestNumber(test_number_); |
| 13815 if (kLogThreading) |
| 13816 printf("End test %s #%d\n", RegisterThreadedTest::nth(test_number_)->name(), |
| 13817 test_number_); |
| 13818 } |
| 13810 | 13819 |
| 13811 // Lets not be needlessly self-referential. | 13820 // Lets not be needlessly self-referential. |
| 13812 TEST(Threading1) { | 13821 TEST(Threading1) { |
| 13813 ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART); | 13822 ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART); |
| 13814 ApiTestFuzzer::RunAllTests(); | 13823 ApiTestFuzzer::RunAllTests(); |
| 13815 ApiTestFuzzer::TearDown(); | 13824 ApiTestFuzzer::TearDown(); |
| 13816 } | 13825 } |
| 13817 | 13826 |
| 13818 | 13827 |
| 13819 TEST(Threading2) { | 13828 TEST(Threading2) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 13830 } | 13839 } |
| 13831 | 13840 |
| 13832 | 13841 |
| 13833 TEST(Threading4) { | 13842 TEST(Threading4) { |
| 13834 ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART); | 13843 ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART); |
| 13835 ApiTestFuzzer::RunAllTests(); | 13844 ApiTestFuzzer::RunAllTests(); |
| 13836 ApiTestFuzzer::TearDown(); | 13845 ApiTestFuzzer::TearDown(); |
| 13837 } | 13846 } |
| 13838 | 13847 |
| 13839 | 13848 |
| 13840 void ApiTestFuzzer::CallTest() { | |
| 13841 v8::Isolate::Scope scope(CcTest::isolate()); | |
| 13842 if (kLogThreading) | |
| 13843 printf("Start test %d\n", test_number_); | |
| 13844 CallTestNumber(test_number_); | |
| 13845 if (kLogThreading) | |
| 13846 printf("End test %d\n", test_number_); | |
| 13847 } | |
| 13848 | |
| 13849 | |
| 13850 static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { | 13849 static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 13851 v8::Isolate* isolate = args.GetIsolate(); | 13850 v8::Isolate* isolate = args.GetIsolate(); |
| 13852 CHECK(v8::Locker::IsLocked(isolate)); | 13851 CHECK(v8::Locker::IsLocked(isolate)); |
| 13853 ApiTestFuzzer::Fuzz(); | 13852 ApiTestFuzzer::Fuzz(); |
| 13854 v8::Unlocker unlocker(isolate); | 13853 v8::Unlocker unlocker(isolate); |
| 13855 const char* code = "throw 7;"; | 13854 const char* code = "throw 7;"; |
| 13856 { | 13855 { |
| 13857 v8::Locker nested_locker(isolate); | 13856 v8::Locker nested_locker(isolate); |
| 13858 v8::HandleScope scope(isolate); | 13857 v8::HandleScope scope(isolate); |
| 13859 v8::Local<Value> exception; | 13858 v8::Local<Value> exception; |
| (...skipping 11646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 25506 | 25505 |
| 25507 // Put the function into context1 and call it. Since the access check | 25506 // Put the function into context1 and call it. Since the access check |
| 25508 // callback always returns true, the call succeeds even though the tokens | 25507 // callback always returns true, the call succeeds even though the tokens |
| 25509 // are different. | 25508 // are different. |
| 25510 context1->Enter(); | 25509 context1->Enter(); |
| 25511 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); | 25510 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); |
| 25512 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); | 25511 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); |
| 25513 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); | 25512 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); |
| 25514 context1->Exit(); | 25513 context1->Exit(); |
| 25515 } | 25514 } |
| OLD | NEW |