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

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

Issue 2683633005: Add exception handler cache to isolate (Closed)
Patch Set: Add exception handler cache to isolate Created 3 years, 10 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) 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 12366 matching lines...) Expand 10 before | Expand all | Expand 10 after
12377 } 12377 }
12378 12378
12379 12379
12380 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, 12380 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
12381 intptr_t outer_try_index, 12381 intptr_t outer_try_index,
12382 uword handler_pc_offset, 12382 uword handler_pc_offset,
12383 bool needs_stacktrace, 12383 bool needs_stacktrace,
12384 bool has_catch_all) const { 12384 bool has_catch_all) const {
12385 ASSERT((try_index >= 0) && (try_index < num_entries())); 12385 ASSERT((try_index >= 0) && (try_index < num_entries()));
12386 NoSafepointScope no_safepoint; 12386 NoSafepointScope no_safepoint;
12387 RawExceptionHandlers::HandlerInfo* info = 12387 HandlerInfo* info = UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]);
12388 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]);
12389 info->outer_try_index = outer_try_index; 12388 info->outer_try_index = outer_try_index;
12390 // Some C compilers warn about the comparison always being true when using <= 12389 // Some C compilers warn about the comparison always being true when using <=
12391 // due to limited range of data type. 12390 // due to limited range of data type.
12392 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) || 12391 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) ||
12393 (handler_pc_offset < static_cast<uword>(kMaxUint32))); 12392 (handler_pc_offset < static_cast<uword>(kMaxUint32)));
12394 info->handler_pc_offset = handler_pc_offset; 12393 info->handler_pc_offset = handler_pc_offset;
12395 info->needs_stacktrace = needs_stacktrace; 12394 info->needs_stacktrace = needs_stacktrace;
12396 info->has_catch_all = has_catch_all; 12395 info->has_catch_all = has_catch_all;
12397 } 12396 }
12398 12397
12399 void ExceptionHandlers::GetHandlerInfo( 12398 void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
12400 intptr_t try_index, 12399 HandlerInfo* info) const {
12401 RawExceptionHandlers::HandlerInfo* info) const {
12402 ASSERT((try_index >= 0) && (try_index < num_entries())); 12400 ASSERT((try_index >= 0) && (try_index < num_entries()));
12403 ASSERT(info != NULL); 12401 ASSERT(info != NULL);
12404 *info = raw_ptr()->data()[try_index]; 12402 *info = raw_ptr()->data()[try_index];
12405 } 12403 }
12406 12404
12407 12405
12408 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const { 12406 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const {
12409 ASSERT((try_index >= 0) && (try_index < num_entries())); 12407 ASSERT((try_index >= 0) && (try_index < num_entries()));
12410 return raw_ptr()->data()[try_index].handler_pc_offset; 12408 return raw_ptr()->data()[try_index].handler_pc_offset;
12411 } 12409 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
12501 12499
12502 12500
12503 const char* ExceptionHandlers::ToCString() const { 12501 const char* ExceptionHandlers::ToCString() const {
12504 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n" 12502 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
12505 #define FORMAT2 " %d. %s\n" 12503 #define FORMAT2 " %d. %s\n"
12506 if (num_entries() == 0) { 12504 if (num_entries() == 0) {
12507 return "empty ExceptionHandlers\n"; 12505 return "empty ExceptionHandlers\n";
12508 } 12506 }
12509 Array& handled_types = Array::Handle(); 12507 Array& handled_types = Array::Handle();
12510 Type& type = Type::Handle(); 12508 Type& type = Type::Handle();
12511 RawExceptionHandlers::HandlerInfo info; 12509 HandlerInfo info;
12512 // First compute the buffer size required. 12510 // First compute the buffer size required.
12513 intptr_t len = 1; // Trailing '\0'. 12511 intptr_t len = 1; // Trailing '\0'.
12514 for (intptr_t i = 0; i < num_entries(); i++) { 12512 for (intptr_t i = 0; i < num_entries(); i++) {
12515 GetHandlerInfo(i, &info); 12513 GetHandlerInfo(i, &info);
12516 handled_types = GetHandledTypes(i); 12514 handled_types = GetHandledTypes(i);
12517 const intptr_t num_types = 12515 const intptr_t num_types =
12518 handled_types.IsNull() ? 0 : handled_types.Length(); 12516 handled_types.IsNull() ? 0 : handled_types.Length();
12519 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types, 12517 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
12520 info.outer_try_index); 12518 info.outer_try_index);
12521 for (int k = 0; k < num_types; k++) { 12519 for (int k = 0; k < num_types; k++) {
(...skipping 10237 matching lines...) Expand 10 before | Expand all | Expand 10 after
22759 return UserTag::null(); 22757 return UserTag::null();
22760 } 22758 }
22761 22759
22762 22760
22763 const char* UserTag::ToCString() const { 22761 const char* UserTag::ToCString() const {
22764 const String& tag_label = String::Handle(label()); 22762 const String& tag_label = String::Handle(label());
22765 return tag_label.ToCString(); 22763 return tag_label.ToCString();
22766 } 22764 }
22767 22765
22768 } // namespace dart 22766 } // namespace dart
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698