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 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3400 // Count number of live transitions after marking. Note that one transition | 3400 // Count number of live transitions after marking. Note that one transition |
3401 // is left, because 'o' still holds an instance of one transition target. | 3401 // is left, because 'o' still holds an instance of one transition target. |
3402 int transitions_after = CountMapTransitions( | 3402 int transitions_after = CountMapTransitions( |
3403 Map::cast(root->map()->GetBackPointer())); | 3403 Map::cast(root->map()->GetBackPointer())); |
3404 CHECK_EQ(1, transitions_after); | 3404 CHECK_EQ(1, transitions_after); |
3405 } | 3405 } |
3406 #endif // DEBUG | 3406 #endif // DEBUG |
3407 | 3407 |
3408 | 3408 |
3409 TEST(Regress2143a) { | 3409 TEST(Regress2143a) { |
3410 i::FLAG_collect_maps = true; | |
3411 i::FLAG_incremental_marking = true; | 3410 i::FLAG_incremental_marking = true; |
3412 CcTest::InitializeVM(); | 3411 CcTest::InitializeVM(); |
3413 v8::HandleScope scope(CcTest::isolate()); | 3412 v8::HandleScope scope(CcTest::isolate()); |
3414 | 3413 |
3415 // Prepare a map transition from the root object together with a yet | 3414 // Prepare a map transition from the root object together with a yet |
3416 // untransitioned root object. | 3415 // untransitioned root object. |
3417 CompileRun("var root = new Object;" | 3416 CompileRun("var root = new Object;" |
3418 "root.foo = 0;" | 3417 "root.foo = 0;" |
3419 "root = new Object;"); | 3418 "root = new Object;"); |
3420 | 3419 |
(...skipping 19 matching lines...) Expand all Loading... |
3440 *v8::Handle<v8::Object>::Cast( | 3439 *v8::Handle<v8::Object>::Cast( |
3441 CcTest::global()->Get(v8_str("root")))); | 3440 CcTest::global()->Get(v8_str("root")))); |
3442 | 3441 |
3443 // The root object should be in a sane state. | 3442 // The root object should be in a sane state. |
3444 CHECK(root->IsJSObject()); | 3443 CHECK(root->IsJSObject()); |
3445 CHECK(root->map()->IsMap()); | 3444 CHECK(root->map()->IsMap()); |
3446 } | 3445 } |
3447 | 3446 |
3448 | 3447 |
3449 TEST(Regress2143b) { | 3448 TEST(Regress2143b) { |
3450 i::FLAG_collect_maps = true; | |
3451 i::FLAG_incremental_marking = true; | 3449 i::FLAG_incremental_marking = true; |
3452 i::FLAG_allow_natives_syntax = true; | 3450 i::FLAG_allow_natives_syntax = true; |
3453 CcTest::InitializeVM(); | 3451 CcTest::InitializeVM(); |
3454 v8::HandleScope scope(CcTest::isolate()); | 3452 v8::HandleScope scope(CcTest::isolate()); |
3455 | 3453 |
3456 // Prepare a map transition from the root object together with a yet | 3454 // Prepare a map transition from the root object together with a yet |
3457 // untransitioned root object. | 3455 // untransitioned root object. |
3458 CompileRun("var root = new Object;" | 3456 CompileRun("var root = new Object;" |
3459 "root.foo = 0;" | 3457 "root.foo = 0;" |
3460 "root = new Object;"); | 3458 "root = new Object;"); |
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 size_t counter2 = 2000; | 5961 size_t counter2 = 2000; |
5964 tracer->SampleAllocation(time2, counter2, counter2); | 5962 tracer->SampleAllocation(time2, counter2, counter2); |
5965 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5963 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5966 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5964 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
5967 int time3 = 1000; | 5965 int time3 = 1000; |
5968 size_t counter3 = 30000; | 5966 size_t counter3 = 30000; |
5969 tracer->SampleAllocation(time3, counter3, counter3); | 5967 tracer->SampleAllocation(time3, counter3, counter3); |
5970 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5968 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5971 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5969 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
5972 } | 5970 } |
OLD | NEW |