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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 CHECK(act_size >= static_cast<size_t>(data_size)); | 78 CHECK(act_size >= static_cast<size_t>(data_size)); |
79 byte* dest_buffer = | 79 byte* dest_buffer = |
80 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); | 80 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); |
81 CHECK(dest_buffer); | 81 CHECK(dest_buffer); |
82 CHECK(act_size >= static_cast<size_t>(data_size)); | 82 CHECK(act_size >= static_cast<size_t>(data_size)); |
83 | 83 |
84 // Storage for a0 and a1. | 84 // Storage for a0 and a1. |
85 byte* a0_; | 85 byte* a0_; |
86 byte* a1_; | 86 byte* a1_; |
87 | 87 |
88 MacroAssembler assembler(isolate, NULL, 0); | 88 MacroAssembler assembler(isolate, NULL, 0, |
| 89 v8::internal::CodeObjectRequired::kYes); |
89 MacroAssembler* masm = &assembler; | 90 MacroAssembler* masm = &assembler; |
90 | 91 |
91 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and | 92 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and |
92 // a1, respectively. | 93 // a1, respectively. |
93 __ CopyBytes(a0, a1, a2, a3); | 94 __ CopyBytes(a0, a1, a2, a3); |
94 __ li(a2, Operand(reinterpret_cast<int>(&a0_))); | 95 __ li(a2, Operand(reinterpret_cast<int>(&a0_))); |
95 __ li(a3, Operand(reinterpret_cast<int>(&a1_))); | 96 __ li(a3, Operand(reinterpret_cast<int>(&a1_))); |
96 __ sw(a0, MemOperand(a2)); | 97 __ sw(a0, MemOperand(a2)); |
97 __ jr(ra); | 98 __ jr(ra); |
98 __ sw(a1, MemOperand(a3)); | 99 __ sw(a1, MemOperand(a3)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 | 182 |
182 TEST(jump_tables4) { | 183 TEST(jump_tables4) { |
183 // Similar to test-assembler-mips jump_tables1, with extra test for branch | 184 // Similar to test-assembler-mips jump_tables1, with extra test for branch |
184 // trampoline required before emission of the dd table (where trampolines are | 185 // trampoline required before emission of the dd table (where trampolines are |
185 // blocked), and proper transition to long-branch mode. | 186 // blocked), and proper transition to long-branch mode. |
186 // Regression test for v8:4294. | 187 // Regression test for v8:4294. |
187 CcTest::InitializeVM(); | 188 CcTest::InitializeVM(); |
188 Isolate* isolate = CcTest::i_isolate(); | 189 Isolate* isolate = CcTest::i_isolate(); |
189 HandleScope scope(isolate); | 190 HandleScope scope(isolate); |
190 MacroAssembler assembler(isolate, NULL, 0); | 191 MacroAssembler assembler(isolate, NULL, 0, |
| 192 v8::internal::CodeObjectRequired::kYes); |
191 MacroAssembler* masm = &assembler; | 193 MacroAssembler* masm = &assembler; |
192 | 194 |
193 const int kNumCases = 512; | 195 const int kNumCases = 512; |
194 int values[kNumCases]; | 196 int values[kNumCases]; |
195 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 197 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
196 Label labels[kNumCases]; | 198 Label labels[kNumCases]; |
197 Label near_start, end; | 199 Label near_start, end; |
198 | 200 |
199 __ addiu(sp, sp, -4); | 201 __ addiu(sp, sp, -4); |
200 __ sw(ra, MemOperand(sp)); | 202 __ sw(ra, MemOperand(sp)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 for (int i = 0; i < kNumCases; ++i) { | 258 for (int i = 0; i < kNumCases; ++i) { |
257 int res = | 259 int res = |
258 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); | 260 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); |
259 ::printf("f(%d) = %d\n", i, res); | 261 ::printf("f(%d) = %d\n", i, res); |
260 CHECK_EQ(values[i], res); | 262 CHECK_EQ(values[i], res); |
261 } | 263 } |
262 } | 264 } |
263 | 265 |
264 | 266 |
265 #undef __ | 267 #undef __ |
OLD | NEW |