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

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

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « runtime/vm/token_position.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | 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 "vm/unit_test.h" 5 #include "vm/unit_test.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 194
195 char* TestCase::BigintToHexValue(Dart_CObject* bigint) { 195 char* TestCase::BigintToHexValue(Dart_CObject* bigint) {
196 return bin::CObject::BigintToHexValue(bigint); 196 return bin::CObject::BigintToHexValue(bigint);
197 } 197 }
198 198
199 199
200 void AssemblerTest::Assemble() { 200 void AssemblerTest::Assemble() {
201 const String& function_name = String::ZoneHandle(Symbols::New(name_)); 201 const String& function_name = String::ZoneHandle(Symbols::New(name_));
202 const Class& cls = Class::ZoneHandle( 202 const Class& cls = Class::ZoneHandle(
203 Class::New(function_name, Script::Handle(), 0)); 203 Class::New(function_name,
204 Script::Handle(),
205 TokenPosition::kMinSource));
204 const Library& lib = Library::ZoneHandle(Library::New(function_name)); 206 const Library& lib = Library::ZoneHandle(Library::New(function_name));
205 cls.set_library(lib); 207 cls.set_library(lib);
206 Function& function = Function::ZoneHandle( 208 Function& function = Function::ZoneHandle(
207 Function::New(function_name, RawFunction::kRegularFunction, 209 Function::New(function_name, RawFunction::kRegularFunction,
208 true, false, false, false, false, cls, 0)); 210 true, false, false, false, false, cls,
211 TokenPosition::kMinSource));
209 code_ = Code::FinalizeCode(function, assembler_); 212 code_ = Code::FinalizeCode(function, assembler_);
210 if (FLAG_disassemble) { 213 if (FLAG_disassemble) {
211 OS::Print("Code for test '%s' {\n", name_); 214 OS::Print("Code for test '%s' {\n", name_);
212 const Instructions& instructions = 215 const Instructions& instructions =
213 Instructions::Handle(code_.instructions()); 216 Instructions::Handle(code_.instructions());
214 uword start = instructions.EntryPoint(); 217 uword start = instructions.EntryPoint();
215 Disassembler::Disassemble(start, start + assembler_->CodeSize()); 218 Disassembler::Disassemble(start, start + assembler_->CodeSize());
216 OS::Print("}\n"); 219 OS::Print("}\n");
217 } 220 }
218 } 221 }
219 222
220 223
221 CodeGenTest::CodeGenTest(const char* name) 224 CodeGenTest::CodeGenTest(const char* name)
222 : function_(Function::ZoneHandle()), 225 : function_(Function::ZoneHandle()),
223 node_sequence_(new SequenceNode(0, 226 node_sequence_(new SequenceNode(TokenPosition::kMinSource,
224 new LocalScope(NULL, 0, 0))), 227 new LocalScope(NULL, 0, 0))),
225 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) { 228 default_parameter_values_(new ZoneGrowableArray<const Instance*> ()) {
226 ASSERT(name != NULL); 229 ASSERT(name != NULL);
227 const String& function_name = String::ZoneHandle(Symbols::New(name)); 230 const String& function_name = String::ZoneHandle(Symbols::New(name));
228 // Add function to a class and that class to the class dictionary so that 231 // Add function to a class and that class to the class dictionary so that
229 // frame walking can be used. 232 // frame walking can be used.
230 const Class& cls = Class::ZoneHandle( 233 const Class& cls = Class::ZoneHandle(
231 Class::New(function_name, Script::Handle(), 0)); 234 Class::New(function_name, Script::Handle(),
235 TokenPosition::kMinSource));
232 function_ = Function::New( 236 function_ = Function::New(
233 function_name, RawFunction::kRegularFunction, 237 function_name, RawFunction::kRegularFunction,
234 true, false, false, false, false, cls, 0); 238 true, false, false, false, false, cls, TokenPosition::kMinSource);
235 function_.set_result_type(Type::Handle(Type::DynamicType())); 239 function_.set_result_type(Type::Handle(Type::DynamicType()));
236 const Array& functions = Array::Handle(Array::New(1)); 240 const Array& functions = Array::Handle(Array::New(1));
237 functions.SetAt(0, function_); 241 functions.SetAt(0, function_);
238 cls.SetFunctions(functions); 242 cls.SetFunctions(functions);
239 Library& lib = Library::Handle(Library::CoreLibrary()); 243 Library& lib = Library::Handle(Library::CoreLibrary());
240 lib.AddClass(cls); 244 lib.AddClass(cls);
241 } 245 }
242 246
243 247
244 void CodeGenTest::Compile() { 248 void CodeGenTest::Compile() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 300 }
297 // Copy the remainder of in to out. 301 // Copy the remainder of in to out.
298 while (*in != '\0') { 302 while (*in != '\0') {
299 *out++ = *in++; 303 *out++ = *in++;
300 } 304 }
301 *out = '\0'; 305 *out = '\0';
302 } 306 }
303 307
304 308
305 } // namespace dart 309 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/token_position.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698