OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 10005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10016 AbsHelperX(-42); | 10016 AbsHelperX(-42); |
10017 AbsHelperX(kXMinInt); | 10017 AbsHelperX(kXMinInt); |
10018 AbsHelperX(kXMaxInt); | 10018 AbsHelperX(kXMaxInt); |
10019 | 10019 |
10020 AbsHelperW(0); | 10020 AbsHelperW(0); |
10021 AbsHelperW(42); | 10021 AbsHelperW(42); |
10022 AbsHelperW(-42); | 10022 AbsHelperW(-42); |
10023 AbsHelperW(kWMinInt); | 10023 AbsHelperW(kWMinInt); |
10024 AbsHelperW(kWMaxInt); | 10024 AbsHelperW(kWMaxInt); |
10025 } | 10025 } |
| 10026 |
| 10027 |
| 10028 TEST(pool_size) { |
| 10029 INIT_V8(); |
| 10030 SETUP(); |
| 10031 |
| 10032 // This test does not execute any code. It only tests that the size of the |
| 10033 // pools is read correctly from the RelocInfo. |
| 10034 |
| 10035 Label exit; |
| 10036 __ b(&exit); |
| 10037 |
| 10038 const unsigned constant_pool_size = 312; |
| 10039 const unsigned veneer_pool_size = 184; |
| 10040 |
| 10041 __ RecordConstPool(constant_pool_size); |
| 10042 for (unsigned i = 0; i < constant_pool_size / 4; ++i) { |
| 10043 __ dc32(0); |
| 10044 } |
| 10045 |
| 10046 __ RecordVeneerPool(masm.pc_offset(), veneer_pool_size); |
| 10047 for (unsigned i = 0; i < veneer_pool_size / kInstructionSize; ++i) { |
| 10048 __ nop(); |
| 10049 } |
| 10050 |
| 10051 __ bind(&exit); |
| 10052 |
| 10053 Heap* heap = isolate->heap(); |
| 10054 CodeDesc desc; |
| 10055 Object* code_object = NULL; |
| 10056 Code* code; |
| 10057 masm.GetCode(&desc); |
| 10058 MaybeObject* maybe_code = heap->CreateCode(desc, 0, masm.CodeObject()); |
| 10059 maybe_code->ToObject(&code_object); |
| 10060 code = Code::cast(code_object); |
| 10061 |
| 10062 unsigned pool_count = 0; |
| 10063 int pool_mask = RelocInfo::ModeMask(RelocInfo::CONST_POOL) | |
| 10064 RelocInfo::ModeMask(RelocInfo::VENEER_POOL); |
| 10065 for (RelocIterator it(code, pool_mask); !it.done(); it.next()) { |
| 10066 RelocInfo* info = it.rinfo(); |
| 10067 if (RelocInfo::IsConstPool(info->rmode())) { |
| 10068 ASSERT(info->data() == constant_pool_size); |
| 10069 ++pool_count; |
| 10070 } |
| 10071 if (RelocInfo::IsVeneerPool(info->rmode())) { |
| 10072 ASSERT(info->data() == veneer_pool_size); |
| 10073 ++pool_count; |
| 10074 } |
| 10075 } |
| 10076 |
| 10077 ASSERT(pool_count == 2); |
| 10078 |
| 10079 TEARDOWN(); |
| 10080 } |
OLD | NEW |