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

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

Issue 10821076: - Allow parsing of external methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/token.h ('k') | tests/language/external_test.dart » ('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 <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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return url; 136 return url;
137 } 137 }
138 return Api::Success(Isolate::Current()); 138 return Api::Success(Isolate::Current());
139 } 139 }
140 140
141 141
142 uword AssemblerTest::Assemble() { 142 uword AssemblerTest::Assemble() {
143 const String& function_name = String::ZoneHandle(Symbols::New(name_)); 143 const String& function_name = String::ZoneHandle(Symbols::New(name_));
144 Function& function = Function::ZoneHandle( 144 Function& function = Function::ZoneHandle(
145 Function::New(function_name, RawFunction::kRegularFunction, 145 Function::New(function_name, RawFunction::kRegularFunction,
146 true, false, 0)); 146 true, false, false, 0));
147 const Code& code = Code::Handle(Code::FinalizeCode(function, assembler_)); 147 const Code& code = Code::Handle(Code::FinalizeCode(function, assembler_));
148 if (FLAG_disassemble) { 148 if (FLAG_disassemble) {
149 OS::Print("Code for test '%s' {\n", name_); 149 OS::Print("Code for test '%s' {\n", name_);
150 const Instructions& instructions = 150 const Instructions& instructions =
151 Instructions::Handle(code.instructions()); 151 Instructions::Handle(code.instructions());
152 uword start = instructions.EntryPoint(); 152 uword start = instructions.EntryPoint();
153 Disassembler::Disassemble(start, start + assembler_->CodeSize()); 153 Disassembler::Disassemble(start, start + assembler_->CodeSize());
154 OS::Print("}\n"); 154 OS::Print("}\n");
155 } 155 }
156 const Instructions& instructions = Instructions::Handle(code.instructions()); 156 const Instructions& instructions = Instructions::Handle(code.instructions());
157 return instructions.EntryPoint(); 157 return instructions.EntryPoint();
158 } 158 }
159 159
160 160
161 CodeGenTest::CodeGenTest(const char* name) 161 CodeGenTest::CodeGenTest(const char* name)
162 : function_(Function::ZoneHandle()), 162 : function_(Function::ZoneHandle()),
163 node_sequence_(new SequenceNode(Scanner::kDummyTokenIndex, 163 node_sequence_(new SequenceNode(Scanner::kDummyTokenIndex,
164 new LocalScope(NULL, 0, 0))), 164 new LocalScope(NULL, 0, 0))),
165 default_parameter_values_(Array::ZoneHandle()) { 165 default_parameter_values_(Array::ZoneHandle()) {
166 ASSERT(name != NULL); 166 ASSERT(name != NULL);
167 const String& function_name = String::ZoneHandle(Symbols::New(name)); 167 const String& function_name = String::ZoneHandle(Symbols::New(name));
168 function_ = Function::New( 168 function_ = Function::New(
169 function_name, RawFunction::kRegularFunction, true, false, 0); 169 function_name, RawFunction::kRegularFunction, true, false, false, 0);
170 function_.set_result_type(Type::Handle(Type::DynamicType())); 170 function_.set_result_type(Type::Handle(Type::DynamicType()));
171 // Add function to a class and that class to the class dictionary so that 171 // Add function to a class and that class to the class dictionary so that
172 // frame walking can be used. 172 // frame walking can be used.
173 Class& cls = Class::ZoneHandle(); 173 Class& cls = Class::ZoneHandle();
174 const Script& script = Script::Handle(); 174 const Script& script = Script::Handle();
175 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); 175 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex);
176 const Array& functions = Array::Handle(Array::New(1)); 176 const Array& functions = Array::Handle(Array::New(1));
177 functions.SetAt(0, function_); 177 functions.SetAt(0, function_);
178 cls.SetFunctions(functions); 178 cls.SetFunctions(functions);
179 Library& lib = Library::Handle(Library::CoreLibrary()); 179 Library& lib = Library::Handle(Library::CoreLibrary());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 bool CompilerTest::TestCompileFunction(const Function& function) { 221 bool CompilerTest::TestCompileFunction(const Function& function) {
222 Isolate* isolate = Isolate::Current(); 222 Isolate* isolate = Isolate::Current();
223 ASSERT(isolate != NULL); 223 ASSERT(isolate != NULL);
224 ASSERT(ClassFinalizer::AllClassesFinalized()); 224 ASSERT(ClassFinalizer::AllClassesFinalized());
225 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 225 const Error& error = Error::Handle(Compiler::CompileFunction(function));
226 return error.IsNull(); 226 return error.IsNull();
227 } 227 }
228 228
229 } // namespace dart 229 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/token.h ('k') | tests/language/external_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698