| OLD | NEW |
| 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" |
| (...skipping 7062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7073 | 7073 |
| 7074 | 7074 |
| 7075 void LocalVarDescriptors::GetInfo(intptr_t var_index, | 7075 void LocalVarDescriptors::GetInfo(intptr_t var_index, |
| 7076 RawLocalVarDescriptors::VarInfo* info) const { | 7076 RawLocalVarDescriptors::VarInfo* info) const { |
| 7077 ASSERT(var_index < Length()); | 7077 ASSERT(var_index < Length()); |
| 7078 *info = raw_ptr()->data_[var_index]; | 7078 *info = raw_ptr()->data_[var_index]; |
| 7079 } | 7079 } |
| 7080 | 7080 |
| 7081 | 7081 |
| 7082 const char* LocalVarDescriptors::ToCString() const { | 7082 const char* LocalVarDescriptors::ToCString() const { |
| 7083 UNIMPLEMENTED(); | 7083 intptr_t len = 1; // Trailing '\0'. |
| 7084 return "LocalVarDescriptors"; | 7084 const char* kFormat = |
| 7085 "%2"Pd" kind=%d scope=0x%04x begin=%"Pd" end=%"Pd" name=%s\n"; |
| 7086 for (intptr_t i = 0; i < Length(); i++) { |
| 7087 String& var_name = String::Handle(GetName(i)); |
| 7088 RawLocalVarDescriptors::VarInfo info; |
| 7089 GetInfo(i, &info); |
| 7090 len += OS::SNPrint(NULL, 0, kFormat, |
| 7091 i, |
| 7092 info.kind, |
| 7093 info.scope_id, |
| 7094 info.begin_pos, |
| 7095 info.end_pos, |
| 7096 var_name.ToCString()); |
| 7097 } |
| 7098 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7099 intptr_t num_chars = 0; |
| 7100 for (intptr_t i = 0; i < Length(); i++) { |
| 7101 String& var_name = String::Handle(GetName(i)); |
| 7102 RawLocalVarDescriptors::VarInfo info; |
| 7103 GetInfo(i, &info); |
| 7104 num_chars += OS::SNPrint((buffer + num_chars), |
| 7105 (len - num_chars), |
| 7106 kFormat, |
| 7107 i, |
| 7108 info.kind, |
| 7109 info.scope_id, |
| 7110 info.begin_pos, |
| 7111 info.end_pos, |
| 7112 var_name.ToCString()); |
| 7113 } |
| 7114 return buffer; |
| 7085 } | 7115 } |
| 7086 | 7116 |
| 7087 | 7117 |
| 7088 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 7118 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| 7089 ASSERT(Object::var_descriptors_class() != Class::null()); | 7119 ASSERT(Object::var_descriptors_class() != Class::null()); |
| 7090 if (num_variables < 0 || num_variables > kMaxElements) { | 7120 if (num_variables < 0 || num_variables > kMaxElements) { |
| 7091 // This should be caught before we reach here. | 7121 // This should be caught before we reach here. |
| 7092 FATAL1("Fatal error in LocalVarDescriptors::New: " | 7122 FATAL1("Fatal error in LocalVarDescriptors::New: " |
| 7093 "invalid num_variables %"Pd"\n", num_variables); | 7123 "invalid num_variables %"Pd"\n", num_variables); |
| 7094 } | 7124 } |
| (...skipping 6065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13160 } | 13190 } |
| 13161 return result.raw(); | 13191 return result.raw(); |
| 13162 } | 13192 } |
| 13163 | 13193 |
| 13164 | 13194 |
| 13165 const char* WeakProperty::ToCString() const { | 13195 const char* WeakProperty::ToCString() const { |
| 13166 return "_WeakProperty"; | 13196 return "_WeakProperty"; |
| 13167 } | 13197 } |
| 13168 | 13198 |
| 13169 } // namespace dart | 13199 } // namespace dart |
| OLD | NEW |