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

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

Powered by Google App Engine
This is Rietveld 408576698