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 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 all_nodes[n]->SetIcDataAtId(node_id, ic_data_obj); | 78 all_nodes[n]->SetIcDataAtId(node_id, ic_data_obj); |
79 } | 79 } |
80 } | 80 } |
81 ASSERT(found_node); | 81 ASSERT(found_node); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 RawError* Compiler::Compile(const Library& library, const Script& script) { | 86 RawError* Compiler::Compile(const Library& library, const Script& script) { |
87 Isolate* isolate = Isolate::Current(); | 87 Isolate* isolate = Isolate::Current(); |
88 Error& error = Error::Handle(); | |
89 LongJump* base = isolate->long_jump_base(); | 88 LongJump* base = isolate->long_jump_base(); |
90 LongJump jump; | 89 LongJump jump; |
91 isolate->set_long_jump_base(&jump); | 90 isolate->set_long_jump_base(&jump); |
92 if (setjmp(*jump.Set()) == 0) { | 91 if (setjmp(*jump.Set()) == 0) { |
93 if (FLAG_trace_compiler) { | 92 if (FLAG_trace_compiler) { |
94 HANDLESCOPE(isolate); | 93 HANDLESCOPE(isolate); |
95 const String& script_url = String::Handle(script.url()); | 94 const String& script_url = String::Handle(script.url()); |
96 // TODO(iposva): Extract script kind. | 95 // TODO(iposva): Extract script kind. |
97 OS::Print("Compiling %s '%s'\n", "", script_url.ToCString()); | 96 OS::Print("Compiling %s '%s'\n", "", script_url.ToCString()); |
98 } | 97 } |
99 const String& library_key = String::Handle(library.private_key()); | 98 const String& library_key = String::Handle(library.private_key()); |
100 script.Tokenize(library_key); | 99 script.Tokenize(library_key); |
101 Parser::ParseCompilationUnit(library, script); | 100 Parser::ParseCompilationUnit(library, script); |
| 101 isolate->set_long_jump_base(base); |
| 102 return Error::null(); |
102 } else { | 103 } else { |
| 104 Error& error = Error::Handle(); |
103 error = isolate->object_store()->sticky_error(); | 105 error = isolate->object_store()->sticky_error(); |
104 isolate->object_store()->clear_sticky_error(); | 106 isolate->object_store()->clear_sticky_error(); |
| 107 isolate->set_long_jump_base(base); |
| 108 return error.raw(); |
105 } | 109 } |
106 isolate->set_long_jump_base(base); | 110 UNREACHABLE(); |
107 return error.raw(); | 111 return Error::null(); |
108 } | 112 } |
109 | 113 |
110 | 114 |
111 static void InstallUnoptimizedCode(const Function& function) { | 115 static void InstallUnoptimizedCode(const Function& function) { |
112 // Disable optimized code. | 116 // Disable optimized code. |
113 ASSERT(function.HasOptimizedCode()); | 117 ASSERT(function.HasOptimizedCode()); |
114 // Patch entry of optimized code. | 118 // Patch entry of optimized code. |
115 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); | 119 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); |
116 if (FLAG_trace_compiler) { | 120 if (FLAG_trace_compiler) { |
117 OS::Print("--> patching entry 0x%x\n", | 121 OS::Print("--> patching entry 0x%x\n", |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } else { | 405 } else { |
402 result = isolate->object_store()->sticky_error(); | 406 result = isolate->object_store()->sticky_error(); |
403 isolate->object_store()->clear_sticky_error(); | 407 isolate->object_store()->clear_sticky_error(); |
404 } | 408 } |
405 isolate->set_long_jump_base(base); | 409 isolate->set_long_jump_base(base); |
406 return result.raw(); | 410 return result.raw(); |
407 } | 411 } |
408 | 412 |
409 | 413 |
410 } // namespace dart | 414 } // namespace dart |
OLD | NEW |