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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 src_buffer[i] = to_non_zero(i); | 109 src_buffer[i] = to_non_zero(i); |
110 } | 110 } |
111 | 111 |
112 const int fuzz = 11; | 112 const int fuzz = 11; |
113 | 113 |
114 for (int size = 0; size < 600; size++) { | 114 for (int size = 0; size < 600; size++) { |
115 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { | 115 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { |
116 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { | 116 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { |
117 memset(dest_buffer, 0, data_size); | 117 memset(dest_buffer, 0, data_size); |
118 CHECK(dest + size < dest_buffer + data_size); | 118 CHECK(dest + size < dest_buffer + data_size); |
119 (void) CALL_GENERATED_CODE(f, reinterpret_cast<int>(src), | 119 (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int>(src), |
120 reinterpret_cast<int>(dest), size, 0, 0); | 120 reinterpret_cast<int>(dest), size, 0, 0); |
121 // a0 and a1 should point at the first byte after the copied data. | 121 // a0 and a1 should point at the first byte after the copied data. |
122 CHECK_EQ(src + size, a0_); | 122 CHECK_EQ(src + size, a0_); |
123 CHECK_EQ(dest + size, a1_); | 123 CHECK_EQ(dest + size, a1_); |
124 // Check that we haven't written outside the target area. | 124 // Check that we haven't written outside the target area. |
125 CHECK(all_zeroes(dest_buffer, dest)); | 125 CHECK(all_zeroes(dest_buffer, dest)); |
126 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); | 126 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); |
127 // Check the target area. | 127 // Check the target area. |
128 CHECK_EQ(0, memcmp(src, dest, size)); | 128 CHECK_EQ(0, memcmp(src, dest, size)); |
129 } | 129 } |
130 } | 130 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 CodeDesc desc; | 248 CodeDesc desc; |
249 masm->GetCode(&desc); | 249 masm->GetCode(&desc); |
250 Handle<Code> code = isolate->factory()->NewCode( | 250 Handle<Code> code = isolate->factory()->NewCode( |
251 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 251 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
252 #ifdef OBJECT_PRINT | 252 #ifdef OBJECT_PRINT |
253 code->Print(std::cout); | 253 code->Print(std::cout); |
254 #endif | 254 #endif |
255 F1 f = FUNCTION_CAST<F1>(code->entry()); | 255 F1 f = FUNCTION_CAST<F1>(code->entry()); |
256 for (int i = 0; i < kNumCases; ++i) { | 256 for (int i = 0; i < kNumCases; ++i) { |
257 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0)); | 257 int res = |
| 258 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
258 ::printf("f(%d) = %d\n", i, res); | 259 ::printf("f(%d) = %d\n", i, res); |
259 CHECK_EQ(values[i], res); | 260 CHECK_EQ(values[i], res); |
260 } | 261 } |
261 } | 262 } |
262 | 263 |
263 | 264 |
264 #undef __ | 265 #undef __ |
OLD | NEW |