| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include <limits.h> | 28 #include <limits.h> |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #include "api.h" | 32 #include "api.h" |
| 33 #include "compilation-cache.h" | 33 #include "compilation-cache.h" |
| 34 #include "execution.h" | 34 #include "execution.h" |
| 35 #include "snapshot.h" | 35 #include "snapshot.h" |
| 36 #include "platform.h" | 36 #include "platform.h" |
| 37 #include "top.h" | |
| 38 #include "utils.h" | 37 #include "utils.h" |
| 39 #include "cctest.h" | 38 #include "cctest.h" |
| 40 | 39 |
| 41 static const bool kLogThreading = true; | 40 static const bool kLogThreading = true; |
| 42 | 41 |
| 43 static bool IsNaN(double x) { | 42 static bool IsNaN(double x) { |
| 44 #ifdef WIN32 | 43 #ifdef WIN32 |
| 45 return _isnan(x); | 44 return _isnan(x); |
| 46 #else | 45 #else |
| 47 return isnan(x); | 46 return isnan(x); |
| (...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 args[1], | 2319 args[1], |
| 2321 args[2], | 2320 args[2], |
| 2322 args[3] }; | 2321 args[3] }; |
| 2323 if (count % cInterval == 0) { | 2322 if (count % cInterval == 0) { |
| 2324 v8::TryCatch try_catch; | 2323 v8::TryCatch try_catch; |
| 2325 Local<Value> result = fun.As<Function>()->Call(global, 4, argv); | 2324 Local<Value> result = fun.As<Function>()->Call(global, 4, argv); |
| 2326 int expected = args[3]->Int32Value(); | 2325 int expected = args[3]->Int32Value(); |
| 2327 if (try_catch.HasCaught()) { | 2326 if (try_catch.HasCaught()) { |
| 2328 CHECK_EQ(expected, count); | 2327 CHECK_EQ(expected, count); |
| 2329 CHECK(result.IsEmpty()); | 2328 CHECK(result.IsEmpty()); |
| 2330 CHECK(!i::Top::has_scheduled_exception()); | 2329 CHECK(!i::Isolate::Current()->has_scheduled_exception()); |
| 2331 } else { | 2330 } else { |
| 2332 CHECK_NE(expected, count); | 2331 CHECK_NE(expected, count); |
| 2333 } | 2332 } |
| 2334 return result; | 2333 return result; |
| 2335 } else { | 2334 } else { |
| 2336 return fun.As<Function>()->Call(global, 4, argv); | 2335 return fun.As<Function>()->Call(global, 4, argv); |
| 2337 } | 2336 } |
| 2338 } | 2337 } |
| 2339 } | 2338 } |
| 2340 | 2339 |
| (...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5663 | 5662 |
| 5664 Local<v8::Object> o0 = t->GetFunction()->NewInstance(); | 5663 Local<v8::Object> o0 = t->GetFunction()->NewInstance(); |
| 5665 Local<v8::Object> o1 = t->GetFunction()->NewInstance(); | 5664 Local<v8::Object> o1 = t->GetFunction()->NewInstance(); |
| 5666 | 5665 |
| 5667 CHECK(o0->SetPrototype(o1)); | 5666 CHECK(o0->SetPrototype(o1)); |
| 5668 // If setting the prototype leads to the cycle, SetPrototype should | 5667 // If setting the prototype leads to the cycle, SetPrototype should |
| 5669 // return false and keep VM in sane state. | 5668 // return false and keep VM in sane state. |
| 5670 v8::TryCatch try_catch; | 5669 v8::TryCatch try_catch; |
| 5671 CHECK(!o1->SetPrototype(o0)); | 5670 CHECK(!o1->SetPrototype(o0)); |
| 5672 CHECK(!try_catch.HasCaught()); | 5671 CHECK(!try_catch.HasCaught()); |
| 5673 ASSERT(!i::Top::has_pending_exception()); | 5672 ASSERT(!i::Isolate::Current()->has_pending_exception()); |
| 5674 | 5673 |
| 5675 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); | 5674 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); |
| 5676 } | 5675 } |
| 5677 | 5676 |
| 5678 | 5677 |
| 5679 THREADED_TEST(GetterSetterExceptions) { | 5678 THREADED_TEST(GetterSetterExceptions) { |
| 5680 v8::HandleScope handle_scope; | 5679 v8::HandleScope handle_scope; |
| 5681 LocalContext context; | 5680 LocalContext context; |
| 5682 CompileRun( | 5681 CompileRun( |
| 5683 "function Foo() { };" | 5682 "function Foo() { };" |
| (...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8988 } | 8987 } |
| 8989 two_byte_content_[14] = 'b'; | 8988 two_byte_content_[14] = 'b'; |
| 8990 | 8989 |
| 8991 // Create the input string for the regexp - the one we are going to change | 8990 // Create the input string for the regexp - the one we are going to change |
| 8992 // properties of. | 8991 // properties of. |
| 8993 input_ = i::Factory::NewExternalStringFromAscii(&ascii_resource_); | 8992 input_ = i::Factory::NewExternalStringFromAscii(&ascii_resource_); |
| 8994 | 8993 |
| 8995 // Inject the input as a global variable. | 8994 // Inject the input as a global variable. |
| 8996 i::Handle<i::String> input_name = | 8995 i::Handle<i::String> input_name = |
| 8997 i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5)); | 8996 i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5)); |
| 8998 i::Top::global_context()->global()->SetProperty(*input_name, *input_, NONE); | 8997 i::Isolate::Current()->global_context()->global()-> |
| 8998 SetProperty(*input_name, *input_, NONE); |
| 8999 | 8999 |
| 9000 | 9000 |
| 9001 MorphThread morph_thread(this); | 9001 MorphThread morph_thread(this); |
| 9002 morph_thread.Start(); | 9002 morph_thread.Start(); |
| 9003 v8::Locker::StartPreemption(1); | 9003 v8::Locker::StartPreemption(1); |
| 9004 LongRunningRegExp(); | 9004 LongRunningRegExp(); |
| 9005 { | 9005 { |
| 9006 v8::Unlocker unlock; | 9006 v8::Unlocker unlock; |
| 9007 morph_thread.Join(); | 9007 morph_thread.Join(); |
| 9008 } | 9008 } |
| (...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10917 const char* code = | 10917 const char* code = |
| 10918 "(function() {" | 10918 "(function() {" |
| 10919 " for (var i = 0; i < 2*16; i++) {" | 10919 " for (var i = 0; i < 2*16; i++) {" |
| 10920 " %_GetFromCache(0, 'a' + i);" | 10920 " %_GetFromCache(0, 'a' + i);" |
| 10921 " };" | 10921 " };" |
| 10922 " return 'PASSED';" | 10922 " return 'PASSED';" |
| 10923 "})()"; | 10923 "})()"; |
| 10924 HEAP->ClearJSFunctionResultCaches(); | 10924 HEAP->ClearJSFunctionResultCaches(); |
| 10925 ExpectString(code, "PASSED"); | 10925 ExpectString(code, "PASSED"); |
| 10926 } | 10926 } |
| OLD | NEW |