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

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: 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
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/unit_test.h ('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 "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 parsed_function->EnsureSavedCurrentContext();
227 node_sequence_->scope()->AddVariable(
228 parsed_function->saved_current_context_var());
225 parsed_function->EnsureExpressionTemp(); 229 parsed_function->EnsureExpressionTemp();
226 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var()); 230 node_sequence_->scope()->AddVariable(parsed_function->expression_temp_var());
227 parsed_function->AllocateVariables(); 231 parsed_function->AllocateVariables();
228 const Error& error = 232 const Error& error =
229 Error::Handle(Compiler::CompileParsedFunction(parsed_function)); 233 Error::Handle(Compiler::CompileParsedFunction(parsed_function));
230 EXPECT(error.IsNull()); 234 EXPECT(error.IsNull());
231 } 235 }
232 236
233 237
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, 238 bool CompilerTest::TestCompileScript(const Library& library,
248 const Script& script) { 239 const Script& script) {
249 Isolate* isolate = Isolate::Current(); 240 Isolate* isolate = Isolate::Current();
250 ASSERT(isolate != NULL); 241 ASSERT(isolate != NULL);
251 const Error& error = Error::Handle(Compiler::Compile(library, script)); 242 const Error& error = Error::Handle(Compiler::Compile(library, script));
252 if (!error.IsNull()) { 243 if (!error.IsNull()) {
253 OS::Print("Error compiling test script:\n%s\n", 244 OS::Print("Error compiling test script:\n%s\n",
254 error.ToErrorCString()); 245 error.ToErrorCString());
255 } 246 }
256 return error.IsNull(); 247 return error.IsNull();
257 } 248 }
258 249
259 250
260 bool CompilerTest::TestCompileFunction(const Function& function) { 251 bool CompilerTest::TestCompileFunction(const Function& function) {
261 Isolate* isolate = Isolate::Current(); 252 Isolate* isolate = Isolate::Current();
262 ASSERT(isolate != NULL); 253 ASSERT(isolate != NULL);
263 ASSERT(ClassFinalizer::AllClassesFinalized()); 254 ASSERT(ClassFinalizer::AllClassesFinalized());
264 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, 255 const Error& error = Error::Handle(Compiler::CompileFunction(isolate,
265 function)); 256 function));
266 return error.IsNull(); 257 return error.IsNull();
267 } 258 }
268 259
269 260
270 } // namespace dart 261 } // namespace dart
OLDNEW
« runtime/vm/stub_code_ia32.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