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