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

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

Issue 2396963003: [parser] Deprecate ParseInfo constructor taking closure. (Closed)
Patch Set: Rebased. Created 4 years, 2 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/code-factory.h" 5 #include "src/code-factory.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.h" 8 #include "src/compiler.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 25 matching lines...) Expand all
36 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, 36 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL,
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, isolate->native_context()); 39 shared, isolate->native_context());
40 } 40 }
41 41
42 42
43 TEST(TestLinkageCreate) { 43 TEST(TestLinkageCreate) {
44 HandleAndZoneScope handles; 44 HandleAndZoneScope handles;
45 Handle<JSFunction> function = Compile("a + b"); 45 Handle<JSFunction> function = Compile("a + b");
46 ParseInfo parse_info(handles.main_zone(), function); 46 ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
47 CompilationInfo info(&parse_info, function); 47 CompilationInfo info(&parse_info, function);
48 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); 48 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
49 CHECK(descriptor); 49 CHECK(descriptor);
50 } 50 }
51 51
52 52
53 TEST(TestLinkageJSFunctionIncoming) { 53 TEST(TestLinkageJSFunctionIncoming) {
54 const char* sources[] = {"(function() { })", "(function(a) { })", 54 const char* sources[] = {"(function() { })", "(function(a) { })",
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 HandleAndZoneScope handles; 58 HandleAndZoneScope handles;
59 Handle<JSFunction> function = 59 Handle<JSFunction> function =
60 Handle<JSFunction>::cast(v8::Utils::OpenHandle( 60 Handle<JSFunction>::cast(v8::Utils::OpenHandle(
61 *v8::Local<v8::Function>::Cast(CompileRun(sources[i])))); 61 *v8::Local<v8::Function>::Cast(CompileRun(sources[i]))));
62 ParseInfo parse_info(handles.main_zone(), function); 62 ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
63 CompilationInfo info(&parse_info, function); 63 CompilationInfo info(&parse_info, function);
64 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); 64 CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info);
65 CHECK(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(TestLinkageJSCall) { 75 TEST(TestLinkageJSCall) {
76 HandleAndZoneScope handles; 76 HandleAndZoneScope handles;
77 Handle<JSFunction> function = Compile("a + c"); 77 Handle<JSFunction> function = Compile("a + c");
78 ParseInfo parse_info(handles.main_zone(), function); 78 ParseInfo parse_info(handles.main_zone(), handle(function->shared()));
79 CompilationInfo info(&parse_info, function); 79 CompilationInfo info(&parse_info, function);
80 80
81 for (int i = 0; i < 32; i++) { 81 for (int i = 0; i < 32; i++) {
82 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( 82 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
83 info.zone(), false, i, CallDescriptor::kNoFlags); 83 info.zone(), false, i, CallDescriptor::kNoFlags);
84 CHECK(descriptor); 84 CHECK(descriptor);
85 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount())); 85 CHECK_EQ(i, static_cast<int>(descriptor->JSParameterCount()));
86 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); 86 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
87 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); 87 CHECK_EQ(Operator::kNoProperties, descriptor->properties());
88 CHECK_EQ(true, descriptor->IsJSFunctionCall()); 88 CHECK_EQ(true, descriptor->IsJSFunctionCall());
(...skipping 19 matching lines...) Expand all
108 CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount())); 108 CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount()));
109 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount())); 109 CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
110 CHECK_EQ(Operator::kNoProperties, descriptor->properties()); 110 CHECK_EQ(Operator::kNoProperties, descriptor->properties());
111 CHECK_EQ(false, descriptor->IsJSFunctionCall()); 111 CHECK_EQ(false, descriptor->IsJSFunctionCall());
112 // TODO(titzer): test linkage creation for outgoing stub calls. 112 // TODO(titzer): test linkage creation for outgoing stub calls.
113 } 113 }
114 114
115 } // namespace compiler 115 } // namespace compiler
116 } // namespace internal 116 } // namespace internal
117 } // namespace v8 117 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/function-tester.cc ('k') | test/cctest/compiler/test-loop-assignment-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698