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

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

Issue 2683633005: Add exception handler cache to isolate (Closed)
Patch Set: s/HandlerInfo/ExceptionHandlerInfo 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ExceptionHandlerInfo* info =
12388 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]); 12388 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]);
12389 info->outer_try_index = outer_try_index; 12389 info->outer_try_index = outer_try_index;
12390 // Some C compilers warn about the comparison always being true when using <= 12390 // Some C compilers warn about the comparison always being true when using <=
12391 // due to limited range of data type. 12391 // due to limited range of data type.
12392 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) || 12392 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) ||
12393 (handler_pc_offset < static_cast<uword>(kMaxUint32))); 12393 (handler_pc_offset < static_cast<uword>(kMaxUint32)));
12394 info->handler_pc_offset = handler_pc_offset; 12394 info->handler_pc_offset = handler_pc_offset;
12395 info->needs_stacktrace = needs_stacktrace; 12395 info->needs_stacktrace = needs_stacktrace;
12396 info->has_catch_all = has_catch_all; 12396 info->has_catch_all = has_catch_all;
12397 } 12397 }
12398 12398
12399 void ExceptionHandlers::GetHandlerInfo( 12399 void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
12400 intptr_t try_index, 12400 ExceptionHandlerInfo* info) const {
12401 RawExceptionHandlers::HandlerInfo* info) const {
12402 ASSERT((try_index >= 0) && (try_index < num_entries())); 12401 ASSERT((try_index >= 0) && (try_index < num_entries()));
12403 ASSERT(info != NULL); 12402 ASSERT(info != NULL);
12404 *info = raw_ptr()->data()[try_index]; 12403 *info = raw_ptr()->data()[try_index];
12405 } 12404 }
12406 12405
12407 12406
12408 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const { 12407 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const {
12409 ASSERT((try_index >= 0) && (try_index < num_entries())); 12408 ASSERT((try_index >= 0) && (try_index < num_entries()));
12410 return raw_ptr()->data()[try_index].handler_pc_offset; 12409 return raw_ptr()->data()[try_index].handler_pc_offset;
12411 } 12410 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
12501 12500
12502 12501
12503 const char* ExceptionHandlers::ToCString() const { 12502 const char* ExceptionHandlers::ToCString() const {
12504 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n" 12503 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
12505 #define FORMAT2 " %d. %s\n" 12504 #define FORMAT2 " %d. %s\n"
12506 if (num_entries() == 0) { 12505 if (num_entries() == 0) {
12507 return "empty ExceptionHandlers\n"; 12506 return "empty ExceptionHandlers\n";
12508 } 12507 }
12509 Array& handled_types = Array::Handle(); 12508 Array& handled_types = Array::Handle();
12510 Type& type = Type::Handle(); 12509 Type& type = Type::Handle();
12511 RawExceptionHandlers::HandlerInfo info; 12510 ExceptionHandlerInfo info;
12512 // First compute the buffer size required. 12511 // First compute the buffer size required.
12513 intptr_t len = 1; // Trailing '\0'. 12512 intptr_t len = 1; // Trailing '\0'.
12514 for (intptr_t i = 0; i < num_entries(); i++) { 12513 for (intptr_t i = 0; i < num_entries(); i++) {
12515 GetHandlerInfo(i, &info); 12514 GetHandlerInfo(i, &info);
12516 handled_types = GetHandledTypes(i); 12515 handled_types = GetHandledTypes(i);
12517 const intptr_t num_types = 12516 const intptr_t num_types =
12518 handled_types.IsNull() ? 0 : handled_types.Length(); 12517 handled_types.IsNull() ? 0 : handled_types.Length();
12519 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types, 12518 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
12520 info.outer_try_index); 12519 info.outer_try_index);
12521 for (int k = 0; k < num_types; k++) { 12520 for (int k = 0; k < num_types; k++) {
(...skipping 10212 matching lines...) Expand 10 before | Expand all | Expand 10 after
22734 return UserTag::null(); 22733 return UserTag::null();
22735 } 22734 }
22736 22735
22737 22736
22738 const char* UserTag::ToCString() const { 22737 const char* UserTag::ToCString() const {
22739 const String& tag_label = String::Handle(label()); 22738 const String& tag_label = String::Handle(label());
22740 return tag_label.ToCString(); 22739 return tag_label.ToCString();
22741 } 22740 }
22742 22741
22743 } // namespace dart 22742 } // namespace dart
OLDNEW
« no previous file with comments | « 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