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/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 CommonOperatorBuilder common(zone); | 40 CommonOperatorBuilder common(zone); |
41 // FunctionTester (ab)uses a 4-argument function | 41 // FunctionTester (ab)uses a 4-argument function |
42 Node* start = graph.NewNode(common.Start(6)); | 42 Node* start = graph.NewNode(common.Start(6)); |
43 // Parameter 0 is the receiver | 43 // Parameter 0 is the receiver |
44 Node* receiverParam = graph.NewNode(common.Parameter(1), start); | 44 Node* receiverParam = graph.NewNode(common.Parameter(1), start); |
45 Node* nameParam = graph.NewNode(common.Parameter(2), start); | 45 Node* nameParam = graph.NewNode(common.Parameter(2), start); |
46 Node* slotParam = graph.NewNode(common.Parameter(3), start); | 46 Node* slotParam = graph.NewNode(common.Parameter(3), start); |
47 Node* vectorParam = graph.NewNode(common.Parameter(4), start); | 47 Node* vectorParam = graph.NewNode(common.Parameter(4), start); |
48 Node* theCode = graph.NewNode(common.HeapConstant(code)); | 48 Node* theCode = graph.NewNode(common.HeapConstant(code)); |
49 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); | 49 Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); |
50 Node* zero = graph.NewNode(common.Int32Constant(0)); | |
51 Node* call = | 50 Node* call = |
52 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, | 51 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, |
53 slotParam, vectorParam, dummyContext, start, start); | 52 slotParam, vectorParam, dummyContext, start, start); |
54 Node* ret = graph.NewNode(common.Return(), zero, call, call, start); | 53 Node* ret = graph.NewNode(common.Return(), call, call, start); |
55 Node* end = graph.NewNode(common.End(1), ret); | 54 Node* end = graph.NewNode(common.End(1), ret); |
56 graph.SetStart(start); | 55 graph.SetStart(start); |
57 graph.SetEnd(end); | 56 graph.SetEnd(end); |
58 FunctionTester ft(&graph, 4); | 57 FunctionTester ft(&graph, 4); |
59 | 58 |
60 // Actuall call through to the stub, verifying its result. | 59 // Actuall call through to the stub, verifying its result. |
61 const char* testString = "Und das Lamm schrie HURZ!"; | 60 const char* testString = "Und das Lamm schrie HURZ!"; |
62 Handle<JSReceiver> receiverArg = | 61 Handle<JSReceiver> receiverArg = |
63 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); | 62 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); |
64 Handle<String> nameArg = ft.Val("length"); | 63 Handle<String> nameArg = ft.Val("length"); |
65 Handle<Object> slot = ft.Val(0.0); | 64 Handle<Object> slot = ft.Val(0.0); |
66 Handle<Object> vector = ft.Val(0.0); | 65 Handle<Object> vector = ft.Val(0.0); |
67 Handle<Object> result = | 66 Handle<Object> result = |
68 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); | 67 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); |
69 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); | 68 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); |
70 } | 69 } |
71 | 70 |
72 | 71 |
73 } // namespace compiler | 72 } // namespace compiler |
74 } // namespace internal | 73 } // namespace internal |
75 } // namespace v8 | 74 } // namespace v8 |
OLD | NEW |