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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/become.h" | 10 #include "vm/become.h" |
(...skipping 5270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 | 5281 |
5282 bool Function::HasBreakpoint() const { | 5282 bool Function::HasBreakpoint() const { |
5283 if (!FLAG_support_debugger) { | 5283 if (!FLAG_support_debugger) { |
5284 return false; | 5284 return false; |
5285 } | 5285 } |
5286 Thread* thread = Thread::Current(); | 5286 Thread* thread = Thread::Current(); |
5287 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); | 5287 return thread->isolate()->debugger()->HasBreakpoint(*this, thread->zone()); |
5288 } | 5288 } |
5289 | 5289 |
5290 | 5290 |
5291 void Function::InstallOptimizedCode(const Code& code, bool is_osr) const { | 5291 void Function::InstallOptimizedCode(const Code& code) const { |
5292 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 5292 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
5293 // We may not have previous code if FLAG_precompile is set. | 5293 // We may not have previous code if FLAG_precompile is set. |
5294 // Hot-reload may have already disabled the current code. | 5294 // Hot-reload may have already disabled the current code. |
5295 if (!is_osr && HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { | 5295 if (HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) { |
5296 Code::Handle(CurrentCode()).DisableDartCode(); | 5296 Code::Handle(CurrentCode()).DisableDartCode(); |
5297 } | 5297 } |
5298 AttachCode(code); | 5298 AttachCode(code); |
5299 } | 5299 } |
5300 | 5300 |
5301 | 5301 |
5302 void Function::SetInstructions(const Code& value) const { | 5302 void Function::SetInstructions(const Code& value) const { |
5303 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 5303 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
5304 SetInstructionsSafe(value); | 5304 SetInstructionsSafe(value); |
5305 } | 5305 } |
(...skipping 6463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11769 error = Compiler::CompileAllFunctions(cls); | 11769 error = Compiler::CompileAllFunctions(cls); |
11770 if (!error.IsNull()) { | 11770 if (!error.IsNull()) { |
11771 return error.raw(); | 11771 return error.raw(); |
11772 } | 11772 } |
11773 } | 11773 } |
11774 } | 11774 } |
11775 | 11775 |
11776 // Inner functions get added to the closures array. As part of compilation | 11776 // Inner functions get added to the closures array. As part of compilation |
11777 // more closures can be added to the end of the array. Compile all the | 11777 // more closures can be added to the end of the array. Compile all the |
11778 // closures until we have reached the end of the "worklist". | 11778 // closures until we have reached the end of the "worklist". |
| 11779 Object& result = Object::Handle(zone); |
11779 const GrowableObjectArray& closures = GrowableObjectArray::Handle( | 11780 const GrowableObjectArray& closures = GrowableObjectArray::Handle( |
11780 zone, Isolate::Current()->object_store()->closure_functions()); | 11781 zone, Isolate::Current()->object_store()->closure_functions()); |
11781 Function& func = Function::Handle(zone); | 11782 Function& func = Function::Handle(zone); |
11782 for (int i = 0; i < closures.Length(); i++) { | 11783 for (int i = 0; i < closures.Length(); i++) { |
11783 func ^= closures.At(i); | 11784 func ^= closures.At(i); |
11784 if (!func.HasCode()) { | 11785 if (!func.HasCode()) { |
11785 error = Compiler::CompileFunction(thread, func); | 11786 result = Compiler::CompileFunction(thread, func); |
11786 if (!error.IsNull()) { | 11787 if (result.IsError()) { |
11787 return error.raw(); | 11788 return Error::Cast(result).raw(); |
11788 } | 11789 } |
11789 func.ClearICDataArray(); | 11790 func.ClearICDataArray(); |
11790 func.ClearCode(); | 11791 func.ClearCode(); |
11791 } | 11792 } |
11792 } | 11793 } |
11793 return error.raw(); | 11794 return Error::null(); |
11794 } | 11795 } |
11795 | 11796 |
11796 | 11797 |
11797 RawError* Library::ParseAll(Thread* thread) { | 11798 RawError* Library::ParseAll(Thread* thread) { |
11798 Zone* zone = thread->zone(); | 11799 Zone* zone = thread->zone(); |
11799 Error& error = Error::Handle(zone); | 11800 Error& error = Error::Handle(zone); |
11800 Isolate* isolate = thread->isolate(); | 11801 Isolate* isolate = thread->isolate(); |
11801 const GrowableObjectArray& libs = | 11802 const GrowableObjectArray& libs = |
11802 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 11803 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
11803 Library& lib = Library::Handle(zone); | 11804 Library& lib = Library::Handle(zone); |
(...skipping 11285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23089 return UserTag::null(); | 23090 return UserTag::null(); |
23090 } | 23091 } |
23091 | 23092 |
23092 | 23093 |
23093 const char* UserTag::ToCString() const { | 23094 const char* UserTag::ToCString() const { |
23094 const String& tag_label = String::Handle(label()); | 23095 const String& tag_label = String::Handle(label()); |
23095 return tag_label.ToCString(); | 23096 return tag_label.ToCString(); |
23096 } | 23097 } |
23097 | 23098 |
23098 } // namespace dart | 23099 } // namespace dart |
OLD | NEW |