| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 src_buffer[i] = to_non_zero(i); | 108 src_buffer[i] = to_non_zero(i); |
| 109 } | 109 } |
| 110 | 110 |
| 111 const int fuzz = 11; | 111 const int fuzz = 11; |
| 112 | 112 |
| 113 for (int size = 0; size < 600; size++) { | 113 for (int size = 0; size < 600; size++) { |
| 114 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { | 114 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { |
| 115 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { | 115 for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { |
| 116 memset(dest_buffer, 0, data_size); | 116 memset(dest_buffer, 0, data_size); |
| 117 CHECK(dest + size < dest_buffer + data_size); | 117 CHECK(dest + size < dest_buffer + data_size); |
| 118 (void) CALL_GENERATED_CODE(f, reinterpret_cast<int>(src), | 118 (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int>(src), |
| 119 reinterpret_cast<int>(dest), size, 0, 0); | 119 reinterpret_cast<int>(dest), size, 0, 0); |
| 120 // R0 and R1 should point at the first byte after the copied data. | 120 // R0 and R1 should point at the first byte after the copied data. |
| 121 CHECK_EQ(src + size, r0_); | 121 CHECK_EQ(src + size, r0_); |
| 122 CHECK_EQ(dest + size, r1_); | 122 CHECK_EQ(dest + size, r1_); |
| 123 // Check that we haven't written outside the target area. | 123 // Check that we haven't written outside the target area. |
| 124 CHECK(all_zeroes(dest_buffer, dest)); | 124 CHECK(all_zeroes(dest_buffer, dest)); |
| 125 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); | 125 CHECK(all_zeroes(dest + size, dest_buffer + data_size)); |
| 126 // Check the target area. | 126 // Check the target area. |
| 127 CHECK_EQ(0, memcmp(src, dest, size)); | 127 CHECK_EQ(0, memcmp(src, dest, size)); |
| 128 } | 128 } |
| 129 } | 129 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 __ add(sp, sp, Operand(1 * kPointerSize)); | 217 __ add(sp, sp, Operand(1 * kPointerSize)); |
| 218 __ bx(lr); | 218 __ bx(lr); |
| 219 | 219 |
| 220 CodeDesc desc; | 220 CodeDesc desc; |
| 221 masm->GetCode(&desc); | 221 masm->GetCode(&desc); |
| 222 Handle<Code> code = isolate->factory()->NewCode( | 222 Handle<Code> code = isolate->factory()->NewCode( |
| 223 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 223 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 224 | 224 |
| 225 // Call the function from C++. | 225 // Call the function from C++. |
| 226 F5 f = FUNCTION_CAST<F5>(code->entry()); | 226 F5 f = FUNCTION_CAST<F5>(code->entry()); |
| 227 CHECK(!CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); | 227 CHECK(!CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 #undef __ | 230 #undef __ |
| OLD | NEW |