OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 13436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13447 " C[i] = [1];" | 13447 " C[i] = [1];" |
13448 " for (var j = 1; j < i; ++j) {" | 13448 " for (var j = 1; j < i; ++j) {" |
13449 " C[i][j] = C[i-1][j-1] + C[i-1][j];" | 13449 " C[i][j] = C[i-1][j-1] + C[i-1][j];" |
13450 " }" | 13450 " }" |
13451 " C[i][i] = 1;" | 13451 " C[i][i] = 1;" |
13452 " }" | 13452 " }" |
13453 " return C[n][m];" | 13453 " return C[n][m];" |
13454 "};" | 13454 "};" |
13455 "binom(1000, 500)"); | 13455 "binom(1000, 500)"); |
13456 bool rv = false; | 13456 bool rv = false; |
13457 intptr_t old_size = HEAP->SizeOfObjects(); | |
13458 bool no_idle_work = v8::V8::IdleNotification(); | |
13459 for (int i = 0; i < 100; i++) { | 13457 for (int i = 0; i < 100; i++) { |
13460 rv = v8::V8::IdleNotification(); | 13458 rv = v8::V8::IdleNotification(); |
13461 if (rv) | 13459 if (rv) |
13462 break; | 13460 break; |
13463 } | 13461 } |
13464 CHECK(rv == true); | 13462 CHECK(rv == true); |
13465 intptr_t new_size = HEAP->SizeOfObjects(); | |
13466 CHECK(no_idle_work || new_size < 3 * old_size / 4); | |
ulan
2011/12/06 14:29:09
Restoring this test to the state before I added th
| |
13467 } | 13463 } |
13468 | 13464 |
13469 // Test that idle notification can be handled and eventually returns true. | 13465 // Test that idle notification can be handled and eventually returns true. |
13470 THREADED_TEST(IdleNotificationWithHint) { | 13466 THREADED_TEST(IdleNotificationWithHint) { |
13471 v8::HandleScope scope; | 13467 v8::HandleScope scope; |
13472 LocalContext env; | 13468 LocalContext env; |
13473 CompileRun("function binom(n, m) {" | 13469 CompileRun("function binom(n, m) {" |
13474 " var C = [[1]];" | 13470 " var C = [[1]];" |
13475 " for (var i = 1; i <= n; ++i) {" | 13471 " for (var i = 1; i <= n; ++i) {" |
13476 " C[i] = [1];" | 13472 " C[i] = [1];" |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15637 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); | 15633 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); |
15638 | 15634 |
15639 // TODO(1547): Make the following also return "i". | 15635 // TODO(1547): Make the following also return "i". |
15640 // Calling with environment record as base. | 15636 // Calling with environment record as base. |
15641 TestReceiver(o, context->Global(), "func()"); | 15637 TestReceiver(o, context->Global(), "func()"); |
15642 // Calling with no base. | 15638 // Calling with no base. |
15643 TestReceiver(o, context->Global(), "(1,func)()"); | 15639 TestReceiver(o, context->Global(), "(1,func)()"); |
15644 | 15640 |
15645 foreign_context.Dispose(); | 15641 foreign_context.Dispose(); |
15646 } | 15642 } |
OLD | NEW |