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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const Array& result = Array::Handle(Array::New(max_id + 1)); | 65 const Array& result = Array::Handle(Array::New(max_id + 1)); |
66 for (intptr_t i = 0; i < deopt_ids.length(); i++) { | 66 for (intptr_t i = 0; i < deopt_ids.length(); i++) { |
67 intptr_t result_index = deopt_ids[i]; | 67 intptr_t result_index = deopt_ids[i]; |
68 ASSERT(result.At(result_index) == Object::null()); | 68 ASSERT(result.At(result_index) == Object::null()); |
69 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i))); | 69 result.SetAt(result_index, Object::Handle(ic_data_objs.At(i))); |
70 } | 70 } |
71 return result.raw(); | 71 return result.raw(); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 RawError* Compiler::Compile(const Library& library, const Script& script) { | 75 RawError* Compiler::Compile(const Library& library, |
| 76 const Script& script, |
| 77 bool generating_snapshot) { |
76 Isolate* isolate = Isolate::Current(); | 78 Isolate* isolate = Isolate::Current(); |
77 LongJump* base = isolate->long_jump_base(); | 79 LongJump* base = isolate->long_jump_base(); |
78 LongJump jump; | 80 LongJump jump; |
79 isolate->set_long_jump_base(&jump); | 81 isolate->set_long_jump_base(&jump); |
80 if (setjmp(*jump.Set()) == 0) { | 82 if (setjmp(*jump.Set()) == 0) { |
81 if (FLAG_trace_compiler) { | 83 if (FLAG_trace_compiler) { |
82 HANDLESCOPE(isolate); | 84 HANDLESCOPE(isolate); |
83 const String& script_url = String::Handle(script.url()); | 85 const String& script_url = String::Handle(script.url()); |
84 // TODO(iposva): Extract script kind. | 86 // TODO(iposva): Extract script kind. |
85 OS::Print("Compiling %s '%s'\n", "", script_url.ToCString()); | 87 OS::Print("Compiling %s '%s'\n", "", script_url.ToCString()); |
86 } | 88 } |
87 const String& library_key = String::Handle(library.private_key()); | 89 const String& library_key = String::Handle(library.private_key()); |
88 script.Tokenize(library_key); | 90 script.Tokenize(library_key); |
89 Parser::ParseCompilationUnit(library, script); | 91 Parser::ParseCompilationUnit(library, script, generating_snapshot); |
90 isolate->set_long_jump_base(base); | 92 isolate->set_long_jump_base(base); |
91 return Error::null(); | 93 return Error::null(); |
92 } else { | 94 } else { |
93 Error& error = Error::Handle(); | 95 Error& error = Error::Handle(); |
94 error = isolate->object_store()->sticky_error(); | 96 error = isolate->object_store()->sticky_error(); |
95 isolate->object_store()->clear_sticky_error(); | 97 isolate->object_store()->clear_sticky_error(); |
96 isolate->set_long_jump_base(base); | 98 isolate->set_long_jump_base(base); |
97 return error.raw(); | 99 return error.raw(); |
98 } | 100 } |
99 UNREACHABLE(); | 101 UNREACHABLE(); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 result = isolate->object_store()->sticky_error(); | 554 result = isolate->object_store()->sticky_error(); |
553 isolate->object_store()->clear_sticky_error(); | 555 isolate->object_store()->clear_sticky_error(); |
554 isolate->set_long_jump_base(base); | 556 isolate->set_long_jump_base(base); |
555 return result.raw(); | 557 return result.raw(); |
556 } | 558 } |
557 UNREACHABLE(); | 559 UNREACHABLE(); |
558 return Object::null(); | 560 return Object::null(); |
559 } | 561 } |
560 | 562 |
561 } // namespace dart | 563 } // namespace dart |
OLD | NEW |