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 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); | 1736 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); |
1737 int size_with_regexp = static_cast<int>(CcTest::heap()->SizeOfObjects()); | 1737 int size_with_regexp = static_cast<int>(CcTest::heap()->SizeOfObjects()); |
1738 | 1738 |
1739 CompileRun("'foo'.match(half_size_reg_exp);"); | 1739 CompileRun("'foo'.match(half_size_reg_exp);"); |
1740 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); | 1740 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); |
1741 int size_with_optimized_regexp = | 1741 int size_with_optimized_regexp = |
1742 static_cast<int>(CcTest::heap()->SizeOfObjects()); | 1742 static_cast<int>(CcTest::heap()->SizeOfObjects()); |
1743 | 1743 |
1744 int size_of_regexp_code = size_with_regexp - initial_size; | 1744 int size_of_regexp_code = size_with_regexp - initial_size; |
1745 | 1745 |
1746 CHECK_LE(size_of_regexp_code, 500 * KB); | 1746 CHECK_LE(size_of_regexp_code, 1 * MB); |
1747 | 1747 |
1748 // Small regexp is half the size, but compiles to more than twice the code | 1748 // Small regexp is half the size, but compiles to more than twice the code |
1749 // due to the optimization steps. | 1749 // due to the optimization steps. |
1750 CHECK_GE(size_with_optimized_regexp, | 1750 CHECK_GE(size_with_optimized_regexp, |
1751 size_with_regexp + size_of_regexp_code * 2); | 1751 size_with_regexp + size_of_regexp_code * 2); |
1752 } | 1752 } |
1753 | 1753 |
1754 | 1754 |
1755 TEST(TestSizeOfObjects) { | 1755 TEST(TestSizeOfObjects) { |
1756 v8::V8::Initialize(); | 1756 v8::V8::Initialize(); |
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5009 #ifdef DEBUG | 5009 #ifdef DEBUG |
5010 TEST(PathTracer) { | 5010 TEST(PathTracer) { |
5011 CcTest::InitializeVM(); | 5011 CcTest::InitializeVM(); |
5012 v8::HandleScope scope(CcTest::isolate()); | 5012 v8::HandleScope scope(CcTest::isolate()); |
5013 | 5013 |
5014 v8::Local<v8::Value> result = CompileRun("'abc'"); | 5014 v8::Local<v8::Value> result = CompileRun("'abc'"); |
5015 Handle<Object> o = v8::Utils::OpenHandle(*result); | 5015 Handle<Object> o = v8::Utils::OpenHandle(*result); |
5016 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 5016 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
5017 } | 5017 } |
5018 #endif // DEBUG | 5018 #endif // DEBUG |
OLD | NEW |