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 12716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12727 break; | 12727 break; |
12728 default: | 12728 default: |
12729 UNREACHABLE(); | 12729 UNREACHABLE(); |
12730 return -1; | 12730 return -1; |
12731 } | 12731 } |
12732 UNREACHABLE(); | 12732 UNREACHABLE(); |
12733 return -1; | 12733 return -1; |
12734 } | 12734 } |
12735 | 12735 |
12736 | 12736 |
| 12737 #if defined(V8_TARGET_ARCH_MIPS) && !defined(USE_SIMULATOR) |
| 12738 static const int kUndefinedResult = static_cast<int>(0x80000000 - 1); |
| 12739 #else |
| 12740 static const int kUndefinedResult = static_cast<int>(0x80000000); |
| 12741 #endif |
| 12742 |
| 12743 |
12737 template <class ExternalArrayClass, class ElementType> | 12744 template <class ExternalArrayClass, class ElementType> |
12738 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, | 12745 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, |
12739 int64_t low, | 12746 int64_t low, |
12740 int64_t high) { | 12747 int64_t high) { |
12741 v8::HandleScope scope; | 12748 v8::HandleScope scope; |
12742 LocalContext context; | 12749 LocalContext context; |
12743 const int kElementCount = 40; | 12750 const int kElementCount = 40; |
12744 int element_size = ExternalArrayElementSize(array_type); | 12751 int element_size = ExternalArrayElementSize(array_type); |
12745 ElementType* array_data = | 12752 ElementType* array_data = |
12746 static_cast<ElementType*>(malloc(kElementCount * element_size)); | 12753 static_cast<ElementType*>(malloc(kElementCount * element_size)); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12903 | 12910 |
12904 // Check other boundary conditions, values and operations. | 12911 // Check other boundary conditions, values and operations. |
12905 result = CompileRun("for (var i = 0; i < 8; i++) {" | 12912 result = CompileRun("for (var i = 0; i < 8; i++) {" |
12906 " ext_array[7] = undefined;" | 12913 " ext_array[7] = undefined;" |
12907 "}" | 12914 "}" |
12908 "ext_array[7];"); | 12915 "ext_array[7];"); |
12909 CHECK_EQ(0, result->Int32Value()); | 12916 CHECK_EQ(0, result->Int32Value()); |
12910 if (array_type == v8::kExternalDoubleArray || | 12917 if (array_type == v8::kExternalDoubleArray || |
12911 array_type == v8::kExternalFloatArray) { | 12918 array_type == v8::kExternalFloatArray) { |
12912 CHECK_EQ( | 12919 CHECK_EQ( |
12913 static_cast<int>(0x80000000), | 12920 static_cast<int>(kUndefinedResult), |
12914 static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number())); | 12921 static_cast<int>(jsobj->GetElement(7)->ToObjectChecked()->Number())); |
12915 } else { | 12922 } else { |
12916 CHECK_EQ(0, static_cast<int>( | 12923 CHECK_EQ(0, static_cast<int>( |
12917 jsobj->GetElement(7)->ToObjectChecked()->Number())); | 12924 jsobj->GetElement(7)->ToObjectChecked()->Number())); |
12918 } | 12925 } |
12919 | 12926 |
12920 result = CompileRun("for (var i = 0; i < 8; i++) {" | 12927 result = CompileRun("for (var i = 0; i < 8; i++) {" |
12921 " ext_array[6] = '2.3';" | 12928 " ext_array[6] = '2.3';" |
12922 "}" | 12929 "}" |
12923 "ext_array[6];"); | 12930 "ext_array[6];"); |
(...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16095 CompileRun("throw 'exception';"); | 16102 CompileRun("throw 'exception';"); |
16096 } | 16103 } |
16097 | 16104 |
16098 | 16105 |
16099 TEST(CallCompletedCallbackTwoExceptions) { | 16106 TEST(CallCompletedCallbackTwoExceptions) { |
16100 v8::HandleScope scope; | 16107 v8::HandleScope scope; |
16101 LocalContext env; | 16108 LocalContext env; |
16102 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); | 16109 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); |
16103 CompileRun("throw 'first exception';"); | 16110 CompileRun("throw 'first exception';"); |
16104 } | 16111 } |
OLD | NEW |