| OLD | NEW |
| 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/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 RawError* Compiler::CompileClass(const Class& cls) { | 151 RawError* Compiler::CompileClass(const Class& cls) { |
| 152 // If class is a top level class it is already parsed. | 152 // If class is a top level class it is already parsed. |
| 153 if (cls.IsTopLevel()) { | 153 if (cls.IsTopLevel()) { |
| 154 return Error::null(); | 154 return Error::null(); |
| 155 } | 155 } |
| 156 // If the class is already marked for parsing return immediately. | 156 // If the class is already marked for parsing return immediately. |
| 157 if (cls.is_marked_for_parsing()) { | 157 if (cls.is_marked_for_parsing()) { |
| 158 return Error::null(); | 158 return Error::null(); |
| 159 } | 159 } |
| 160 // If the class is a signature class there is no need to try and |
| 161 // compile it. Just finalize it directly. |
| 162 if (cls.IsSignatureClass()) { |
| 163 #if defined(DEBUG) |
| 164 const Type& type = Type::Handle( |
| 165 Isolate::Current()->object_store()->function_impl_type()); |
| 166 const Class& type_cls = Class::Handle(type.type_class()); |
| 167 ASSERT(type_cls.is_finalized()); |
| 168 #endif |
| 169 LongJumpScope jump; |
| 170 if (setjmp(*jump.Set()) == 0) { |
| 171 ClassFinalizer::FinalizeClass(cls); |
| 172 return Error::null(); |
| 173 } else { |
| 174 Isolate* isolate = Isolate::Current(); |
| 175 Error& error = Error::Handle(isolate); |
| 176 error = isolate->object_store()->sticky_error(); |
| 177 isolate->object_store()->clear_sticky_error(); |
| 178 return error.raw(); |
| 179 } |
| 180 } |
| 160 | 181 |
| 161 Isolate* isolate = Isolate::Current(); | 182 Isolate* isolate = Isolate::Current(); |
| 162 // We remember all the classes that are being compiled in these lists. This | 183 // We remember all the classes that are being compiled in these lists. This |
| 163 // also allows us to reset the marked_for_parsing state in case we see an | 184 // also allows us to reset the marked_for_parsing state in case we see an |
| 164 // error. | 185 // error. |
| 165 VMTagScope tagScope(isolate, VMTag::kCompileTopLevelTagId); | 186 VMTagScope tagScope(isolate, VMTag::kCompileTopLevelTagId); |
| 166 Class& parse_class = Class::Handle(isolate); | 187 Class& parse_class = Class::Handle(isolate); |
| 167 const GrowableObjectArray& parse_list = | 188 const GrowableObjectArray& parse_list = |
| 168 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4)); | 189 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New(4)); |
| 169 const GrowableObjectArray& patch_list = | 190 const GrowableObjectArray& patch_list = |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 const Object& result = | 1053 const Object& result = |
| 1033 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1054 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
| 1034 isolate->object_store()->clear_sticky_error(); | 1055 isolate->object_store()->clear_sticky_error(); |
| 1035 return result.raw(); | 1056 return result.raw(); |
| 1036 } | 1057 } |
| 1037 UNREACHABLE(); | 1058 UNREACHABLE(); |
| 1038 return Object::null(); | 1059 return Object::null(); |
| 1039 } | 1060 } |
| 1040 | 1061 |
| 1041 } // namespace dart | 1062 } // namespace dart |
| OLD | NEW |