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

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

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: incorporated latest comments Created 6 years, 1 month 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
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 function_.set_result_type(Type::Handle(Type::DynamicType())); 210 function_.set_result_type(Type::Handle(Type::DynamicType()));
211 const Array& functions = Array::Handle(Array::New(1)); 211 const Array& functions = Array::Handle(Array::New(1));
212 functions.SetAt(0, function_); 212 functions.SetAt(0, function_);
213 cls.SetFunctions(functions); 213 cls.SetFunctions(functions);
214 Library& lib = Library::Handle(Library::CoreLibrary()); 214 Library& lib = Library::Handle(Library::CoreLibrary());
215 lib.AddClass(cls); 215 lib.AddClass(cls);
216 } 216 }
217 217
218 218
219 void CodeGenTest::Compile() { 219 void CodeGenTest::Compile() {
220 if (function_.HasCode()) return;
220 ParsedFunction* parsed_function = 221 ParsedFunction* parsed_function =
221 new ParsedFunction(Isolate::Current(), function_); 222 new ParsedFunction(Isolate::Current(), function_);
222 parsed_function->SetNodeSequence(node_sequence_); 223 parsed_function->SetNodeSequence(node_sequence_);
223 parsed_function->set_instantiator(NULL); 224 parsed_function->set_instantiator(NULL);
224 parsed_function->set_default_parameter_values(default_parameter_values_); 225 parsed_function->set_default_parameter_values(default_parameter_values_);
226 node_sequence_->scope()->AddVariable(
227 parsed_function->current_context_var());
225 parsed_function->EnsureExpressionTemp(); 228 parsed_function->EnsureExpressionTemp();
226 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); 229 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var());
227 parsed_function->AllocateVariables(); 230 parsed_function->AllocateVariables();
228 const Error& error = 231 const Error& error =
229 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); 232 Error::Handle(Compiler::CompileParsedFunction(parsed_function));
230 EXPECT(error.IsNull()); 233 EXPECT(error.IsNull());
231 } 234 }
232 235
233 236
234 LocalVariable* CodeGenTest::CreateTempConstVariable(const char* name_part) {
235 char name[64];
236 OS::SNPrint(name, 64, ":%s", name_part);
237 LocalVariable* temp =
238 new LocalVariable(0,
239 String::ZoneHandle(Symbols::New(name)),
240 Type::ZoneHandle(Type::DynamicType()));
241 temp->set_is_final();
242 node_sequence_->scope()->AddVariable(temp);
243 return temp;
244 }
245
246
247 bool CompilerTest::TestCompileScript(const Library& library, 237 bool CompilerTest::TestCompileScript(const Library& library,
248 const Script& script) { 238 const Script& script) {
249 Isolate* isolate = Isolate::Current(); 239 Isolate* isolate = Isolate::Current();
250 ASSERT(isolate != NULL); 240 ASSERT(isolate != NULL);
251 const Error& error = Error::Handle(Compiler::Compile(library, script)); 241 const Error& error = Error::Handle(Compiler::Compile(library, script));
252 if (!error.IsNull()) { 242 if (!error.IsNull()) {
253 OS::Print("Error compiling test script:\n%s\n", 243 OS::Print("Error compiling test script:\n%s\n",
254 error.ToErrorCString()); 244 error.ToErrorCString());
255 } 245 }
256 return error.IsNull(); 246 return error.IsNull();
257 } 247 }
258 248
259 249
260 bool CompilerTest::TestCompileFunction(const Function& function) { 250 bool CompilerTest::TestCompileFunction(const Function& function) {
261 Isolate* isolate = Isolate::Current(); 251 Isolate* isolate = Isolate::Current();
262 ASSERT(isolate != NULL); 252 ASSERT(isolate != NULL);
263 ASSERT(ClassFinalizer::AllClassesFinalized()); 253 ASSERT(ClassFinalizer::AllClassesFinalized());
264 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, 254 const Error& error = Error::Handle(Compiler::CompileFunction(isolate,
265 function)); 255 function));
266 return error.IsNull(); 256 return error.IsNull();
267 } 257 }
268 258
269 259
270 } // namespace dart 260 } // namespace dart
OLDNEW
« runtime/vm/flow_graph_type_propagator.cc ('K') | « runtime/vm/unit_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698