Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: test/cctest/test-macro-assembler-mips64.cc

Issue 1476763002: Make whether or not a Code object should be created by masm explicit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: enum class FTW Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 CHECK(act_size >= static_cast<size_t>(data_size)); 79 CHECK(act_size >= static_cast<size_t>(data_size));
80 byte* dest_buffer = 80 byte* dest_buffer =
81 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); 81 static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0));
82 CHECK(dest_buffer); 82 CHECK(dest_buffer);
83 CHECK(act_size >= static_cast<size_t>(data_size)); 83 CHECK(act_size >= static_cast<size_t>(data_size));
84 84
85 // Storage for a0 and a1. 85 // Storage for a0 and a1.
86 byte* a0_; 86 byte* a0_;
87 byte* a1_; 87 byte* a1_;
88 88
89 MacroAssembler assembler(isolate, NULL, 0); 89 MacroAssembler assembler(isolate, NULL, 0,
90 v8::internal::CodeObjectRequired::kYes);
90 MacroAssembler* masm = &assembler; 91 MacroAssembler* masm = &assembler;
91 92
92 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and 93 // Code to be generated: The stuff in CopyBytes followed by a store of a0 and
93 // a1, respectively. 94 // a1, respectively.
94 __ CopyBytes(a0, a1, a2, a3); 95 __ CopyBytes(a0, a1, a2, a3);
95 __ li(a2, Operand(reinterpret_cast<int64_t>(&a0_))); 96 __ li(a2, Operand(reinterpret_cast<int64_t>(&a0_)));
96 __ li(a3, Operand(reinterpret_cast<int64_t>(&a1_))); 97 __ li(a3, Operand(reinterpret_cast<int64_t>(&a1_)));
97 __ sd(a0, MemOperand(a2)); 98 __ sd(a0, MemOperand(a2));
98 __ jr(ra); 99 __ jr(ra);
99 __ sd(a1, MemOperand(a3)); 100 __ sd(a1, MemOperand(a3));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 HandleScope handles(isolate); 145 HandleScope handles(isolate);
145 146
146 int64_t refConstants[64]; 147 int64_t refConstants[64];
147 int64_t result[64]; 148 int64_t result[64];
148 149
149 int64_t mask = 1; 150 int64_t mask = 1;
150 for (int i = 0; i < 64; i++) { 151 for (int i = 0; i < 64; i++) {
151 refConstants[i] = ~(mask << i); 152 refConstants[i] = ~(mask << i);
152 } 153 }
153 154
154 MacroAssembler assembler(isolate, NULL, 0); 155 MacroAssembler assembler(isolate, NULL, 0,
156 v8::internal::CodeObjectRequired::kYes);
155 MacroAssembler* masm = &assembler; 157 MacroAssembler* masm = &assembler;
156 158
157 __ mov(a4, a0); 159 __ mov(a4, a0);
158 for (int i = 0; i < 64; i++) { 160 for (int i = 0; i < 64; i++) {
159 // Load constant. 161 // Load constant.
160 __ li(a5, Operand(refConstants[i])); 162 __ li(a5, Operand(refConstants[i]));
161 __ sd(a5, MemOperand(a4)); 163 __ sd(a5, MemOperand(a4));
162 __ Daddu(a4, a4, Operand(kPointerSize)); 164 __ Daddu(a4, a4, Operand(kPointerSize));
163 } 165 }
164 166
(...skipping 13 matching lines...) Expand all
178 CHECK(refConstants[i] == result[i]); 180 CHECK(refConstants[i] == result[i]);
179 } 181 }
180 } 182 }
181 183
182 184
183 TEST(LoadAddress) { 185 TEST(LoadAddress) {
184 CcTest::InitializeVM(); 186 CcTest::InitializeVM();
185 Isolate* isolate = CcTest::i_isolate(); 187 Isolate* isolate = CcTest::i_isolate();
186 HandleScope handles(isolate); 188 HandleScope handles(isolate);
187 189
188 MacroAssembler assembler(isolate, NULL, 0); 190 MacroAssembler assembler(isolate, NULL, 0,
191 v8::internal::CodeObjectRequired::kYes);
189 MacroAssembler* masm = &assembler; 192 MacroAssembler* masm = &assembler;
190 Label to_jump, skip; 193 Label to_jump, skip;
191 __ mov(a4, a0); 194 __ mov(a4, a0);
192 195
193 __ Branch(&skip); 196 __ Branch(&skip);
194 __ bind(&to_jump); 197 __ bind(&to_jump);
195 __ nop(); 198 __ nop();
196 __ nop(); 199 __ nop();
197 __ jr(ra); 200 __ jr(ra);
198 __ nop(); 201 __ nop();
(...skipping 22 matching lines...) Expand all
221 224
222 225
223 TEST(jump_tables4) { 226 TEST(jump_tables4) {
224 // Similar to test-assembler-mips jump_tables1, with extra test for branch 227 // Similar to test-assembler-mips jump_tables1, with extra test for branch
225 // trampoline required before emission of the dd table (where trampolines are 228 // trampoline required before emission of the dd table (where trampolines are
226 // blocked), and proper transition to long-branch mode. 229 // blocked), and proper transition to long-branch mode.
227 // Regression test for v8:4294. 230 // Regression test for v8:4294.
228 CcTest::InitializeVM(); 231 CcTest::InitializeVM();
229 Isolate* isolate = CcTest::i_isolate(); 232 Isolate* isolate = CcTest::i_isolate();
230 HandleScope scope(isolate); 233 HandleScope scope(isolate);
231 MacroAssembler assembler(isolate, NULL, 0); 234 MacroAssembler assembler(isolate, NULL, 0,
235 v8::internal::CodeObjectRequired::kYes);
232 MacroAssembler* masm = &assembler; 236 MacroAssembler* masm = &assembler;
233 237
234 const int kNumCases = 512; 238 const int kNumCases = 512;
235 int values[kNumCases]; 239 int values[kNumCases];
236 isolate->random_number_generator()->NextBytes(values, sizeof(values)); 240 isolate->random_number_generator()->NextBytes(values, sizeof(values));
237 Label labels[kNumCases]; 241 Label labels[kNumCases];
238 Label near_start, end; 242 Label near_start, end;
239 243
240 __ daddiu(sp, sp, -8); 244 __ daddiu(sp, sp, -8);
241 __ sd(ra, MemOperand(sp)); 245 __ sd(ra, MemOperand(sp));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 F1 f = FUNCTION_CAST<F1>(code->entry()); 303 F1 f = FUNCTION_CAST<F1>(code->entry());
300 for (int i = 0; i < kNumCases; ++i) { 304 for (int i = 0; i < kNumCases; ++i) {
301 int64_t res = reinterpret_cast<int64_t>( 305 int64_t res = reinterpret_cast<int64_t>(
302 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0)); 306 CALL_GENERATED_CODE(isolate, f, i, 0, 0, 0, 0));
303 ::printf("f(%d) = %" PRId64 "\n", i, res); 307 ::printf("f(%d) = %" PRId64 "\n", i, res);
304 CHECK_EQ(values[i], res); 308 CHECK_EQ(values[i], res);
305 } 309 }
306 } 310 }
307 311
308 #undef __ 312 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-mips.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698