OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 DART_EXPORT Dart_Port Dart_GetMainPortId() { | 1766 DART_EXPORT Dart_Port Dart_GetMainPortId() { |
1767 Isolate* isolate = Isolate::Current(); | 1767 Isolate* isolate = Isolate::Current(); |
1768 CHECK_ISOLATE(isolate); | 1768 CHECK_ISOLATE(isolate); |
1769 return isolate->main_port(); | 1769 return isolate->main_port(); |
1770 } | 1770 } |
1771 | 1771 |
1772 | 1772 |
1773 // --- Scopes ---- | 1773 // --- Scopes ---- |
1774 | 1774 |
1775 DART_EXPORT void Dart_EnterScope() { | 1775 DART_EXPORT void Dart_EnterScope() { |
1776 Isolate* isolate = Isolate::Current(); | 1776 Thread* thread = Thread::Current(); |
| 1777 Isolate* isolate = thread->isolate(); |
1777 CHECK_ISOLATE(isolate); | 1778 CHECK_ISOLATE(isolate); |
1778 ApiState* state = isolate->api_state(); | 1779 ApiState* state = isolate->api_state(); |
1779 ASSERT(state != NULL); | 1780 ASSERT(state != NULL); |
1780 ApiLocalScope* new_scope = state->reusable_scope(); | 1781 ApiLocalScope* new_scope = state->reusable_scope(); |
1781 if (new_scope == NULL) { | 1782 if (new_scope == NULL) { |
1782 new_scope = new ApiLocalScope(state->top_scope(), | 1783 new_scope = new ApiLocalScope(state->top_scope(), |
1783 isolate->top_exit_frame_info()); | 1784 thread->top_exit_frame_info()); |
1784 ASSERT(new_scope != NULL); | 1785 ASSERT(new_scope != NULL); |
1785 } else { | 1786 } else { |
1786 new_scope->Reinit(isolate, | 1787 new_scope->Reinit(thread, |
1787 state->top_scope(), | 1788 state->top_scope(), |
1788 isolate->top_exit_frame_info()); | 1789 thread->top_exit_frame_info()); |
1789 state->set_reusable_scope(NULL); | 1790 state->set_reusable_scope(NULL); |
1790 } | 1791 } |
1791 state->set_top_scope(new_scope); // New scope is now the top scope. | 1792 state->set_top_scope(new_scope); // New scope is now the top scope. |
1792 } | 1793 } |
1793 | 1794 |
1794 | 1795 |
1795 DART_EXPORT void Dart_ExitScope() { | 1796 DART_EXPORT void Dart_ExitScope() { |
1796 Isolate* isolate = Isolate::Current(); | 1797 Thread* thread = Thread::Current(); |
| 1798 Isolate* isolate = thread->isolate(); |
1797 CHECK_ISOLATE_SCOPE(isolate); | 1799 CHECK_ISOLATE_SCOPE(isolate); |
1798 ApiState* state = isolate->api_state(); | 1800 ApiState* state = isolate->api_state(); |
1799 ApiLocalScope* scope = state->top_scope(); | 1801 ApiLocalScope* scope = state->top_scope(); |
1800 ApiLocalScope* reusable_scope = state->reusable_scope(); | 1802 ApiLocalScope* reusable_scope = state->reusable_scope(); |
1801 state->set_top_scope(scope->previous()); // Reset top scope to previous. | 1803 state->set_top_scope(scope->previous()); // Reset top scope to previous. |
1802 if (reusable_scope == NULL) { | 1804 if (reusable_scope == NULL) { |
1803 scope->Reset(isolate); // Reset the old scope which we just exited. | 1805 scope->Reset(thread); // Reset the old scope which we just exited. |
1804 state->set_reusable_scope(scope); | 1806 state->set_reusable_scope(scope); |
1805 } else { | 1807 } else { |
1806 ASSERT(reusable_scope != scope); | 1808 ASSERT(reusable_scope != scope); |
1807 delete scope; | 1809 delete scope; |
1808 } | 1810 } |
1809 } | 1811 } |
1810 | 1812 |
1811 | 1813 |
1812 DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size) { | 1814 DART_EXPORT uint8_t* Dart_ScopeAllocate(intptr_t size) { |
1813 Zone* zone; | 1815 Zone* zone; |
(...skipping 4039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5853 ASSERT(stream != NULL); | 5855 ASSERT(stream != NULL); |
5854 TimelineEvent* event = stream->StartEvent(); | 5856 TimelineEvent* event = stream->StartEvent(); |
5855 if (event != NULL) { | 5857 if (event != NULL) { |
5856 event->AsyncEnd(label, async_id); | 5858 event->AsyncEnd(label, async_id); |
5857 event->Complete(); | 5859 event->Complete(); |
5858 } | 5860 } |
5859 return Api::Success(); | 5861 return Api::Success(); |
5860 } | 5862 } |
5861 | 5863 |
5862 } // namespace dart | 5864 } // namespace dart |
OLD | NEW |