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

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

Issue 10823131: Add deopt info to code object and print it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
11 #include "vm/bootstrap.h" 11 #include "vm/bootstrap.h"
12 #include "vm/datastream.h" 12 #include "vm/datastream.h"
13 #include "vm/deopt_instructions.h"
13 #include "vm/code_generator.h" 14 #include "vm/code_generator.h"
14 #include "vm/code_patcher.h" 15 #include "vm/code_patcher.h"
15 #include "vm/compiler.h" 16 #include "vm/compiler.h"
16 #include "vm/compiler_stats.h" 17 #include "vm/compiler_stats.h"
17 #include "vm/class_finalizer.h" 18 #include "vm/class_finalizer.h"
18 #include "vm/dart.h" 19 #include "vm/dart.h"
19 #include "vm/dart_api_state.h" 20 #include "vm/dart_api_state.h"
20 #include "vm/dart_entry.h" 21 #include "vm/dart_entry.h"
21 #include "vm/debuginfo.h" 22 #include "vm/debuginfo.h"
22 #include "vm/double_conversion.h" 23 #include "vm/double_conversion.h"
(...skipping 6910 matching lines...) Expand 10 before | Expand all | Expand 10 after
6933 6934
6934 intptr_t DeoptInfo::Instruction(intptr_t index) const { 6935 intptr_t DeoptInfo::Instruction(intptr_t index) const {
6935 return *(EntryAddr(index, kInstruction)); 6936 return *(EntryAddr(index, kInstruction));
6936 } 6937 }
6937 6938
6938 6939
6939 const char* DeoptInfo::ToCString() const { 6940 const char* DeoptInfo::ToCString() const {
6940 if (Length() == 0) { 6941 if (Length() == 0) {
6941 return "No DeoptInfo"; 6942 return "No DeoptInfo";
6942 } 6943 }
6943 // First compute the buffer size required. 6944 // Convert to DeoptInstr.
6945 GrowableArray<DeoptInstr*> deopt_instrs(Length());
6946 for (intptr_t i = 0; i < Length(); i++) {
6947 deopt_instrs.Add(DeoptInstr::Create(Instruction(i), FromIndex(i)));
6948 }
6949 // Compute the buffer size required.
6944 intptr_t len = 0; 6950 intptr_t len = 0;
6945 for (intptr_t i = 0; i < Length(); i++) { 6951 for (intptr_t i = 0; i < Length(); i++) {
6946 len += OS::SNPrint(NULL, 0, "[%d(%d):%d]", 6952 len += OS::SNPrint(NULL, 0, "[%s]", deopt_instrs[i]->ToCString());
6947 Instruction(i), FromIndex(i), i);
6948 } 6953 }
6949 // Allocate the buffer. 6954 // Allocate the buffer.
6950 char* buffer = reinterpret_cast<char*>( 6955 char* buffer = reinterpret_cast<char*>(
6951 Isolate::Current()->current_zone()->Allocate(len + 1)); 6956 Isolate::Current()->current_zone()->Allocate(len + 1));
6952 // Layout the fields in the buffer. 6957 // Layout the fields in the buffer.
6953 intptr_t index = 0; 6958 intptr_t index = 0;
6954 for (intptr_t i = 0; i < Length(); i++) { 6959 for (intptr_t i = 0; i < Length(); i++) {
6955 index += OS::SNPrint((buffer + index), 6960 index += OS::SNPrint((buffer + index),
6956 (len - index), 6961 (len - index) + 1,
6957 "[%d(%d):%d]", 6962 "[%s]",
6958 Instruction(i), 6963 deopt_instrs[i]->ToCString());
6959 FromIndex(i),
6960 i);
6961 } 6964 }
6962 return buffer; 6965 return buffer;
6963 } 6966 }
6964 6967
6965 6968
6966 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) { 6969 RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) {
6967 ASSERT(Object::deopt_info_class() != Class::null()); 6970 ASSERT(Object::deopt_info_class() != Class::null());
6968 DeoptInfo& result = DeoptInfo::Handle(); 6971 DeoptInfo& result = DeoptInfo::Handle();
6969 { 6972 {
6970 uword size = DeoptInfo::InstanceSize(num_commands); 6973 uword size = DeoptInfo::InstanceSize(num_commands);
(...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after
11085 const String& str = String::Handle(pattern()); 11088 const String& str = String::Handle(pattern());
11086 const char* format = "JSRegExp: pattern=%s flags=%s"; 11089 const char* format = "JSRegExp: pattern=%s flags=%s";
11087 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 11090 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
11088 char* chars = reinterpret_cast<char*>( 11091 char* chars = reinterpret_cast<char*>(
11089 Isolate::Current()->current_zone()->Allocate(len + 1)); 11092 Isolate::Current()->current_zone()->Allocate(len + 1));
11090 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 11093 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
11091 return chars; 11094 return chars;
11092 } 11095 }
11093 11096
11094 } // namespace dart 11097 } // namespace dart
OLDNEW
« runtime/vm/locations.h ('K') | « runtime/vm/locations.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698