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

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

Issue 2718353002: Revert "Track the 'awaiter return' call stack..." (Closed)
Patch Set: Created 3 years, 9 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_service.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 12475 matching lines...) Expand 10 before | Expand all | Expand 10 after
12486 12486
12487 intptr_t ExceptionHandlers::num_entries() const { 12487 intptr_t ExceptionHandlers::num_entries() const {
12488 return raw_ptr()->num_entries_; 12488 return raw_ptr()->num_entries_;
12489 } 12489 }
12490 12490
12491 12491
12492 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, 12492 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
12493 intptr_t outer_try_index, 12493 intptr_t outer_try_index,
12494 uword handler_pc_offset, 12494 uword handler_pc_offset,
12495 bool needs_stacktrace, 12495 bool needs_stacktrace,
12496 bool has_catch_all, 12496 bool has_catch_all) const {
12497 TokenPosition token_pos,
12498 bool is_generated) const {
12499 ASSERT((try_index >= 0) && (try_index < num_entries())); 12497 ASSERT((try_index >= 0) && (try_index < num_entries()));
12500 NoSafepointScope no_safepoint; 12498 NoSafepointScope no_safepoint;
12501 ExceptionHandlerInfo* info = 12499 ExceptionHandlerInfo* info =
12502 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]); 12500 UnsafeMutableNonPointer(&raw_ptr()->data()[try_index]);
12503 info->outer_try_index = outer_try_index; 12501 info->outer_try_index = outer_try_index;
12504 // Some C compilers warn about the comparison always being true when using <= 12502 // Some C compilers warn about the comparison always being true when using <=
12505 // due to limited range of data type. 12503 // due to limited range of data type.
12506 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) || 12504 ASSERT((handler_pc_offset == static_cast<uword>(kMaxUint32)) ||
12507 (handler_pc_offset < static_cast<uword>(kMaxUint32))); 12505 (handler_pc_offset < static_cast<uword>(kMaxUint32)));
12508 info->handler_pc_offset = handler_pc_offset; 12506 info->handler_pc_offset = handler_pc_offset;
12509 info->needs_stacktrace = needs_stacktrace; 12507 info->needs_stacktrace = needs_stacktrace;
12510 info->has_catch_all = has_catch_all; 12508 info->has_catch_all = has_catch_all;
12511 info->is_generated = is_generated;
12512 } 12509 }
12513 12510
12514 void ExceptionHandlers::GetHandlerInfo(intptr_t try_index, 12511 void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
12515 ExceptionHandlerInfo* info) const { 12512 ExceptionHandlerInfo* info) const {
12516 ASSERT((try_index >= 0) && (try_index < num_entries())); 12513 ASSERT((try_index >= 0) && (try_index < num_entries()));
12517 ASSERT(info != NULL); 12514 ASSERT(info != NULL);
12518 *info = raw_ptr()->data()[try_index]; 12515 *info = raw_ptr()->data()[try_index];
12519 } 12516 }
12520 12517
12521 12518
12522 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const { 12519 uword ExceptionHandlers::HandlerPCOffset(intptr_t try_index) const {
12523 ASSERT((try_index >= 0) && (try_index < num_entries())); 12520 ASSERT((try_index >= 0) && (try_index < num_entries()));
12524 return raw_ptr()->data()[try_index].handler_pc_offset; 12521 return raw_ptr()->data()[try_index].handler_pc_offset;
12525 } 12522 }
12526 12523
12527 12524
12528 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { 12525 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const {
12529 ASSERT((try_index >= 0) && (try_index < num_entries())); 12526 ASSERT((try_index >= 0) && (try_index < num_entries()));
12530 return raw_ptr()->data()[try_index].outer_try_index; 12527 return raw_ptr()->data()[try_index].outer_try_index;
12531 } 12528 }
12532 12529
12533 12530
12534 bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const { 12531 bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const {
12535 ASSERT((try_index >= 0) && (try_index < num_entries())); 12532 ASSERT((try_index >= 0) && (try_index < num_entries()));
12536 return raw_ptr()->data()[try_index].needs_stacktrace; 12533 return raw_ptr()->data()[try_index].needs_stacktrace;
12537 } 12534 }
12538 12535
12539 12536
12540 bool ExceptionHandlers::IsGenerated(intptr_t try_index) const {
12541 ASSERT((try_index >= 0) && (try_index < num_entries()));
12542 return raw_ptr()->data()[try_index].is_generated;
12543 }
12544
12545
12546 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const { 12537 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
12547 ASSERT((try_index >= 0) && (try_index < num_entries())); 12538 ASSERT((try_index >= 0) && (try_index < num_entries()));
12548 return raw_ptr()->data()[try_index].has_catch_all; 12539 return raw_ptr()->data()[try_index].has_catch_all;
12549 } 12540 }
12550 12541
12551 12542
12552 void ExceptionHandlers::SetHandledTypes(intptr_t try_index, 12543 void ExceptionHandlers::SetHandledTypes(intptr_t try_index,
12553 const Array& handled_types) const { 12544 const Array& handled_types) const {
12554 ASSERT((try_index >= 0) && (try_index < num_entries())); 12545 ASSERT((try_index >= 0) && (try_index < num_entries()));
12555 ASSERT(!handled_types.IsNull()); 12546 ASSERT(!handled_types.IsNull());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
12614 NoSafepointScope no_safepoint; 12605 NoSafepointScope no_safepoint;
12615 result ^= raw; 12606 result ^= raw;
12616 result.StoreNonPointer(&result.raw_ptr()->num_entries_, num_handlers); 12607 result.StoreNonPointer(&result.raw_ptr()->num_entries_, num_handlers);
12617 } 12608 }
12618 result.set_handled_types_data(handled_types_data); 12609 result.set_handled_types_data(handled_types_data);
12619 return result.raw(); 12610 return result.raw();
12620 } 12611 }
12621 12612
12622 12613
12623 const char* ExceptionHandlers::ToCString() const { 12614 const char* ExceptionHandlers::ToCString() const {
12624 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d) %s\n" 12615 #define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
12625 #define FORMAT2 " %d. %s\n" 12616 #define FORMAT2 " %d. %s\n"
12626 if (num_entries() == 0) { 12617 if (num_entries() == 0) {
12627 return "empty ExceptionHandlers\n"; 12618 return "empty ExceptionHandlers\n";
12628 } 12619 }
12629 Array& handled_types = Array::Handle(); 12620 Array& handled_types = Array::Handle();
12630 Type& type = Type::Handle(); 12621 Type& type = Type::Handle();
12631 ExceptionHandlerInfo info; 12622 ExceptionHandlerInfo info;
12632 // First compute the buffer size required. 12623 // First compute the buffer size required.
12633 intptr_t len = 1; // Trailing '\0'. 12624 intptr_t len = 1; // Trailing '\0'.
12634 for (intptr_t i = 0; i < num_entries(); i++) { 12625 for (intptr_t i = 0; i < num_entries(); i++) {
12635 GetHandlerInfo(i, &info); 12626 GetHandlerInfo(i, &info);
12636 handled_types = GetHandledTypes(i); 12627 handled_types = GetHandledTypes(i);
12637 const intptr_t num_types = 12628 const intptr_t num_types =
12638 handled_types.IsNull() ? 0 : handled_types.Length(); 12629 handled_types.IsNull() ? 0 : handled_types.Length();
12639 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types, 12630 len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
12640 info.outer_try_index, 12631 info.outer_try_index);
12641 info.is_generated ? "(generated)" : "");
12642 for (int k = 0; k < num_types; k++) { 12632 for (int k = 0; k < num_types; k++) {
12643 type ^= handled_types.At(k); 12633 type ^= handled_types.At(k);
12644 ASSERT(!type.IsNull()); 12634 ASSERT(!type.IsNull());
12645 len += OS::SNPrint(NULL, 0, FORMAT2, k, type.ToCString()); 12635 len += OS::SNPrint(NULL, 0, FORMAT2, k, type.ToCString());
12646 } 12636 }
12647 } 12637 }
12648 // Allocate the buffer. 12638 // Allocate the buffer.
12649 char* buffer = Thread::Current()->zone()->Alloc<char>(len); 12639 char* buffer = Thread::Current()->zone()->Alloc<char>(len);
12650 // Layout the fields in the buffer. 12640 // Layout the fields in the buffer.
12651 intptr_t num_chars = 0; 12641 intptr_t num_chars = 0;
12652 for (intptr_t i = 0; i < num_entries(); i++) { 12642 for (intptr_t i = 0; i < num_entries(); i++) {
12653 GetHandlerInfo(i, &info); 12643 GetHandlerInfo(i, &info);
12654 handled_types = GetHandledTypes(i); 12644 handled_types = GetHandledTypes(i);
12655 const intptr_t num_types = 12645 const intptr_t num_types =
12656 handled_types.IsNull() ? 0 : handled_types.Length(); 12646 handled_types.IsNull() ? 0 : handled_types.Length();
12657 num_chars += 12647 num_chars +=
12658 OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT1, i, 12648 OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT1, i,
12659 info.handler_pc_offset, num_types, info.outer_try_index, 12649 info.handler_pc_offset, num_types, info.outer_try_index);
12660 info.is_generated ? "(generated)" : "");
12661 for (int k = 0; k < num_types; k++) { 12650 for (int k = 0; k < num_types; k++) {
12662 type ^= handled_types.At(k); 12651 type ^= handled_types.At(k);
12663 num_chars += OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT2, 12652 num_chars += OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT2,
12664 k, type.ToCString()); 12653 k, type.ToCString());
12665 } 12654 }
12666 } 12655 }
12667 return buffer; 12656 return buffer;
12668 #undef FORMAT1 12657 #undef FORMAT1
12669 #undef FORMAT2 12658 #undef FORMAT2
12670 } 12659 }
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
14625 // Stub code. 14614 // Stub code.
14626 return; 14615 return;
14627 } 14616 }
14628 const Array& id_map = Array::Handle(inlined_id_to_function()); 14617 const Array& id_map = Array::Handle(inlined_id_to_function());
14629 const Function& root = Function::Handle(function()); 14618 const Function& root = Function::Handle(function());
14630 CodeSourceMapReader reader(map, id_map, root); 14619 CodeSourceMapReader reader(map, id_map, root);
14631 reader.DumpSourcePositions(PayloadStart()); 14620 reader.DumpSourcePositions(PayloadStart());
14632 } 14621 }
14633 14622
14634 14623
14635 RawArray* Code::await_token_positions() const {
14636 #if defined(DART_PRECOMPILED_RUNTIME)
14637 return Array::null();
14638 #else
14639 return raw_ptr()->await_token_positions_;
14640 #endif
14641 }
14642
14643 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { 14624 RawContext* Context::New(intptr_t num_variables, Heap::Space space) {
14644 ASSERT(num_variables >= 0); 14625 ASSERT(num_variables >= 0);
14645 ASSERT(Object::context_class() != Class::null()); 14626 ASSERT(Object::context_class() != Class::null());
14646 14627
14647 if (num_variables < 0 || num_variables > kMaxElements) { 14628 if (num_variables < 0 || num_variables > kMaxElements) {
14648 // This should be caught before we reach here. 14629 // This should be caught before we reach here.
14649 FATAL1("Fatal error in Context::New: invalid num_variables %" Pd "\n", 14630 FATAL1("Fatal error in Context::New: invalid num_variables %" Pd "\n",
14650 num_variables); 14631 num_variables);
14651 } 14632 }
14652 Context& result = Context::Handle(); 14633 Context& result = Context::Handle();
(...skipping 8274 matching lines...) Expand 10 before | Expand all | Expand 10 after
22927 return UserTag::null(); 22908 return UserTag::null();
22928 } 22909 }
22929 22910
22930 22911
22931 const char* UserTag::ToCString() const { 22912 const char* UserTag::ToCString() const {
22932 const String& tag_label = String::Handle(label()); 22913 const String& tag_label = String::Handle(label());
22933 return tag_label.ToCString(); 22914 return tag_label.ToCString();
22934 } 22915 }
22935 22916
22936 } // namespace dart 22917 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698