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

Side by Side Diff: runtime/vm/unit_test.cc

Issue 144343002: Rename kDummyTokenIndex to kNoSourcePos (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 6
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (tag == Dart_kCanonicalizeUrl) { 139 if (tag == Dart_kCanonicalizeUrl) {
140 return url; 140 return url;
141 } 141 }
142 return Api::Success(); 142 return Api::Success();
143 } 143 }
144 144
145 145
146 void AssemblerTest::Assemble() { 146 void AssemblerTest::Assemble() {
147 const String& function_name = String::ZoneHandle(Symbols::New(name_)); 147 const String& function_name = String::ZoneHandle(Symbols::New(name_));
148 const Class& cls = Class::ZoneHandle( 148 const Class& cls = Class::ZoneHandle(
149 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); 149 Class::New(function_name, Script::Handle(), Scanner::kNoSourcePos));
150 const Library& lib = Library::ZoneHandle(Library::New(function_name)); 150 const Library& lib = Library::ZoneHandle(Library::New(function_name));
151 cls.set_library(lib); 151 cls.set_library(lib);
152 Function& function = Function::ZoneHandle( 152 Function& function = Function::ZoneHandle(
153 Function::New(function_name, RawFunction::kRegularFunction, 153 Function::New(function_name, RawFunction::kRegularFunction,
154 true, false, false, false, false, cls, 0)); 154 true, false, false, false, false, cls, 0));
155 code_ = Code::FinalizeCode(function, assembler_); 155 code_ = Code::FinalizeCode(function, assembler_);
156 if (FLAG_disassemble) { 156 if (FLAG_disassemble) {
157 OS::Print("Code for test '%s' {\n", name_); 157 OS::Print("Code for test '%s' {\n", name_);
158 const Instructions& instructions = 158 const Instructions& instructions =
159 Instructions::Handle(code_.instructions()); 159 Instructions::Handle(code_.instructions());
160 uword start = instructions.EntryPoint(); 160 uword start = instructions.EntryPoint();
161 Disassembler::Disassemble(start, start + assembler_->CodeSize()); 161 Disassembler::Disassemble(start, start + assembler_->CodeSize());
162 OS::Print("}\n"); 162 OS::Print("}\n");
163 } 163 }
164 const Instructions& instructions = Instructions::Handle(code_.instructions()); 164 const Instructions& instructions = Instructions::Handle(code_.instructions());
165 entry_ = instructions.EntryPoint(); 165 entry_ = instructions.EntryPoint();
166 } 166 }
167 167
168 168
169 CodeGenTest::CodeGenTest(const char* name) 169 CodeGenTest::CodeGenTest(const char* name)
170 : function_(Function::ZoneHandle()), 170 : function_(Function::ZoneHandle()),
171 node_sequence_(new SequenceNode(Scanner::kDummyTokenIndex, 171 node_sequence_(new SequenceNode(Scanner::kNoSourcePos,
172 new LocalScope(NULL, 0, 0))), 172 new LocalScope(NULL, 0, 0))),
173 default_parameter_values_(Array::ZoneHandle()) { 173 default_parameter_values_(Array::ZoneHandle()) {
174 ASSERT(name != NULL); 174 ASSERT(name != NULL);
175 const String& function_name = String::ZoneHandle(Symbols::New(name)); 175 const String& function_name = String::ZoneHandle(Symbols::New(name));
176 // Add function to a class and that class to the class dictionary so that 176 // Add function to a class and that class to the class dictionary so that
177 // frame walking can be used. 177 // frame walking can be used.
178 const Class& cls = Class::ZoneHandle( 178 const Class& cls = Class::ZoneHandle(
179 Class::New(function_name, Script::Handle(), Scanner::kDummyTokenIndex)); 179 Class::New(function_name, Script::Handle(), Scanner::kNoSourcePos));
180 function_ = Function::New( 180 function_ = Function::New(
181 function_name, RawFunction::kRegularFunction, 181 function_name, RawFunction::kRegularFunction,
182 true, false, false, false, false, cls, 0); 182 true, false, false, false, false, cls, 0);
183 function_.set_result_type(Type::Handle(Type::DynamicType())); 183 function_.set_result_type(Type::Handle(Type::DynamicType()));
184 const Array& functions = Array::Handle(Array::New(1)); 184 const Array& functions = Array::Handle(Array::New(1));
185 functions.SetAt(0, function_); 185 functions.SetAt(0, function_);
186 cls.SetFunctions(functions); 186 cls.SetFunctions(functions);
187 Library& lib = Library::Handle(Library::CoreLibrary()); 187 Library& lib = Library::Handle(Library::CoreLibrary());
188 lib.AddClass(cls); 188 lib.AddClass(cls);
189 } 189 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 bool CompilerTest::TestCompileFunction(const Function& function) { 228 bool CompilerTest::TestCompileFunction(const Function& function) {
229 Isolate* isolate = Isolate::Current(); 229 Isolate* isolate = Isolate::Current();
230 ASSERT(isolate != NULL); 230 ASSERT(isolate != NULL);
231 ASSERT(ClassFinalizer::AllClassesFinalized()); 231 ASSERT(ClassFinalizer::AllClassesFinalized());
232 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 232 const Error& error = Error::Handle(Compiler::CompileFunction(function));
233 return error.IsNull(); 233 return error.IsNull();
234 } 234 }
235 235
236 } // namespace dart 236 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698