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 8077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8088 // This catches bugs in the instructions used for the KeyedLoadIC | 8088 // This catches bugs in the instructions used for the KeyedLoadIC |
8089 // for byte and word types. | 8089 // for byte and word types. |
8090 { | 8090 { |
8091 const int kXSize = 300; | 8091 const int kXSize = 300; |
8092 const int kYSize = 300; | 8092 const int kYSize = 300; |
8093 const int kLargeElementCount = kXSize * kYSize * 4; | 8093 const int kLargeElementCount = kXSize * kYSize * 4; |
8094 ElementType* large_array_data = | 8094 ElementType* large_array_data = |
8095 static_cast<ElementType*>(malloc(kLargeElementCount * element_size)); | 8095 static_cast<ElementType*>(malloc(kLargeElementCount * element_size)); |
8096 i::Handle<ExternalArrayClass> large_array = | 8096 i::Handle<ExternalArrayClass> large_array = |
8097 i::Handle<ExternalArrayClass>::cast( | 8097 i::Handle<ExternalArrayClass>::cast( |
8098 i::Factory::NewExternalArray(kElementCount, array_type, array_data))
; | 8098 i::Factory::NewExternalArray(kLargeElementCount, |
| 8099 array_type, |
| 8100 array_data)); |
8099 v8::Handle<v8::Object> large_obj = v8::Object::New(); | 8101 v8::Handle<v8::Object> large_obj = v8::Object::New(); |
8100 // Set the elements to be the external array. | 8102 // Set the elements to be the external array. |
8101 large_obj->SetIndexedPropertiesToExternalArrayData(large_array_data, | 8103 large_obj->SetIndexedPropertiesToExternalArrayData(large_array_data, |
8102 array_type, | 8104 array_type, |
8103 kLargeElementCount); | 8105 kLargeElementCount); |
8104 context->Global()->Set(v8_str("large_array"), large_obj); | 8106 context->Global()->Set(v8_str("large_array"), large_obj); |
8105 result = CompileRun("for (var y = 0; y < 300; y++) {" | 8107 result = CompileRun("for (var y = 0; y < 300; y++) {" |
8106 " for (var x = 0; x < 300; x++) {" | 8108 " for (var x = 0; x < 300; x++) {" |
8107 " large_array[4 * 300 * y + 4 * x + 0] = 127;" | 8109 " large_array[4 * 300 * y + 4 * x + 0] = 127;" |
8108 " large_array[4 * 300 * y + 4 * x + 1] = 0;" | 8110 " large_array[4 * 300 * y + 4 * x + 1] = 0;" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8486 " i++;" | 8488 " i++;" |
8487 " return s(o);" | 8489 " return s(o);" |
8488 " }" | 8490 " }" |
8489 " }" | 8491 " }" |
8490 "};" | 8492 "};" |
8491 "s(o);"); | 8493 "s(o);"); |
8492 CHECK(try_catch.HasCaught()); | 8494 CHECK(try_catch.HasCaught()); |
8493 v8::String::Utf8Value value(try_catch.Exception()); | 8495 v8::String::Utf8Value value(try_catch.Exception()); |
8494 CHECK_EQ(0, strcmp(*value, "Hey!")); | 8496 CHECK_EQ(0, strcmp(*value, "Hey!")); |
8495 } | 8497 } |
OLD | NEW |