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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 CHECK(act_size >= static_cast<size_t>(data_size)); | 77 CHECK(act_size >= static_cast<size_t>(data_size)); |
78 byte* dest_buffer = | 78 byte* dest_buffer = |
79 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); | 79 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); |
80 CHECK(dest_buffer); | 80 CHECK(dest_buffer); |
81 CHECK(act_size >= static_cast<size_t>(data_size)); | 81 CHECK(act_size >= static_cast<size_t>(data_size)); |
82 | 82 |
83 // Storage for R0 and R1. | 83 // Storage for R0 and R1. |
84 byte* r0_; | 84 byte* r0_; |
85 byte* r1_; | 85 byte* r1_; |
86 | 86 |
87 MacroAssembler assembler(isolate, NULL, 0); | 87 MacroAssembler assembler(isolate, NULL, 0, |
| 88 v8::internal::CodeObjectRequired::kYes); |
88 MacroAssembler* masm = &assembler; | 89 MacroAssembler* masm = &assembler; |
89 | 90 |
90 // Code to be generated: The stuff in CopyBytes followed by a store of R0 and | 91 // Code to be generated: The stuff in CopyBytes followed by a store of R0 and |
91 // R1, respectively. | 92 // R1, respectively. |
92 __ CopyBytes(r0, r1, r2, r3); | 93 __ CopyBytes(r0, r1, r2, r3); |
93 __ mov(r2, Operand(reinterpret_cast<int>(&r0_))); | 94 __ mov(r2, Operand(reinterpret_cast<int>(&r0_))); |
94 __ mov(r3, Operand(reinterpret_cast<int>(&r1_))); | 95 __ mov(r3, Operand(reinterpret_cast<int>(&r1_))); |
95 __ str(r0, MemOperand(r2)); | 96 __ str(r0, MemOperand(r2)); |
96 __ str(r1, MemOperand(r3)); | 97 __ str(r1, MemOperand(r3)); |
97 __ bx(lr); | 98 __ bx(lr); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 141 |
141 | 142 |
142 TEST(LoadAndStoreWithRepresentation) { | 143 TEST(LoadAndStoreWithRepresentation) { |
143 // Allocate an executable page of memory. | 144 // Allocate an executable page of memory. |
144 size_t actual_size; | 145 size_t actual_size; |
145 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( | 146 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( |
146 Assembler::kMinimalBufferSize, &actual_size, true)); | 147 Assembler::kMinimalBufferSize, &actual_size, true)); |
147 CHECK(buffer); | 148 CHECK(buffer); |
148 Isolate* isolate = CcTest::i_isolate(); | 149 Isolate* isolate = CcTest::i_isolate(); |
149 HandleScope handles(isolate); | 150 HandleScope handles(isolate); |
150 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); | 151 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size), |
| 152 v8::internal::CodeObjectRequired::kYes); |
151 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. | 153 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. |
152 __ sub(sp, sp, Operand(1 * kPointerSize)); | 154 __ sub(sp, sp, Operand(1 * kPointerSize)); |
153 Label exit; | 155 Label exit; |
154 | 156 |
155 // Test 1. | 157 // Test 1. |
156 __ mov(r0, Operand(1)); // Test number. | 158 __ mov(r0, Operand(1)); // Test number. |
157 __ mov(r1, Operand(0)); | 159 __ mov(r1, Operand(0)); |
158 __ str(r1, MemOperand(sp, 0 * kPointerSize)); | 160 __ str(r1, MemOperand(sp, 0 * kPointerSize)); |
159 __ mov(r2, Operand(-1)); | 161 __ mov(r2, Operand(-1)); |
160 __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8()); | 162 __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 masm->GetCode(&desc); | 223 masm->GetCode(&desc); |
222 Handle<Code> code = isolate->factory()->NewCode( | 224 Handle<Code> code = isolate->factory()->NewCode( |
223 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 225 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
224 | 226 |
225 // Call the function from C++. | 227 // Call the function from C++. |
226 F5 f = FUNCTION_CAST<F5>(code->entry()); | 228 F5 f = FUNCTION_CAST<F5>(code->entry()); |
227 CHECK(!CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); | 229 CHECK(!CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); |
228 } | 230 } |
229 | 231 |
230 #undef __ | 232 #undef __ |
OLD | NEW |