OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/zone.h" | 8 #include "src/zone.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 "(function(a,b) { })", "(function(a,b,c) { })"}; | 55 "(function(a,b) { })", "(function(a,b,c) { })"}; |
56 | 56 |
57 for (int i = 0; i < 3; i++) { | 57 for (int i = 0; i < 3; i++) { |
58 i::HandleScope handles(CcTest::i_isolate()); | 58 i::HandleScope handles(CcTest::i_isolate()); |
59 Handle<JSFunction> function = v8::Utils::OpenHandle( | 59 Handle<JSFunction> function = v8::Utils::OpenHandle( |
60 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i]))); | 60 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i]))); |
61 CompilationInfoWithZone info(function); | 61 CompilationInfoWithZone info(function); |
62 Linkage linkage(info.zone(), &info); | 62 Linkage linkage(info.zone(), &info); |
63 | 63 |
64 CallDescriptor* descriptor = linkage.GetIncomingDescriptor(); | 64 CallDescriptor* descriptor = linkage.GetIncomingDescriptor(); |
65 CHECK_NE(NULL, descriptor); | 65 CHECK(descriptor); |
66 | 66 |
67 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount())); | 67 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount())); |
68 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); | 68 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); |
69 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); | 69 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); |
70 CHECK_EQ(true, descriptor->IsJSFunctionCall()); | 70 CHECK_EQ(true, descriptor->IsJSFunctionCall()); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 TEST(TestLinkageCodeStubIncoming) { | 75 TEST(TestLinkageCodeStubIncoming) { |
76 Isolate* isolate = CcTest::InitIsolateOnce(); | 76 Isolate* isolate = CcTest::InitIsolateOnce(); |
77 CompilationInfoWithZone info(static_cast<HydrogenCodeStub*>(NULL), isolate); | 77 CompilationInfoWithZone info(static_cast<HydrogenCodeStub*>(NULL), isolate); |
78 Linkage linkage(info.zone(), &info); | 78 Linkage linkage(info.zone(), &info); |
79 // TODO(titzer): test linkage creation with a bonafide code stub. | 79 // TODO(titzer): test linkage creation with a bonafide code stub. |
80 // this just checks current behavior. | 80 // this just checks current behavior. |
81 CHECK_EQ(NULL, linkage.GetIncomingDescriptor()); | 81 CHECK(!linkage.GetIncomingDescriptor()); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 TEST(TestLinkageJSCall) { | 85 TEST(TestLinkageJSCall) { |
86 HandleAndZoneScope handles; | 86 HandleAndZoneScope handles; |
87 Handle<JSFunction> function = Compile("a + c"); | 87 Handle<JSFunction> function = Compile("a + c"); |
88 CompilationInfoWithZone info(function); | 88 CompilationInfoWithZone info(function); |
89 Linkage linkage(info.zone(), &info); | 89 Linkage linkage(info.zone(), &info); |
90 | 90 |
91 for (int i = 0; i < 32; i++) { | 91 for (int i = 0; i < 32; i++) { |
92 CallDescriptor* descriptor = | 92 CallDescriptor* descriptor = |
93 linkage.GetJSCallDescriptor(i, CallDescriptor::kNoFlags); | 93 linkage.GetJSCallDescriptor(i, CallDescriptor::kNoFlags); |
94 CHECK_NE(NULL, descriptor); | 94 CHECK(descriptor); |
95 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount())); | 95 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount())); |
96 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); | 96 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); |
97 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); | 97 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); |
98 CHECK_EQ(true, descriptor->IsJSFunctionCall()); | 98 CHECK_EQ(true, descriptor->IsJSFunctionCall()); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 TEST(TestLinkageRuntimeCall) { | 103 TEST(TestLinkageRuntimeCall) { |
104 // TODO(titzer): test linkage creation for outgoing runtime calls. | 104 // TODO(titzer): test linkage creation for outgoing runtime calls. |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 TEST(TestLinkageStubCall) { | 108 TEST(TestLinkageStubCall) { |
109 // TODO(titzer): test linkage creation for outgoing stub calls. | 109 // TODO(titzer): test linkage creation for outgoing stub calls. |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 #endif // V8_TURBOFAN_TARGET | 113 #endif // V8_TURBOFAN_TARGET |
OLD | NEW |