Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1126)

Side by Side Diff: runtime/vm/code_generator.cc

Issue 1156143003: Refactor Isolate -> Thread in NativeArguments and exception handler jump. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Port to all archs. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 Symbols::New(error.ToErrorCString())); 623 Symbols::New(error.ToErrorCString()));
624 Exceptions::CreateAndThrowTypeError( 624 Exceptions::CreateAndThrowTypeError(
625 location, src_type_name, dst_type_name, dst_name, error_message); 625 location, src_type_name, dst_type_name, dst_name, error_message);
626 UNREACHABLE(); 626 UNREACHABLE();
627 } 627 }
628 628
629 629
630 DEFINE_RUNTIME_ENTRY(Throw, 1) { 630 DEFINE_RUNTIME_ENTRY(Throw, 1) {
631 const Instance& exception = 631 const Instance& exception =
632 Instance::CheckedHandle(zone, arguments.ArgAt(0)); 632 Instance::CheckedHandle(zone, arguments.ArgAt(0));
633 Exceptions::Throw(isolate, exception); 633 Exceptions::Throw(thread, exception);
634 } 634 }
635 635
636 636
637 DEFINE_RUNTIME_ENTRY(ReThrow, 2) { 637 DEFINE_RUNTIME_ENTRY(ReThrow, 2) {
638 const Instance& exception = 638 const Instance& exception =
639 Instance::CheckedHandle(zone, arguments.ArgAt(0)); 639 Instance::CheckedHandle(zone, arguments.ArgAt(0));
640 const Instance& stacktrace = 640 const Instance& stacktrace =
641 Instance::CheckedHandle(zone, arguments.ArgAt(1)); 641 Instance::CheckedHandle(zone, arguments.ArgAt(1));
642 Exceptions::ReThrow(isolate, exception, stacktrace); 642 Exceptions::ReThrow(thread, exception, stacktrace);
643 } 643 }
644 644
645 645
646 // Patches static call in optimized code with the target's entry point. 646 // Patches static call in optimized code with the target's entry point.
647 // Compiles target if necessary. 647 // Compiles target if necessary.
648 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) { 648 DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
649 DartFrameIterator iterator; 649 DartFrameIterator iterator;
650 StackFrame* caller_frame = iterator.NextFrame(); 650 StackFrame* caller_frame = iterator.NextFrame();
651 ASSERT(caller_frame != NULL); 651 ASSERT(caller_frame != NULL);
652 const Code& caller_code = Code::Handle(caller_frame->LookupDartCode()); 652 const Code& caller_code = Code::Handle(caller_frame->LookupDartCode());
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 uword stack_overflow_flags = isolate->GetAndClearStackOverflowFlags(); 1118 uword stack_overflow_flags = isolate->GetAndClearStackOverflowFlags();
1119 1119
1120 // If an interrupt happens at the same time as a stack overflow, we 1120 // If an interrupt happens at the same time as a stack overflow, we
1121 // process the stack overflow now and leave the interrupt for next 1121 // process the stack overflow now and leave the interrupt for next
1122 // time. 1122 // time.
1123 if (stack_pos < isolate->saved_stack_limit()) { 1123 if (stack_pos < isolate->saved_stack_limit()) {
1124 // Use the preallocated stack overflow exception to avoid calling 1124 // Use the preallocated stack overflow exception to avoid calling
1125 // into dart code. 1125 // into dart code.
1126 const Instance& exception = 1126 const Instance& exception =
1127 Instance::Handle(isolate->object_store()->stack_overflow()); 1127 Instance::Handle(isolate->object_store()->stack_overflow());
1128 Exceptions::Throw(isolate, exception); 1128 Exceptions::Throw(thread, exception);
1129 UNREACHABLE(); 1129 UNREACHABLE();
1130 } 1130 }
1131 1131
1132 // The following code is used to stress test deoptimization and 1132 // The following code is used to stress test deoptimization and
1133 // debugger stack tracing. 1133 // debugger stack tracing.
1134 bool do_deopt = false; 1134 bool do_deopt = false;
1135 bool do_stacktrace = false; 1135 bool do_stacktrace = false;
1136 if ((FLAG_deoptimize_every > 0) || (FLAG_stacktrace_every > 0)) { 1136 if ((FLAG_deoptimize_every > 0) || (FLAG_stacktrace_every > 0)) {
1137 // TODO(turnidge): To make --deoptimize_every and 1137 // TODO(turnidge): To make --deoptimize_every and
1138 // --stacktrace-every faster we could move this increment/test to 1138 // --stacktrace-every faster we could move this increment/test to
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1682 const intptr_t elm_size = old_data.ElementSizeInBytes();
1683 const TypedData& new_data = 1683 const TypedData& new_data =
1684 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1684 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1685 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1685 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1686 typed_data_cell.SetAt(0, new_data); 1686 typed_data_cell.SetAt(0, new_data);
1687 arguments.SetReturn(new_data); 1687 arguments.SetReturn(new_data);
1688 } 1688 }
1689 1689
1690 1690
1691 } // namespace dart 1691 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | runtime/vm/exceptions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698