| 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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/js-operator.h" | 10 #include "src/compiler/js-operator.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 Graph graph(zone); | 34 Graph graph(zone); |
| 35 CommonOperatorBuilder common(zone); | 35 CommonOperatorBuilder common(zone); |
| 36 JSOperatorBuilder javascript(zone); | 36 JSOperatorBuilder javascript(zone); |
| 37 MachineOperatorBuilder machine(zone); | 37 MachineOperatorBuilder machine(zone); |
| 38 JSGraph js(isolate, &graph, &common, &javascript, &machine); | 38 JSGraph js(isolate, &graph, &common, &javascript, &machine); |
| 39 | 39 |
| 40 // FunctionTester (ab)uses a 2-argument function | 40 // FunctionTester (ab)uses a 2-argument function |
| 41 Node* start = graph.NewNode(common.Start(4)); | 41 Node* start = graph.NewNode(common.Start(4)); |
| 42 // Parameter 0 is the number to round | 42 // Parameter 0 is the number to round |
| 43 Node* numberParam = graph.NewNode(common.Parameter(1), start); | 43 Node* numberParam = graph.NewNode(common.Parameter(1), start); |
| 44 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 44 Node* theCode = graph.NewNode(common.HeapConstant(code)); |
| 45 Node* theCode = graph.NewNode(common.HeapConstant(u)); | 45 Node* vector = graph.NewNode(common.HeapConstant(tv)); |
| 46 Unique<HeapObject> tvu = Unique<HeapObject>::CreateImmovable(tv); | |
| 47 Node* vector = graph.NewNode(common.HeapConstant(tvu)); | |
| 48 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 46 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
| 49 Node* call = | 47 Node* call = |
| 50 graph.NewNode(common.Call(descriptor), theCode, js.UndefinedConstant(), | 48 graph.NewNode(common.Call(descriptor), theCode, js.UndefinedConstant(), |
| 51 js.OneConstant(), vector, js.UndefinedConstant(), | 49 js.OneConstant(), vector, js.UndefinedConstant(), |
| 52 numberParam, dummyContext, start, start); | 50 numberParam, dummyContext, start, start); |
| 53 Node* ret = graph.NewNode(common.Return(), call, call, start); | 51 Node* ret = graph.NewNode(common.Return(), call, call, start); |
| 54 Node* end = graph.NewNode(common.End(1), ret); | 52 Node* end = graph.NewNode(common.End(1), ret); |
| 55 graph.SetStart(start); | 53 graph.SetStart(start); |
| 56 graph.SetEnd(end); | 54 graph.SetEnd(end); |
| 57 FunctionTester ft(&graph); | 55 FunctionTester ft(&graph); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 // Create a function to call the code using the descriptor. | 74 // Create a function to call the code using the descriptor. |
| 77 Graph graph(zone); | 75 Graph graph(zone); |
| 78 CommonOperatorBuilder common(zone); | 76 CommonOperatorBuilder common(zone); |
| 79 // FunctionTester (ab)uses a 4-argument function | 77 // FunctionTester (ab)uses a 4-argument function |
| 80 Node* start = graph.NewNode(common.Start(6)); | 78 Node* start = graph.NewNode(common.Start(6)); |
| 81 // Parameter 0 is the receiver | 79 // Parameter 0 is the receiver |
| 82 Node* receiverParam = graph.NewNode(common.Parameter(1), start); | 80 Node* receiverParam = graph.NewNode(common.Parameter(1), start); |
| 83 Node* nameParam = graph.NewNode(common.Parameter(2), start); | 81 Node* nameParam = graph.NewNode(common.Parameter(2), start); |
| 84 Node* slotParam = graph.NewNode(common.Parameter(3), start); | 82 Node* slotParam = graph.NewNode(common.Parameter(3), start); |
| 85 Node* vectorParam = graph.NewNode(common.Parameter(4), start); | 83 Node* vectorParam = graph.NewNode(common.Parameter(4), start); |
| 86 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 84 Node* theCode = graph.NewNode(common.HeapConstant(code)); |
| 87 Node* theCode = graph.NewNode(common.HeapConstant(u)); | |
| 88 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 85 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
| 89 Node* call = | 86 Node* call = |
| 90 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, | 87 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, |
| 91 slotParam, vectorParam, dummyContext, start, start); | 88 slotParam, vectorParam, dummyContext, start, start); |
| 92 Node* ret = graph.NewNode(common.Return(), call, call, start); | 89 Node* ret = graph.NewNode(common.Return(), call, call, start); |
| 93 Node* end = graph.NewNode(common.End(1), ret); | 90 Node* end = graph.NewNode(common.End(1), ret); |
| 94 graph.SetStart(start); | 91 graph.SetStart(start); |
| 95 graph.SetEnd(end); | 92 graph.SetEnd(end); |
| 96 FunctionTester ft(&graph); | 93 FunctionTester ft(&graph); |
| 97 | 94 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 120 CallDescriptor* descriptor = Linkage::ComputeIncoming(zone, &info); | 117 CallDescriptor* descriptor = Linkage::ComputeIncoming(zone, &info); |
| 121 | 118 |
| 122 // Create a function to call the code using the descriptor. | 119 // Create a function to call the code using the descriptor. |
| 123 Graph graph(zone); | 120 Graph graph(zone); |
| 124 CommonOperatorBuilder common(zone); | 121 CommonOperatorBuilder common(zone); |
| 125 // FunctionTester (ab)uses a 2-argument function | 122 // FunctionTester (ab)uses a 2-argument function |
| 126 Node* start = graph.NewNode(common.Start(4)); | 123 Node* start = graph.NewNode(common.Start(4)); |
| 127 // Parameter 0 is the receiver | 124 // Parameter 0 is the receiver |
| 128 Node* leftParam = graph.NewNode(common.Parameter(1), start); | 125 Node* leftParam = graph.NewNode(common.Parameter(1), start); |
| 129 Node* rightParam = graph.NewNode(common.Parameter(2), start); | 126 Node* rightParam = graph.NewNode(common.Parameter(2), start); |
| 130 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 127 Node* theCode = graph.NewNode(common.HeapConstant(code)); |
| 131 Node* theCode = graph.NewNode(common.HeapConstant(u)); | |
| 132 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 128 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
| 133 Node* call = graph.NewNode(common.Call(descriptor), theCode, leftParam, | 129 Node* call = graph.NewNode(common.Call(descriptor), theCode, leftParam, |
| 134 rightParam, dummyContext, start, start); | 130 rightParam, dummyContext, start, start); |
| 135 Node* ret = graph.NewNode(common.Return(), call, call, start); | 131 Node* ret = graph.NewNode(common.Return(), call, call, start); |
| 136 Node* end = graph.NewNode(common.End(1), ret); | 132 Node* end = graph.NewNode(common.End(1), ret); |
| 137 graph.SetStart(start); | 133 graph.SetStart(start); |
| 138 graph.SetEnd(end); | 134 graph.SetEnd(end); |
| 139 FunctionTester ft(&graph); | 135 FunctionTester ft(&graph); |
| 140 | 136 |
| 141 // Actuall call through to the stub, verifying its result. | 137 // Actuall call through to the stub, verifying its result. |
| 142 Handle<String> leftArg = ft.Val("links"); | 138 Handle<String> leftArg = ft.Val("links"); |
| 143 Handle<String> rightArg = ft.Val("rechts"); | 139 Handle<String> rightArg = ft.Val("rechts"); |
| 144 Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked(); | 140 Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked(); |
| 145 CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result))); | 141 CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result))); |
| 146 } | 142 } |
| OLD | NEW |