Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1640)

Side by Side Diff: test/cctest/compiler/test-linkage.cc

Issue 899803003: Removed most of the bogus CompilationInfo constructor calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); 37 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false);
38 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 38 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
39 shared_function, isolate->native_context()); 39 shared_function, isolate->native_context());
40 } 40 }
41 41
42 42
43 TEST(TestLinkageCreate) { 43 TEST(TestLinkageCreate) {
44 InitializedHandleScope handles; 44 InitializedHandleScope handles;
45 Handle<JSFunction> function = Compile("a + b"); 45 Handle<JSFunction> function = Compile("a + b");
46 CompilationInfoWithZone info(function); 46 CompilationInfoWithZone info(function);
47 Linkage linkage(info.zone(), &info); 47 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
48 CHECK(descriptor);
48 } 49 }
49 50
50 51
51 TEST(TestLinkageJSFunctionIncoming) { 52 TEST(TestLinkageJSFunctionIncoming) {
52 InitializedHandleScope handles; 53 InitializedHandleScope handles;
53 54
54 const char* sources[] = {"(function() { })", "(function(a) { })", 55 const char* sources[] = {"(function() { })", "(function(a) { })",
55 "(function(a,b) { })", "(function(a,b,c) { })"}; 56 "(function(a,b) { })", "(function(a,b,c) { })"};
56 57
57 for (int i = 0; i < 3; i++) { 58 for (int i = 0; i < 3; i++) {
58 i::HandleScope handles(CcTest::i_isolate()); 59 i::HandleScope handles(CcTest::i_isolate());
59 Handle<JSFunction> function = v8::Utils::OpenHandle( 60 Handle<JSFunction> function = v8::Utils::OpenHandle(
60 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i]))); 61 *v8::Handle<v8::Function>::Cast(CompileRun(sources[i])));
61 CompilationInfoWithZone info(function); 62 CompilationInfoWithZone info(function);
62 Linkage linkage(info.zone(), &info); 63 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
63
64 CallDescriptor* descriptor = linkage.GetIncomingDescriptor();
65 CHECK(descriptor); 64 CHECK(descriptor);
66 65
67 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount())); 66 CHECK_EQ(1 + i, static_cast<int>(descriptor->JSParameterCount()));
68 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); 67 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
69 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); 68 CHECK_EQ(Operator::kNoProperties, descriptor->properties());
70 CHECK_EQ(true, descriptor->IsJSFunctionCall()); 69 CHECK_EQ(true, descriptor->IsJSFunctionCall());
71 } 70 }
72 } 71 }
73 72
74 73
75 TEST(TestLinkageCodeStubIncoming) { 74 TEST(TestLinkageCodeStubIncoming) {
76 Isolate* isolate = CcTest::InitIsolateOnce(); 75 Isolate* isolate = CcTest::InitIsolateOnce();
77 CompilationInfoWithZone info(static_cast<CodeStub*>(NULL), isolate); 76 CompilationInfoWithZone info(static_cast<CodeStub*>(NULL), isolate);
78 Linkage linkage(info.zone(), &info); 77 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
79 // TODO(titzer): test linkage creation with a bonafide code stub. 78 // TODO(titzer): test linkage creation with a bonafide code stub.
80 // this just checks current behavior. 79 // this just checks current behavior.
81 CHECK(!linkage.GetIncomingDescriptor()); 80 CHECK(!descriptor);
82 } 81 }
83 82
84 83
85 TEST(TestLinkageJSCall) { 84 TEST(TestLinkageJSCall) {
86 HandleAndZoneScope handles; 85 HandleAndZoneScope handles;
87 Handle<JSFunction> function = Compile("a + c"); 86 Handle<JSFunction> function = Compile("a + c");
88 CompilationInfoWithZone info(function); 87 CompilationInfoWithZone info(function);
89 Linkage linkage(info.zone(), &info);
90 88
91 for (int i = 0; i < 32; i++) { 89 for (int i = 0; i < 32; i++) {
92 CallDescriptor* descriptor = 90 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
93 linkage.GetJSCallDescriptor(i, CallDescriptor::kNoFlags); 91 info.zone(), false, i, CallDescriptor::kNoFlags);
94 CHECK(descriptor); 92 CHECK(descriptor);
95 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount())); 93 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount()));
96 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); 94 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
97 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); 95 CHECK_EQ(Operator::kNoProperties, descriptor->properties());
98 CHECK_EQ(true, descriptor->IsJSFunctionCall()); 96 CHECK_EQ(true, descriptor->IsJSFunctionCall());
99 } 97 }
100 } 98 }
101 99
102 100
103 TEST(TestLinkageRuntimeCall) { 101 TEST(TestLinkageRuntimeCall) {
104 // TODO(titzer): test linkage creation for outgoing runtime calls. 102 // TODO(titzer): test linkage creation for outgoing runtime calls.
105 } 103 }
106 104
107 105
108 TEST(TestLinkageStubCall) { 106 TEST(TestLinkageStubCall) {
109 // TODO(titzer): test linkage creation for outgoing stub calls. 107 // TODO(titzer): test linkage creation for outgoing stub calls.
110 } 108 }
111 109
112 110
113 #endif // V8_TURBOFAN_TARGET 111 #endif // V8_TURBOFAN_TARGET
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-context-specialization.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698