| 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 8178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8189 " tmp_array[i] = i;" | 8189 " tmp_array[i] = i;" |
| 8190 " sum += tmp_array[i];" | 8190 " sum += tmp_array[i];" |
| 8191 " if (i == 4) {" | 8191 " if (i == 4) {" |
| 8192 " tmp_array = {};" | 8192 " tmp_array = {};" |
| 8193 " }" | 8193 " }" |
| 8194 "}" | 8194 "}" |
| 8195 "sum;"); | 8195 "sum;"); |
| 8196 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. | 8196 i::Heap::CollectAllGarbage(false); // Force GC to trigger verification. |
| 8197 CHECK_EQ(28, result->Int32Value()); | 8197 CHECK_EQ(28, result->Int32Value()); |
| 8198 | 8198 |
| 8199 // Check out-of-range loads. | 8199 // Make sure out-of-range loads do not throw. |
| 8200 i::OS::SNPrintF(test_buf, | 8200 i::OS::SNPrintF(test_buf, |
| 8201 "var caught_exception = false;" | 8201 "var caught_exception = false;" |
| 8202 "try {" | 8202 "try {" |
| 8203 " ext_array[%d];" | 8203 " ext_array[%d];" |
| 8204 "} catch (e) {" | 8204 "} catch (e) {" |
| 8205 " caught_exception = true;" | 8205 " caught_exception = true;" |
| 8206 "}" | 8206 "}" |
| 8207 "caught_exception;", | 8207 "caught_exception;", |
| 8208 kElementCount); | 8208 kElementCount); |
| 8209 result = CompileRun(test_buf.start()); | 8209 result = CompileRun(test_buf.start()); |
| 8210 CHECK_EQ(true, result->BooleanValue()); | 8210 CHECK_EQ(false, result->BooleanValue()); |
| 8211 | 8211 |
| 8212 // Check out-of-range stores. | 8212 // Make sure out-of-range stores do not throw. |
| 8213 i::OS::SNPrintF(test_buf, | 8213 i::OS::SNPrintF(test_buf, |
| 8214 "var caught_exception = false;" | 8214 "var caught_exception = false;" |
| 8215 "try {" | 8215 "try {" |
| 8216 " ext_array[%d] = 1;" | 8216 " ext_array[%d] = 1;" |
| 8217 "} catch (e) {" | 8217 "} catch (e) {" |
| 8218 " caught_exception = true;" | 8218 " caught_exception = true;" |
| 8219 "}" | 8219 "}" |
| 8220 "caught_exception;", | 8220 "caught_exception;", |
| 8221 kElementCount); | 8221 kElementCount); |
| 8222 result = CompileRun(test_buf.start()); | 8222 result = CompileRun(test_buf.start()); |
| 8223 CHECK_EQ(true, result->BooleanValue()); | 8223 CHECK_EQ(false, result->BooleanValue()); |
| 8224 | 8224 |
| 8225 // Check other boundary conditions, values and operations. | 8225 // Check other boundary conditions, values and operations. |
| 8226 result = CompileRun("for (var i = 0; i < 8; i++) {" | 8226 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 8227 " ext_array[7] = undefined;" | 8227 " ext_array[7] = undefined;" |
| 8228 "}" | 8228 "}" |
| 8229 "ext_array[7];"); | 8229 "ext_array[7];"); |
| 8230 CHECK_EQ(0, result->Int32Value()); | 8230 CHECK_EQ(0, result->Int32Value()); |
| 8231 CHECK_EQ(0, static_cast<int>(jsobj->GetElement(7)->Number())); | 8231 CHECK_EQ(0, static_cast<int>(jsobj->GetElement(7)->Number())); |
| 8232 | 8232 |
| 8233 result = CompileRun("for (var i = 0; i < 8; i++) {" | 8233 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8488 THREADED_TEST(GetHeapStatistics) { | 8488 THREADED_TEST(GetHeapStatistics) { |
| 8489 v8::HandleScope scope; | 8489 v8::HandleScope scope; |
| 8490 LocalContext c1; | 8490 LocalContext c1; |
| 8491 v8::HeapStatistics heap_statistics; | 8491 v8::HeapStatistics heap_statistics; |
| 8492 CHECK_EQ(heap_statistics.total_heap_size(), 0); | 8492 CHECK_EQ(heap_statistics.total_heap_size(), 0); |
| 8493 CHECK_EQ(heap_statistics.used_heap_size(), 0); | 8493 CHECK_EQ(heap_statistics.used_heap_size(), 0); |
| 8494 v8::V8::GetHeapStatistics(&heap_statistics); | 8494 v8::V8::GetHeapStatistics(&heap_statistics); |
| 8495 CHECK_NE(heap_statistics.total_heap_size(), 0); | 8495 CHECK_NE(heap_statistics.total_heap_size(), 0); |
| 8496 CHECK_NE(heap_statistics.used_heap_size(), 0); | 8496 CHECK_NE(heap_statistics.used_heap_size(), 0); |
| 8497 } | 8497 } |
| OLD | NEW |