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" |
11 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
12 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
13 #include "src/compiler/pipeline.h" | 13 #include "src/compiler/pipeline.h" |
14 #include "src/parsing/parser.h" | 14 #include "src/parsing/parser.h" |
15 #include "test/cctest/compiler/function-tester.h" | 15 #include "test/cctest/compiler/function-tester.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
21 | 21 |
22 TEST(RunStringLengthStub) { | 22 TEST(RunStringLengthStub) { |
23 HandleAndZoneScope scope; | 23 HandleAndZoneScope scope; |
24 Isolate* isolate = scope.main_isolate(); | 24 Isolate* isolate = scope.main_isolate(); |
25 Zone* zone = scope.main_zone(); | 25 Zone* zone = scope.main_zone(); |
26 | 26 |
27 // Create code and an accompanying descriptor. | 27 // Create code and an accompanying descriptor. |
28 StringLengthStub stub(isolate); | 28 StringLengthStub stub(isolate); |
29 Handle<Code> code = stub.GenerateCode(); | 29 Handle<Code> code = stub.GenerateCode(); |
30 CompilationInfo info(&stub, isolate, zone); | 30 CompilationInfo info("test", isolate, zone, |
31 CallDescriptor* descriptor = Linkage::ComputeIncoming(zone, &info); | 31 Code::ComputeFlags(Code::HANDLER)); |
| 32 CallInterfaceDescriptor interface_descriptor = |
| 33 stub.GetCallInterfaceDescriptor(); |
| 34 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 35 isolate, zone, interface_descriptor, stub.GetStackParameterCount(), |
| 36 CallDescriptor::kNoFlags, Operator::kNoProperties); |
32 | 37 |
33 // Create a function to call the code using the descriptor. | 38 // Create a function to call the code using the descriptor. |
34 Graph graph(zone); | 39 Graph graph(zone); |
35 CommonOperatorBuilder common(zone); | 40 CommonOperatorBuilder common(zone); |
36 // FunctionTester (ab)uses a 4-argument function | 41 // FunctionTester (ab)uses a 4-argument function |
37 Node* start = graph.NewNode(common.Start(6)); | 42 Node* start = graph.NewNode(common.Start(6)); |
38 // Parameter 0 is the receiver | 43 // Parameter 0 is the receiver |
39 Node* receiverParam = graph.NewNode(common.Parameter(1), start); | 44 Node* receiverParam = graph.NewNode(common.Parameter(1), start); |
40 Node* nameParam = graph.NewNode(common.Parameter(2), start); | 45 Node* nameParam = graph.NewNode(common.Parameter(2), start); |
41 Node* slotParam = graph.NewNode(common.Parameter(3), start); | 46 Node* slotParam = graph.NewNode(common.Parameter(3), start); |
(...skipping 18 matching lines...) Expand all Loading... |
60 Handle<Object> vector = ft.Val(0.0); | 65 Handle<Object> vector = ft.Val(0.0); |
61 Handle<Object> result = | 66 Handle<Object> result = |
62 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); | 67 ft.Call(receiverArg, nameArg, slot, vector).ToHandleChecked(); |
63 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); | 68 CHECK_EQ(static_cast<int>(strlen(testString)), Smi::cast(*result)->value()); |
64 } | 69 } |
65 | 70 |
66 | 71 |
67 } // namespace compiler | 72 } // namespace compiler |
68 } // namespace internal | 73 } // namespace internal |
69 } // namespace v8 | 74 } // namespace v8 |
OLD | NEW |