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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 for (int i = 0; i < param_count; i++) { | 286 for (int i = 0; i < param_count; i++) { |
287 args[index] = b.graph()->NewNode(b.common()->Parameter(i), start); | 287 args[index] = b.graph()->NewNode(b.common()->Parameter(i), start); |
288 index++; | 288 index++; |
289 } | 289 } |
290 args[index++] = start; // effect. | 290 args[index++] = start; // effect. |
291 args[index++] = start; // control. | 291 args[index++] = start; // control. |
292 | 292 |
293 // Build the call and return nodes. | 293 // Build the call and return nodes. |
294 Node* call = | 294 Node* call = |
295 b.graph()->NewNode(b.common()->Call(desc), param_count + 3, args); | 295 b.graph()->NewNode(b.common()->Call(desc), param_count + 3, args); |
296 Node* ret = b.graph()->NewNode(b.common()->Return(), call, call, start); | 296 Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); |
| 297 Node* ret = |
| 298 b.graph()->NewNode(b.common()->Return(), zero, call, call, start); |
297 b.graph()->SetEnd(ret); | 299 b.graph()->SetEnd(ret); |
298 } | 300 } |
299 | 301 |
300 MachineSignature* msig = desc->GetMachineSignature(&zone); | 302 MachineSignature* msig = desc->GetMachineSignature(&zone); |
301 CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, msig); | 303 CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, msig); |
302 | 304 |
303 return CompileGraph("wrapper", cdesc, caller.graph()); | 305 return CompileGraph("wrapper", cdesc, caller.graph()); |
304 } | 306 } |
305 | 307 |
306 | 308 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 Zone zone(isolate->allocator(), ZONE_NAME); | 526 Zone zone(isolate->allocator(), ZONE_NAME); |
525 GraphAndBuilders inner(&zone); | 527 GraphAndBuilders inner(&zone); |
526 { | 528 { |
527 // Build the add function. | 529 // Build the add function. |
528 GraphAndBuilders& b = inner; | 530 GraphAndBuilders& b = inner; |
529 Node* start = b.graph()->NewNode(b.common()->Start(5)); | 531 Node* start = b.graph()->NewNode(b.common()->Start(5)); |
530 b.graph()->SetStart(start); | 532 b.graph()->SetStart(start); |
531 Node* p0 = b.graph()->NewNode(b.common()->Parameter(0), start); | 533 Node* p0 = b.graph()->NewNode(b.common()->Parameter(0), start); |
532 Node* p1 = b.graph()->NewNode(b.common()->Parameter(1), start); | 534 Node* p1 = b.graph()->NewNode(b.common()->Parameter(1), start); |
533 Node* add = b.graph()->NewNode(b.machine()->Int32Sub(), p0, p1); | 535 Node* add = b.graph()->NewNode(b.machine()->Int32Sub(), p0, p1); |
534 Node* ret = b.graph()->NewNode(b.common()->Return(), add, start, start); | 536 Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); |
| 537 Node* ret = |
| 538 b.graph()->NewNode(b.common()->Return(), zero, add, start, start); |
535 b.graph()->SetEnd(ret); | 539 b.graph()->SetEnd(ret); |
536 } | 540 } |
537 | 541 |
538 Handle<Code> inner_code = CompileGraph("Int32Sub", desc, inner.graph()); | 542 Handle<Code> inner_code = CompileGraph("Int32Sub", desc, inner.graph()); |
539 Handle<Code> wrapper = WrapWithCFunction(inner_code, desc); | 543 Handle<Code> wrapper = WrapWithCFunction(inner_code, desc); |
540 MachineSignature* msig = desc->GetMachineSignature(&zone); | 544 MachineSignature* msig = desc->GetMachineSignature(&zone); |
541 CodeRunner<int32_t> runnable(isolate, wrapper, | 545 CodeRunner<int32_t> runnable(isolate, wrapper, |
542 CSignature::FromMachine(&zone, msig)); | 546 CSignature::FromMachine(&zone, msig)); |
543 | 547 |
544 FOR_INT32_INPUTS(i) { | 548 FOR_INT32_INPUTS(i) { |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 TestStackSlot(MachineType::Float32(), magic); | 1208 TestStackSlot(MachineType::Float32(), magic); |
1205 } | 1209 } |
1206 | 1210 |
1207 TEST(RunStackSlotFloat64) { | 1211 TEST(RunStackSlotFloat64) { |
1208 double magic = 3456.375; | 1212 double magic = 3456.375; |
1209 TestStackSlot(MachineType::Float64(), magic); | 1213 TestStackSlot(MachineType::Float64(), magic); |
1210 } | 1214 } |
1211 } // namespace compiler | 1215 } // namespace compiler |
1212 } // namespace internal | 1216 } // namespace internal |
1213 } // namespace v8 | 1217 } // namespace v8 |
OLD | NEW |