| 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)); |
| 50 Node* call = | 51 Node* call = |
| 51 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, | 52 graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, |
| 52 slotParam, vectorParam, dummyContext, start, start); | 53 slotParam, vectorParam, dummyContext, start, start); |
| 53 Node* ret = graph.NewNode(common.Return(), call, call, start); | 54 Node* ret = graph.NewNode(common.Return(), zero, call, call, start); |
| 54 Node* end = graph.NewNode(common.End(1), ret); | 55 Node* end = graph.NewNode(common.End(1), ret); |
| 55 graph.SetStart(start); | 56 graph.SetStart(start); |
| 56 graph.SetEnd(end); | 57 graph.SetEnd(end); |
| 57 FunctionTester ft(&graph, 4); | 58 FunctionTester ft(&graph, 4); |
| 58 | 59 |
| 59 // Actuall call through to the stub, verifying its result. | 60 // Actuall call through to the stub, verifying its result. |
| 60 const char* testString = "Und das Lamm schrie HURZ!"; | 61 const char* testString = "Und das Lamm schrie HURZ!"; |
| 61 Handle<JSReceiver> receiverArg = | 62 Handle<JSReceiver> receiverArg = |
| 62 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); | 63 Object::ToObject(isolate, ft.Val(testString)).ToHandleChecked(); |
| 63 Handle<String> nameArg = ft.Val("length"); | 64 Handle<String> nameArg = ft.Val("length"); |
| 64 Handle<Object> slot = ft.Val(0.0); | 65 Handle<Object> slot = ft.Val(0.0); |
| 65 Handle<Object> vector = ft.Val(0.0); | 66 Handle<Object> vector = ft.Val(0.0); |
| 66 Handle<Object> result = | 67 Handle<Object> result = |
| 67 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); | 68 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); |
| 68 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); | 69 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 | 72 |
| 72 } // namespace compiler | 73 } // namespace compiler |
| 73 } // namespace internal | 74 } // namespace internal |
| 74 } // namespace v8 | 75 } // namespace v8 |
| OLD | NEW |