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 13757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13768 ExternalArrayInfoTestHelper(v8::kExternalShortArray); | 13768 ExternalArrayInfoTestHelper(v8::kExternalShortArray); |
13769 ExternalArrayInfoTestHelper(v8::kExternalUnsignedShortArray); | 13769 ExternalArrayInfoTestHelper(v8::kExternalUnsignedShortArray); |
13770 ExternalArrayInfoTestHelper(v8::kExternalIntArray); | 13770 ExternalArrayInfoTestHelper(v8::kExternalIntArray); |
13771 ExternalArrayInfoTestHelper(v8::kExternalUnsignedIntArray); | 13771 ExternalArrayInfoTestHelper(v8::kExternalUnsignedIntArray); |
13772 ExternalArrayInfoTestHelper(v8::kExternalFloatArray); | 13772 ExternalArrayInfoTestHelper(v8::kExternalFloatArray); |
13773 ExternalArrayInfoTestHelper(v8::kExternalDoubleArray); | 13773 ExternalArrayInfoTestHelper(v8::kExternalDoubleArray); |
13774 ExternalArrayInfoTestHelper(v8::kExternalPixelArray); | 13774 ExternalArrayInfoTestHelper(v8::kExternalPixelArray); |
13775 } | 13775 } |
13776 | 13776 |
13777 | 13777 |
| 13778 void ExternalArrayLimitTestHelper(v8::ExternalArrayType array_type, int size) { |
| 13779 v8::Handle<v8::Object> obj = v8::Object::New(); |
| 13780 v8::V8::SetFatalErrorHandler(StoringErrorCallback); |
| 13781 last_location = last_message = NULL; |
| 13782 obj->SetIndexedPropertiesToExternalArrayData(NULL, array_type, size); |
| 13783 CHECK(!obj->HasIndexedPropertiesInExternalArrayData()); |
| 13784 CHECK_NE(NULL, last_location); |
| 13785 CHECK_NE(NULL, last_message); |
| 13786 } |
| 13787 |
| 13788 |
| 13789 TEST(ExternalArrayLimits) { |
| 13790 v8::HandleScope scope; |
| 13791 LocalContext context; |
| 13792 ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0x40000000); |
| 13793 ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0xffffffff); |
| 13794 ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0x40000000); |
| 13795 ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0xffffffff); |
| 13796 ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0x40000000); |
| 13797 ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0xffffffff); |
| 13798 ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0x40000000); |
| 13799 ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0xffffffff); |
| 13800 ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0x40000000); |
| 13801 ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0xffffffff); |
| 13802 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0x40000000); |
| 13803 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0xffffffff); |
| 13804 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0x40000000); |
| 13805 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0xffffffff); |
| 13806 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0x40000000); |
| 13807 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0xffffffff); |
| 13808 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000); |
| 13809 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff); |
| 13810 } |
| 13811 |
| 13812 |
13778 THREADED_TEST(ScriptContextDependence) { | 13813 THREADED_TEST(ScriptContextDependence) { |
13779 v8::HandleScope scope; | 13814 v8::HandleScope scope; |
13780 LocalContext c1; | 13815 LocalContext c1; |
13781 const char *source = "foo"; | 13816 const char *source = "foo"; |
13782 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); | 13817 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); |
13783 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); | 13818 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); |
13784 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); | 13819 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); |
13785 CHECK_EQ(dep->Run()->Int32Value(), 100); | 13820 CHECK_EQ(dep->Run()->Int32Value(), 100); |
13786 CHECK_EQ(indep->Run()->Int32Value(), 100); | 13821 CHECK_EQ(indep->Run()->Int32Value(), 100); |
13787 LocalContext c2; | 13822 LocalContext c2; |
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17140 v8::HandleScope scope; | 17175 v8::HandleScope scope; |
17141 LocalContext context; | 17176 LocalContext context; |
17142 | 17177 |
17143 // Compile a try-finally clause where the finally block causes a GC | 17178 // Compile a try-finally clause where the finally block causes a GC |
17144 // while there still is a message pending for external reporting. | 17179 // while there still is a message pending for external reporting. |
17145 TryCatch try_catch; | 17180 TryCatch try_catch; |
17146 try_catch.SetVerbose(true); | 17181 try_catch.SetVerbose(true); |
17147 CompileRun("try { throw new Error(); } finally { gc(); }"); | 17182 CompileRun("try { throw new Error(); } finally { gc(); }"); |
17148 CHECK(try_catch.HasCaught()); | 17183 CHECK(try_catch.HasCaught()); |
17149 } | 17184 } |
OLD | NEW |