OLD | NEW |
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 #include "src/assembler.h" | 5 #include "src/assembler.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/raw-machine-assembler.h" | 8 #include "src/compiler/raw-machine-assembler.h" |
9 #include "src/machine-type.h" | 9 #include "src/machine-type.h" |
10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) { | 353 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) { |
354 Node* offset = raw.Int32Constant(index * sizeof(CType)); | 354 Node* offset = raw.Int32Constant(index * sizeof(CType)); |
355 return raw.Load(MachineTypeForC<CType>(), base, offset); | 355 return raw.Load(MachineTypeForC<CType>(), base, offset); |
356 } | 356 } |
357 | 357 |
358 Node* StoreOutput(RawMachineAssembler& raw, Node* value) { | 358 Node* StoreOutput(RawMachineAssembler& raw, Node* value) { |
359 Node* base = raw.PointerConstant(&output); | 359 Node* base = raw.PointerConstant(&output); |
360 Node* offset = raw.Int32Constant(0); | 360 Node* offset = raw.Int32Constant(0); |
361 return raw.Store(MachineTypeForC<CType>(), base, offset, value, | 361 return raw.Store(MachineTypeForC<CType>().representation(), base, offset, |
362 kNoWriteBarrier); | 362 value, kNoWriteBarrier); |
363 } | 363 } |
364 | 364 |
365 // Computes the next set of inputs by updating the {input} array. | 365 // Computes the next set of inputs by updating the {input} array. |
366 void Mutate(); | 366 void Mutate(); |
367 | 367 |
368 void Reset() { memset(input, 0, sizeof(input)); } | 368 void Reset() { memset(input, 0, sizeof(input)); } |
369 | 369 |
370 int count_; | 370 int count_; |
371 int seed_; | 371 int seed_; |
372 CType input[kMaxParamCount]; | 372 CType input[kMaxParamCount]; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 HandleScope scope(isolate); | 562 HandleScope scope(isolate); |
563 Handle<Code> inner = Handle<Code>::null(); | 563 Handle<Code> inner = Handle<Code>::null(); |
564 { | 564 { |
565 // Writes all parameters into the output buffer. | 565 // Writes all parameters into the output buffer. |
566 Zone zone; | 566 Zone zone; |
567 Graph graph(&zone); | 567 Graph graph(&zone); |
568 RawMachineAssembler raw(isolate, &graph, desc); | 568 RawMachineAssembler raw(isolate, &graph, desc); |
569 Node* base = raw.PointerConstant(output); | 569 Node* base = raw.PointerConstant(output); |
570 for (int i = 0; i < kNumParams; i++) { | 570 for (int i = 0; i < kNumParams; i++) { |
571 Node* offset = raw.Int32Constant(i * sizeof(int32_t)); | 571 Node* offset = raw.Int32Constant(i * sizeof(int32_t)); |
572 raw.Store(MachineType::Int32(), base, offset, raw.Parameter(i), | 572 raw.Store(MachineRepresentation::kWord32, base, offset, raw.Parameter(i), |
573 kNoWriteBarrier); | 573 kNoWriteBarrier); |
574 } | 574 } |
575 raw.Return(raw.Int32Constant(42)); | 575 raw.Return(raw.Int32Constant(42)); |
576 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); | 576 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); |
577 } | 577 } |
578 | 578 |
579 CSignature0<int32_t> csig; | 579 CSignature0<int32_t> csig; |
580 Handle<Code> wrapper = Handle<Code>::null(); | 580 Handle<Code> wrapper = Handle<Code>::null(); |
581 { | 581 { |
582 // Loads parameters from the input buffer and calls the above code. | 582 // Loads parameters from the input buffer and calls the above code. |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 konst = raw.Float64Constant(value[0]); | 1126 konst = raw.Float64Constant(value[0]); |
1127 if (i == which) memcpy(bytes, value, expected_size = 8); | 1127 if (i == which) memcpy(bytes, value, expected_size = 8); |
1128 } | 1128 } |
1129 CHECK_NOT_NULL(konst); | 1129 CHECK_NOT_NULL(konst); |
1130 | 1130 |
1131 args[i] = konst; | 1131 args[i] = konst; |
1132 constant += 0x1010101010101010; | 1132 constant += 0x1010101010101010; |
1133 } | 1133 } |
1134 | 1134 |
1135 Node* call = raw.CallN(desc, target, args); | 1135 Node* call = raw.CallN(desc, target, args); |
1136 Node* store = raw.StoreToPointer(output, sig->GetReturn(), call); | 1136 Node* store = |
| 1137 raw.StoreToPointer(output, sig->GetReturn().representation(), call); |
1137 USE(store); | 1138 USE(store); |
1138 expected_ret = static_cast<int32_t>(constant); | 1139 expected_ret = static_cast<int32_t>(constant); |
1139 raw.Return(raw.Int32Constant(expected_ret)); | 1140 raw.Return(raw.Int32Constant(expected_ret)); |
1140 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph, | 1141 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph, |
1141 raw.Export()); | 1142 raw.Export()); |
1142 } | 1143 } |
1143 | 1144 |
1144 CodeRunner<int32_t> runnable(isolate, wrapper, &csig); | 1145 CodeRunner<int32_t> runnable(isolate, wrapper, &csig); |
1145 CHECK_EQ(expected_ret, runnable.Call()); | 1146 CHECK_EQ(expected_ret, runnable.Call()); |
1146 for (int i = 0; i < expected_size; i++) { | 1147 for (int i = 0; i < expected_size; i++) { |
1147 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i])); | 1148 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i])); |
1148 } | 1149 } |
1149 } | 1150 } |
1150 } | 1151 } |
1151 } | 1152 } |
1152 | 1153 |
1153 | 1154 |
1154 TEST(MixedParams_0) { MixedParamTest(0); } | 1155 TEST(MixedParams_0) { MixedParamTest(0); } |
1155 TEST(MixedParams_1) { MixedParamTest(1); } | 1156 TEST(MixedParams_1) { MixedParamTest(1); } |
1156 TEST(MixedParams_2) { MixedParamTest(2); } | 1157 TEST(MixedParams_2) { MixedParamTest(2); } |
1157 TEST(MixedParams_3) { MixedParamTest(3); } | 1158 TEST(MixedParams_3) { MixedParamTest(3); } |
1158 | 1159 |
1159 } // namespace compiler | 1160 } // namespace compiler |
1160 } // namespace internal | 1161 } // namespace internal |
1161 } // namespace v8 | 1162 } // namespace v8 |
OLD | NEW |