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/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/compiler/raw-machine-assembler.h" | 9 #include "src/compiler/raw-machine-assembler.h" |
10 #include "src/register-configuration.h" | 10 #include "src/register-configuration.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 } | 349 } |
350 | 350 |
351 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) { | 351 Node* LoadInput(RawMachineAssembler& raw, Node* base, int index) { |
352 Node* offset = raw.Int32Constant(index * sizeof(CType)); | 352 Node* offset = raw.Int32Constant(index * sizeof(CType)); |
353 return raw.Load(MachineTypeForC<CType>(), base, offset); | 353 return raw.Load(MachineTypeForC<CType>(), base, offset); |
354 } | 354 } |
355 | 355 |
356 Node* StoreOutput(RawMachineAssembler& raw, Node* value) { | 356 Node* StoreOutput(RawMachineAssembler& raw, Node* value) { |
357 Node* base = raw.PointerConstant(&output); | 357 Node* base = raw.PointerConstant(&output); |
358 Node* offset = raw.Int32Constant(0); | 358 Node* offset = raw.Int32Constant(0); |
359 return raw.Store(MachineTypeForC<CType>(), base, offset, value); | 359 return raw.Store(StoreRepresentationForC<CType>(kNoWriteBarrier), base, |
| 360 offset, value); |
360 } | 361 } |
361 | 362 |
362 // Computes the next set of inputs by updating the {input} array. | 363 // Computes the next set of inputs by updating the {input} array. |
363 void Mutate(); | 364 void Mutate(); |
364 | 365 |
365 void Reset() { memset(input, 0, sizeof(input)); } | 366 void Reset() { memset(input, 0, sizeof(input)); } |
366 | 367 |
367 int count_; | 368 int count_; |
368 int seed_; | 369 int seed_; |
369 CType input[kMaxParamCount]; | 370 CType input[kMaxParamCount]; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 HandleScope scope(isolate); | 562 HandleScope scope(isolate); |
562 Handle<Code> inner = Handle<Code>::null(); | 563 Handle<Code> inner = Handle<Code>::null(); |
563 { | 564 { |
564 // Writes all parameters into the output buffer. | 565 // Writes all parameters into the output buffer. |
565 Zone zone; | 566 Zone zone; |
566 Graph graph(&zone); | 567 Graph graph(&zone); |
567 RawMachineAssembler raw(isolate, &graph, desc); | 568 RawMachineAssembler raw(isolate, &graph, desc); |
568 Node* base = raw.PointerConstant(output); | 569 Node* base = raw.PointerConstant(output); |
569 for (int i = 0; i < kNumParams; i++) { | 570 for (int i = 0; i < kNumParams; i++) { |
570 Node* offset = raw.Int32Constant(i * sizeof(int32_t)); | 571 Node* offset = raw.Int32Constant(i * sizeof(int32_t)); |
571 raw.Store(kMachInt32, base, offset, raw.Parameter(i)); | 572 raw.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier), base, offset, |
| 573 raw.Parameter(i)); |
572 } | 574 } |
573 raw.Return(raw.Int32Constant(42)); | 575 raw.Return(raw.Int32Constant(42)); |
574 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); | 576 inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export()); |
575 } | 577 } |
576 | 578 |
577 CSignature0<int32_t> csig; | 579 CSignature0<int32_t> csig; |
578 Handle<Code> wrapper = Handle<Code>::null(); | 580 Handle<Code> wrapper = Handle<Code>::null(); |
579 { | 581 { |
580 // Loads parameters from the input buffer and calls the above code. | 582 // Loads parameters from the input buffer and calls the above code. |
581 Zone zone; | 583 Zone zone; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 konst = raw.Float64Constant(value[0]); | 1113 konst = raw.Float64Constant(value[0]); |
1112 if (i == which) memcpy(bytes, value, expected_size = 8); | 1114 if (i == which) memcpy(bytes, value, expected_size = 8); |
1113 } | 1115 } |
1114 CHECK_NOT_NULL(konst); | 1116 CHECK_NOT_NULL(konst); |
1115 | 1117 |
1116 args[i] = konst; | 1118 args[i] = konst; |
1117 constant += 0x1010101010101010; | 1119 constant += 0x1010101010101010; |
1118 } | 1120 } |
1119 | 1121 |
1120 Node* call = raw.CallN(desc, target, args); | 1122 Node* call = raw.CallN(desc, target, args); |
1121 Node* store = raw.StoreToPointer(output, sig->GetReturn(), call); | 1123 StoreRepresentation store_rep(sig->GetReturn(), kNoWriteBarrier); |
| 1124 Node* store = raw.StoreToPointer(output, store_rep, call); |
1122 USE(store); | 1125 USE(store); |
1123 expected_ret = static_cast<int32_t>(constant); | 1126 expected_ret = static_cast<int32_t>(constant); |
1124 raw.Return(raw.Int32Constant(expected_ret)); | 1127 raw.Return(raw.Int32Constant(expected_ret)); |
1125 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph, | 1128 wrapper = CompileGraph("Select-mixed-wrapper-const", cdesc, &graph, |
1126 raw.Export()); | 1129 raw.Export()); |
1127 } | 1130 } |
1128 | 1131 |
1129 CodeRunner<int32_t> runnable(isolate, wrapper, &csig); | 1132 CodeRunner<int32_t> runnable(isolate, wrapper, &csig); |
1130 CHECK_EQ(expected_ret, runnable.Call()); | 1133 CHECK_EQ(expected_ret, runnable.Call()); |
1131 for (int i = 0; i < expected_size; i++) { | 1134 for (int i = 0; i < expected_size; i++) { |
1132 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i])); | 1135 CHECK_EQ(static_cast<int>(bytes[i]), static_cast<int>(output[i])); |
1133 } | 1136 } |
1134 } | 1137 } |
1135 } | 1138 } |
1136 } | 1139 } |
1137 | 1140 |
1138 | 1141 |
1139 TEST(MixedParams_0) { MixedParamTest(0); } | 1142 TEST(MixedParams_0) { MixedParamTest(0); } |
1140 TEST(MixedParams_1) { MixedParamTest(1); } | 1143 TEST(MixedParams_1) { MixedParamTest(1); } |
1141 TEST(MixedParams_2) { MixedParamTest(2); } | 1144 TEST(MixedParams_2) { MixedParamTest(2); } |
1142 TEST(MixedParams_3) { MixedParamTest(3); } | 1145 TEST(MixedParams_3) { MixedParamTest(3); } |
OLD | NEW |