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; |
189 Isolate* isolate = Isolate::Current(); | 190 Isolate* isolate = Isolate::Current(); |
190 ASSERT(isolate != NULL); | 191 ASSERT(isolate != NULL); |
191 const Error& error = Error::Handle(Compiler::Compile(library, script)); | 192 LongJump* base = isolate->long_jump_base(); |
192 return error.IsNull(); | 193 LongJump jump; |
| 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; |
193 } | 203 } |
194 | 204 |
195 | 205 |
196 bool CompilerTest::TestCompileFunction(const Function& function) { | 206 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 207 bool retval; |
197 Isolate* isolate = Isolate::Current(); | 208 Isolate* isolate = Isolate::Current(); |
198 ASSERT(isolate != NULL); | 209 ASSERT(isolate != NULL); |
199 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 210 LongJump* base = isolate->long_jump_base(); |
200 return error.IsNull(); | 211 LongJump jump; |
| 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; |
201 } | 221 } |
202 | 222 |
203 } // namespace dart | 223 } // namespace dart |
OLD | NEW |