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

Side by Side Diff: test/cctest/compiler/test-run-native-calls.cc

Issue 1424983003: [turbofan] Cleanup RawMachineAssembler::Store interface. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 5 years, 1 month 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(jochen): Remove this after the setting is turned on globally. 5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS 6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) { 359 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) {
360 Node* offset = raw.Int32Constant(index * sizeof(CType)); 360 Node* offset = raw.Int32Constant(index * sizeof(CType));
361 return raw.Load(MachineTypeForC<CType>(), base, offset); 361 return raw.Load(MachineTypeForC<CType>(), base, offset);
362 } 362 }
363 363
364 Node* StoreOutput(RawMachineAssembler& raw, Node* value) { 364 Node* StoreOutput(RawMachineAssembler& raw, Node* value) {
365 Node* base = raw.PointerConstant(&output); 365 Node* base = raw.PointerConstant(&output);
366 Node* offset = raw.Int32Constant(0); 366 Node* offset = raw.Int32Constant(0);
367 return raw.Store(StoreRepresentationForC<CType>(kNoWriteBarrier), base, 367 return raw.Store(MachineTypeForC<CType>(), base, offset, value,
368 offset, value); 368 kNoWriteBarrier);
369 } 369 }
370 370
371 // Computes the next set of inputs by updating the {input} array. 371 // Computes the next set of inputs by updating the {input} array.
372 void Mutate(); 372 void Mutate();
373 373
374 void Reset() { memset(input, 0, sizeof(input)); } 374 void Reset() { memset(input, 0, sizeof(input)); }
375 375
376 int count_; 376 int count_;
377 int seed_; 377 int seed_;
378 CType input[kMaxParamCount]; 378 CType input[kMaxParamCount];
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 HandleScope scope(isolate); 570 HandleScope scope(isolate);
571 Handle<Code> inner = Handle<Code>::null(); 571 Handle<Code> inner = Handle<Code>::null();
572 { 572 {
573 // Writes all parameters into the output buffer. 573 // Writes all parameters into the output buffer.
574 Zone zone; 574 Zone zone;
575 Graph graph(&zone); 575 Graph graph(&zone);
576 RawMachineAssembler raw(isolate, &graph, desc); 576 RawMachineAssembler raw(isolate, &graph, desc);
577 Node* base = raw.PointerConstant(output); 577 Node* base = raw.PointerConstant(output);
578 for (int i = 0; i < kNumParams; i++) { 578 for (int i = 0; i < kNumParams; i++) {
579 Node* offset = raw.Int32Constant(i * sizeof(int32_t)); 579 Node* offset = raw.Int32Constant(i * sizeof(int32_t));
580 raw.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier), base, offset, 580 raw.Store(kMachInt32, base, offset, raw.Parameter(i), kNoWriteBarrier);
581 raw.Parameter(i));
582 } 581 }
583 raw.Return(raw.Int32Constant(42)); 582 raw.Return(raw.Int32Constant(42));
584 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); 583 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export());
585 } 584 }
586 585
587 CSignature0<int32_t> csig; 586 CSignature0<int32_t> csig;
588 Handle<Code> wrapper = Handle<Code>::null(); 587 Handle<Code> wrapper = Handle<Code>::null();
589 { 588 {
590 // Loads parameters from the input buffer and calls the above code. 589 // Loads parameters from the input buffer and calls the above code.
591 Zone zone; 590 Zone zone;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 konst = raw.Float64Constant(value[0]); 1138 konst = raw.Float64Constant(value[0]);
1140 if (i == which) memcpy(bytes, value, expected_size = 8); 1139 if (i == which) memcpy(bytes, value, expected_size = 8);
1141 } 1140 }
1142 CHECK_NOT_NULL(konst); 1141 CHECK_NOT_NULL(konst);
1143 1142
1144 args[i] = konst; 1143 args[i] = konst;
1145 constant += 0x1010101010101010; 1144 constant += 0x1010101010101010;
1146 } 1145 }
1147 1146
1148 Node* call = raw.CallN(desc, target, args); 1147 Node* call = raw.CallN(desc, target, args);
1149 StoreRepresentation store_rep(sig->GetReturn(), kNoWriteBarrier); 1148 Node* store = raw.StoreToPointer(output, sig->GetReturn(), call);
1150 Node* store = raw.StoreToPointer(output, store_rep, call);
1151 USE(store); 1149 USE(store);
1152 expected_ret = static_cast<int32_t>(constant); 1150 expected_ret = static_cast<int32_t>(constant);
1153 raw.Return(raw.Int32Constant(expected_ret)); 1151 raw.Return(raw.Int32Constant(expected_ret));
1154 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph, 1152 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph,
1155 raw.Export()); 1153 raw.Export());
1156 } 1154 }
1157 1155
1158 CodeRunner<int32_t> runnable(isolate, wrapper, &csig); 1156 CodeRunner<int32_t> runnable(isolate, wrapper, &csig);
1159 CHECK_EQ(expected_ret, runnable.Call()); 1157 CHECK_EQ(expected_ret, runnable.Call());
1160 for (int i = 0; i < expected_size; i++) { 1158 for (int i = 0; i < expected_size; i++) {
1161 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i])); 1159 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i]));
1162 } 1160 }
1163 } 1161 }
1164 } 1162 }
1165 } 1163 }
1166 1164
1167 1165
1168 TEST(MixedParams_0) { MixedParamTest(0); } 1166 TEST(MixedParams_0) { MixedParamTest(0); }
1169 TEST(MixedParams_1) { MixedParamTest(1); } 1167 TEST(MixedParams_1) { MixedParamTest(1); }
1170 TEST(MixedParams_2) { MixedParamTest(2); } 1168 TEST(MixedParams_2) { MixedParamTest(2); }
1171 TEST(MixedParams_3) { MixedParamTest(3); } 1169 TEST(MixedParams_3) { MixedParamTest(3); }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-machops.cc ('k') | test/unittests/compiler/arm/instruction-selector-arm-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698