| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // R1, respectively. | 84 // R1, respectively. |
| 85 __ CopyBytes(r0, r1, r2, r3); | 85 __ CopyBytes(r0, r1, r2, r3); |
| 86 __ mov(r2, Operand(reinterpret_cast<int>(&r0_))); | 86 __ mov(r2, Operand(reinterpret_cast<int>(&r0_))); |
| 87 __ mov(r3, Operand(reinterpret_cast<int>(&r1_))); | 87 __ mov(r3, Operand(reinterpret_cast<int>(&r1_))); |
| 88 __ str(r0, MemOperand(r2)); | 88 __ str(r0, MemOperand(r2)); |
| 89 __ str(r1, MemOperand(r3)); | 89 __ str(r1, MemOperand(r3)); |
| 90 __ bx(lr); | 90 __ bx(lr); |
| 91 | 91 |
| 92 CodeDesc desc; | 92 CodeDesc desc; |
| 93 masm->GetCode(&desc); | 93 masm->GetCode(&desc); |
| 94 Object* code = isolate->heap()->CreateCode( | 94 Handle<Code> code = isolate->factory()->NewCode( |
| 95 desc, | 95 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 96 Code::ComputeFlags(Code::STUB), | |
| 97 Handle<Code>())->ToObjectChecked(); | |
| 98 CHECK(code->IsCode()); | |
| 99 | 96 |
| 100 F f = FUNCTION_CAST<F>(Code::cast(code)->entry()); | 97 F f = FUNCTION_CAST<F>(code->entry()); |
| 101 | 98 |
| 102 // Initialise source data with non-zero bytes. | 99 // Initialise source data with non-zero bytes. |
| 103 for (int i = 0; i < data_size; i++) { | 100 for (int i = 0; i < data_size; i++) { |
| 104 src_buffer[i] = to_non_zero(i); | 101 src_buffer[i] = to_non_zero(i); |
| 105 } | 102 } |
| 106 | 103 |
| 107 const int fuzz = 11; | 104 const int fuzz = 11; |
| 108 | 105 |
| 109 for (int size = 0; size < 600; size++) { | 106 for (int size = 0; size < 600; size++) { |
| 110 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { | 107 for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 __ cmp(r3, r2); | 208 __ cmp(r3, r2); |
| 212 __ b(ne, &exit); | 209 __ b(ne, &exit); |
| 213 | 210 |
| 214 __ mov(r0, Operand(0)); // Success. | 211 __ mov(r0, Operand(0)); // Success. |
| 215 __ bind(&exit); | 212 __ bind(&exit); |
| 216 __ add(sp, sp, Operand(1 * kPointerSize)); | 213 __ add(sp, sp, Operand(1 * kPointerSize)); |
| 217 __ bx(lr); | 214 __ bx(lr); |
| 218 | 215 |
| 219 CodeDesc desc; | 216 CodeDesc desc; |
| 220 masm->GetCode(&desc); | 217 masm->GetCode(&desc); |
| 221 Object* code = isolate->heap()->CreateCode( | 218 Handle<Code> code = isolate->factory()->NewCode( |
| 222 desc, | 219 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 223 Code::ComputeFlags(Code::STUB), | |
| 224 Handle<Code>())->ToObjectChecked(); | |
| 225 CHECK(code->IsCode()); | |
| 226 | 220 |
| 227 // Call the function from C++. | 221 // Call the function from C++. |
| 228 F5 f = FUNCTION_CAST<F5>(Code::cast(code)->entry()); | 222 F5 f = FUNCTION_CAST<F5>(code->entry()); |
| 229 CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); | 223 CHECK_EQ(0, CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); |
| 230 } | 224 } |
| 231 | 225 |
| 232 #undef __ | 226 #undef __ |
| OLD | NEW |