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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Node* start = graph.NewNode(common.Start(2)); | 43 Node* start = graph.NewNode(common.Start(2)); |
44 // Parameter 0 is the number to round | 44 // Parameter 0 is the number to round |
45 Node* numberParam = graph.NewNode(common.Parameter(1), start); | 45 Node* numberParam = graph.NewNode(common.Parameter(1), start); |
46 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 46 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); |
47 Node* theCode = graph.NewNode(common.HeapConstant(u)); | 47 Node* theCode = graph.NewNode(common.HeapConstant(u)); |
48 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 48 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
49 Node* call = graph.NewNode(common.Call(descriptor), theCode, | 49 Node* call = graph.NewNode(common.Call(descriptor), theCode, |
50 js.UndefinedConstant(), js.UndefinedConstant(), | 50 js.UndefinedConstant(), js.UndefinedConstant(), |
51 numberParam, dummyContext, start, start); | 51 numberParam, dummyContext, start, start); |
52 Node* ret = graph.NewNode(common.Return(), call, call, start); | 52 Node* ret = graph.NewNode(common.Return(), call, call, start); |
53 Node* end = graph.NewNode(common.End(), ret); | 53 Node* end = graph.NewNode(common.End(1), ret); |
54 graph.SetStart(start); | 54 graph.SetStart(start); |
55 graph.SetEnd(end); | 55 graph.SetEnd(end); |
56 FunctionTester ft(&graph); | 56 FunctionTester ft(&graph); |
57 | 57 |
58 Handle<Object> value = ft.Val(1.5); | 58 Handle<Object> value = ft.Val(1.5); |
59 Handle<Object> result = ft.Call(value, value).ToHandleChecked(); | 59 Handle<Object> result = ft.Call(value, value).ToHandleChecked(); |
60 CHECK_EQ(1, Smi::cast(*result)->value()); | 60 CHECK_EQ(1, Smi::cast(*result)->value()); |
61 } | 61 } |
62 | 62 |
63 | 63 |
(...skipping 18 matching lines...) Expand all Loading... |
82 Node* nameParam = graph.NewNode(common.Parameter(2), start); | 82 Node* nameParam = graph.NewNode(common.Parameter(2), start); |
83 Node* slotParam = graph.NewNode(common.Parameter(3), start); | 83 Node* slotParam = graph.NewNode(common.Parameter(3), start); |
84 Node* vectorParam = graph.NewNode(common.Parameter(4), start); | 84 Node* vectorParam = graph.NewNode(common.Parameter(4), start); |
85 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 85 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); |
86 Node* theCode = graph.NewNode(common.HeapConstant(u)); | 86 Node* theCode = graph.NewNode(common.HeapConstant(u)); |
87 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 87 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
88 Node* call = | 88 Node* call = |
89 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, | 89 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, |
90 slotParam, vectorParam, dummyContext, start, start); | 90 slotParam, vectorParam, dummyContext, start, start); |
91 Node* ret = graph.NewNode(common.Return(), call, call, start); | 91 Node* ret = graph.NewNode(common.Return(), call, call, start); |
92 Node* end = graph.NewNode(common.End(), ret); | 92 Node* end = graph.NewNode(common.End(1), ret); |
93 graph.SetStart(start); | 93 graph.SetStart(start); |
94 graph.SetEnd(end); | 94 graph.SetEnd(end); |
95 FunctionTester ft(&graph); | 95 FunctionTester ft(&graph); |
96 | 96 |
97 // Actuall call through to the stub, verifying its result. | 97 // Actuall call through to the stub, verifying its result. |
98 const char* testString = "Und das Lamm schrie HURZ!"; | 98 const char* testString = "Und das Lamm schrie HURZ!"; |
99 Handle<JSReceiver> receiverArg = | 99 Handle<JSReceiver> receiverArg = |
100 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); | 100 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); |
101 Handle<String> nameArg = ft.Val("length"); | 101 Handle<String> nameArg = ft.Val("length"); |
102 Handle<Object> slot = ft.Val(0.0); | 102 Handle<Object> slot = ft.Val(0.0); |
(...skipping 22 matching lines...) Expand all Loading... |
125 Node* start = graph.NewNode(common.Start(2)); | 125 Node* start = graph.NewNode(common.Start(2)); |
126 // Parameter 0 is the receiver | 126 // Parameter 0 is the receiver |
127 Node* leftParam = graph.NewNode(common.Parameter(1), start); | 127 Node* leftParam = graph.NewNode(common.Parameter(1), start); |
128 Node* rightParam = graph.NewNode(common.Parameter(2), start); | 128 Node* rightParam = graph.NewNode(common.Parameter(2), start); |
129 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); | 129 Unique<HeapObject> u = Unique<HeapObject>::CreateImmovable(code); |
130 Node* theCode = graph.NewNode(common.HeapConstant(u)); | 130 Node* theCode = graph.NewNode(common.HeapConstant(u)); |
131 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 131 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
132 Node* call = graph.NewNode(common.Call(descriptor), theCode, leftParam, | 132 Node* call = graph.NewNode(common.Call(descriptor), theCode, leftParam, |
133 rightParam, dummyContext, start, start); | 133 rightParam, dummyContext, start, start); |
134 Node* ret = graph.NewNode(common.Return(), call, call, start); | 134 Node* ret = graph.NewNode(common.Return(), call, call, start); |
135 Node* end = graph.NewNode(common.End(), ret); | 135 Node* end = graph.NewNode(common.End(1), ret); |
136 graph.SetStart(start); | 136 graph.SetStart(start); |
137 graph.SetEnd(end); | 137 graph.SetEnd(end); |
138 FunctionTester ft(&graph); | 138 FunctionTester ft(&graph); |
139 | 139 |
140 // Actuall call through to the stub, verifying its result. | 140 // Actuall call through to the stub, verifying its result. |
141 Handle<String> leftArg = ft.Val("links"); | 141 Handle<String> leftArg = ft.Val("links"); |
142 Handle<String> rightArg = ft.Val("rechts"); | 142 Handle<String> rightArg = ft.Val("rechts"); |
143 Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked(); | 143 Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked(); |
144 CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result))); | 144 CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result))); |
145 } | 145 } |
146 | 146 |
147 #endif // V8_TURBOFAN_TARGET | 147 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |