| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 for (int i = 0; i < param_count; i++) { | 274 for (int i = 0; i < param_count; i++) { |
| 275 args[index] = b.graph()->NewNode(b.common()->Parameter(i), start); | 275 args[index] = b.graph()->NewNode(b.common()->Parameter(i), start); |
| 276 index++; | 276 index++; |
| 277 } | 277 } |
| 278 args[index++] = start; // effect. | 278 args[index++] = start; // effect. |
| 279 args[index++] = start; // control. | 279 args[index++] = start; // control. |
| 280 | 280 |
| 281 // Build the call and return nodes. | 281 // Build the call and return nodes. |
| 282 Node* call = | 282 Node* call = |
| 283 b.graph()->NewNode(b.common()->Call(desc), param_count + 3, args); | 283 b.graph()->NewNode(b.common()->Call(desc), param_count + 3, args); |
| 284 Node* ret = b.graph()->NewNode(b.common()->Return(), call, call, start); | 284 Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); |
| 285 Node* ret = |
| 286 b.graph()->NewNode(b.common()->Return(), zero, call, call, start); |
| 285 b.graph()->SetEnd(ret); | 287 b.graph()->SetEnd(ret); |
| 286 } | 288 } |
| 287 | 289 |
| 288 MachineSignature* msig = desc->GetMachineSignature(&zone); | 290 MachineSignature* msig = desc->GetMachineSignature(&zone); |
| 289 CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, msig); | 291 CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, msig); |
| 290 | 292 |
| 291 return CompileGraph("wrapper", cdesc, caller.graph()); | 293 return CompileGraph("wrapper", cdesc, caller.graph()); |
| 292 } | 294 } |
| 293 | 295 |
| 294 | 296 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 Zone zone(isolate->allocator(), ZONE_NAME); | 514 Zone zone(isolate->allocator(), ZONE_NAME); |
| 513 GraphAndBuilders inner(&zone); | 515 GraphAndBuilders inner(&zone); |
| 514 { | 516 { |
| 515 // Build the add function. | 517 // Build the add function. |
| 516 GraphAndBuilders& b = inner; | 518 GraphAndBuilders& b = inner; |
| 517 Node* start = b.graph()->NewNode(b.common()->Start(5)); | 519 Node* start = b.graph()->NewNode(b.common()->Start(5)); |
| 518 b.graph()->SetStart(start); | 520 b.graph()->SetStart(start); |
| 519 Node* p0 = b.graph()->NewNode(b.common()->Parameter(0), start); | 521 Node* p0 = b.graph()->NewNode(b.common()->Parameter(0), start); |
| 520 Node* p1 = b.graph()->NewNode(b.common()->Parameter(1), start); | 522 Node* p1 = b.graph()->NewNode(b.common()->Parameter(1), start); |
| 521 Node* add = b.graph()->NewNode(b.machine()->Int32Sub(), p0, p1); | 523 Node* add = b.graph()->NewNode(b.machine()->Int32Sub(), p0, p1); |
| 522 Node* ret = b.graph()->NewNode(b.common()->Return(), add, start, start); | 524 Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); |
| 525 Node* ret = |
| 526 b.graph()->NewNode(b.common()->Return(), zero, add, start, start); |
| 523 b.graph()->SetEnd(ret); | 527 b.graph()->SetEnd(ret); |
| 524 } | 528 } |
| 525 | 529 |
| 526 Handle<Code> inner_code = CompileGraph("Int32Sub", desc, inner.graph()); | 530 Handle<Code> inner_code = CompileGraph("Int32Sub", desc, inner.graph()); |
| 527 Handle<Code> wrapper = WrapWithCFunction(inner_code, desc); | 531 Handle<Code> wrapper = WrapWithCFunction(inner_code, desc); |
| 528 MachineSignature* msig = desc->GetMachineSignature(&zone); | 532 MachineSignature* msig = desc->GetMachineSignature(&zone); |
| 529 CodeRunner<int32_t> runnable(isolate, wrapper, | 533 CodeRunner<int32_t> runnable(isolate, wrapper, |
| 530 CSignature::FromMachine(&zone, msig)); | 534 CSignature::FromMachine(&zone, msig)); |
| 531 | 535 |
| 532 FOR_INT32_INPUTS(i) { | 536 FOR_INT32_INPUTS(i) { |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 TestStackSlot(MachineType::Float32(), magic); | 1196 TestStackSlot(MachineType::Float32(), magic); |
| 1193 } | 1197 } |
| 1194 | 1198 |
| 1195 TEST(RunStackSlotFloat64) { | 1199 TEST(RunStackSlotFloat64) { |
| 1196 double magic = 3456.375; | 1200 double magic = 3456.375; |
| 1197 TestStackSlot(MachineType::Float64(), magic); | 1201 TestStackSlot(MachineType::Float64(), magic); |
| 1198 } | 1202 } |
| 1199 } // namespace compiler | 1203 } // namespace compiler |
| 1200 } // namespace internal | 1204 } // namespace internal |
| 1201 } // namespace v8 | 1205 } // namespace v8 |
| OLD | NEW |