OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } else { | 179 } else { |
180 retval = false; | 180 retval = false; |
181 } | 181 } |
182 EXPECT(retval); | 182 EXPECT(retval); |
183 isolate->set_long_jump_base(base); | 183 isolate->set_long_jump_base(base); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 bool CompilerTest::TestCompileScript(const Library& library, | 187 bool CompilerTest::TestCompileScript(const Library& library, |
188 const Script& script) { | 188 const Script& script) { |
189 bool retval; | |
190 Isolate* isolate = Isolate::Current(); | 189 Isolate* isolate = Isolate::Current(); |
191 ASSERT(isolate != NULL); | 190 ASSERT(isolate != NULL); |
192 LongJump* base = isolate->long_jump_base(); | 191 const Error& error = Error::Handle(Compiler::Compile(library, script)); |
193 LongJump jump; | 192 return error.IsNull(); |
194 isolate->set_long_jump_base(&jump); | |
195 if (setjmp(*jump.Set()) == 0) { | |
196 Compiler::Compile(library, script); | |
197 retval = true; | |
198 } else { | |
199 retval = false; | |
200 } | |
201 isolate->set_long_jump_base(base); | |
202 return retval; | |
203 } | 193 } |
204 | 194 |
205 | 195 |
206 bool CompilerTest::TestCompileFunction(const Function& function) { | 196 bool CompilerTest::TestCompileFunction(const Function& function) { |
207 bool retval; | |
208 Isolate* isolate = Isolate::Current(); | 197 Isolate* isolate = Isolate::Current(); |
209 ASSERT(isolate != NULL); | 198 ASSERT(isolate != NULL); |
210 LongJump* base = isolate->long_jump_base(); | 199 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
211 LongJump jump; | 200 return error.IsNull(); |
212 isolate->set_long_jump_base(&jump); | |
213 if (setjmp(*jump.Set()) == 0) { | |
214 Compiler::CompileFunction(function); | |
215 retval = true; | |
216 } else { | |
217 retval = false; | |
218 } | |
219 isolate->set_long_jump_base(base); | |
220 return retval; | |
221 } | 201 } |
222 | 202 |
223 } // namespace dart | 203 } // namespace dart |
OLD | NEW |