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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 src_buffer[i] = to_non_zero(i); | 110 src_buffer[i] = to_non_zero(i); |
111 } | 111 } |
112 | 112 |
113 const int fuzz = 11; | 113 const int fuzz = 11; |
114 | 114 |
115 for (int size = 0; size < 600; size++) { | 115 for (int size = 0; size < 600; size++) { |
116 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { | 116 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { |
117 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { | 117 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { |
118 memset(dest_buffer, 0, data_size); | 118 memset(dest_buffer, 0, data_size); |
119 CHECK(dest + size < dest_buffer + data_size); | 119 CHECK(dest + size < dest_buffer + data_size); |
120 (void) CALL_GENERATED_CODE(f, reinterpret_cast<int64_t>(src), | 120 (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int64_t>(src), |
121 reinterpret_cast<int64_t>(dest), | 121 reinterpret_cast<int64_t>(dest), size, 0, 0); |
122 size, 0, 0); | |
123 // a0 and a1 should point at the first byte after the copied data. | 122 // a0 and a1 should point at the first byte after the copied data. |
124 CHECK_EQ(src + size, a0_); | 123 CHECK_EQ(src + size, a0_); |
125 CHECK_EQ(dest + size, a1_); | 124 CHECK_EQ(dest + size, a1_); |
126 // Check that we haven't written outside the target area. | 125 // Check that we haven't written outside the target area. |
127 CHECK(all_zeroes(dest_buffer, dest)); | 126 CHECK(all_zeroes(dest_buffer, dest)); |
128 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); | 127 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); |
129 // Check the target area. | 128 // Check the target area. |
130 CHECK_EQ(0, memcmp(src, dest, size)); | 129 CHECK_EQ(0, memcmp(src, dest, size)); |
131 } | 130 } |
132 } | 131 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 164 |
166 __ jr(ra); | 165 __ jr(ra); |
167 __ nop(); | 166 __ nop(); |
168 | 167 |
169 CodeDesc desc; | 168 CodeDesc desc; |
170 masm->GetCode(&desc); | 169 masm->GetCode(&desc); |
171 Handle<Code> code = isolate->factory()->NewCode( | 170 Handle<Code> code = isolate->factory()->NewCode( |
172 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 171 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
173 | 172 |
174 ::F f = FUNCTION_CAST< ::F>(code->entry()); | 173 ::F f = FUNCTION_CAST< ::F>(code->entry()); |
175 (void) CALL_GENERATED_CODE(f, reinterpret_cast<int64_t>(result), | 174 (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int64_t>(result), 0, 0, |
176 0, 0, 0, 0); | 175 0, 0); |
177 // Check results. | 176 // Check results. |
178 for (int i = 0; i < 64; i++) { | 177 for (int i = 0; i < 64; i++) { |
179 CHECK(refConstants[i] == result[i]); | 178 CHECK(refConstants[i] == result[i]); |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 | 182 |
184 TEST(LoadAddress) { | 183 TEST(LoadAddress) { |
185 CcTest::InitializeVM(); | 184 CcTest::InitializeVM(); |
186 Isolate* isolate = Isolate::Current(); | 185 Isolate* isolate = Isolate::Current(); |
(...skipping 22 matching lines...) Expand all Loading... |
209 __ stop("invalid"); | 208 __ stop("invalid"); |
210 __ stop("invalid"); | 209 __ stop("invalid"); |
211 | 210 |
212 | 211 |
213 CodeDesc desc; | 212 CodeDesc desc; |
214 masm->GetCode(&desc); | 213 masm->GetCode(&desc); |
215 Handle<Code> code = isolate->factory()->NewCode( | 214 Handle<Code> code = isolate->factory()->NewCode( |
216 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 215 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
217 | 216 |
218 ::F f = FUNCTION_CAST< ::F>(code->entry()); | 217 ::F f = FUNCTION_CAST< ::F>(code->entry()); |
219 (void) CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0); | 218 (void)CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0); |
220 // Check results. | 219 // Check results. |
221 } | 220 } |
222 | 221 |
223 | 222 |
224 TEST(jump_tables4) { | 223 TEST(jump_tables4) { |
225 // Similar to test-assembler-mips jump_tables1, with extra test for branch | 224 // Similar to test-assembler-mips jump_tables1, with extra test for branch |
226 // trampoline required before emission of the dd table (where trampolines are | 225 // trampoline required before emission of the dd table (where trampolines are |
227 // blocked), and proper transition to long-branch mode. | 226 // blocked), and proper transition to long-branch mode. |
228 // Regression test for v8:4294. | 227 // Regression test for v8:4294. |
229 CcTest::InitializeVM(); | 228 CcTest::InitializeVM(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 291 |
293 CodeDesc desc; | 292 CodeDesc desc; |
294 masm->GetCode(&desc); | 293 masm->GetCode(&desc); |
295 Handle<Code> code = isolate->factory()->NewCode( | 294 Handle<Code> code = isolate->factory()->NewCode( |
296 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 295 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
297 #ifdef OBJECT_PRINT | 296 #ifdef OBJECT_PRINT |
298 code->Print(std::cout); | 297 code->Print(std::cout); |
299 #endif | 298 #endif |
300 F1 f = FUNCTION_CAST<F1>(code->entry()); | 299 F1 f = FUNCTION_CAST<F1>(code->entry()); |
301 for (int i = 0; i < kNumCases; ++i) { | 300 for (int i = 0; i < kNumCases; ++i) { |
302 int64_t res = | 301 int64_t res = reinterpret_cast<int64_t>( |
303 reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0)); | 302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
304 ::printf("f(%d) = %" PRId64 "\n", i, res); | 303 ::printf("f(%d) = %" PRId64 "\n", i, res); |
305 CHECK_EQ(values[i], res); | 304 CHECK_EQ(values[i], res); |
306 } | 305 } |
307 } | 306 } |
308 | 307 |
309 #undef __ | 308 #undef __ |
OLD | NEW |