| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 6052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6063 | 6063 |
| 6064 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 6064 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 6065 ASSERT(var_index < Length()); | 6065 ASSERT(var_index < Length()); |
| 6066 const Array& names = Array::Handle(raw_ptr()->names_); | 6066 const Array& names = Array::Handle(raw_ptr()->names_); |
| 6067 ASSERT(Length() == names.Length()); | 6067 ASSERT(Length() == names.Length()); |
| 6068 const String& name = String::CheckedHandle(names.At(var_index)); | 6068 const String& name = String::CheckedHandle(names.At(var_index)); |
| 6069 return name.raw(); | 6069 return name.raw(); |
| 6070 } | 6070 } |
| 6071 | 6071 |
| 6072 | 6072 |
| 6073 void LocalVarDescriptors::GetScopeInfo( | |
| 6074 intptr_t var_index, | |
| 6075 intptr_t* scope_id, | |
| 6076 intptr_t* begin_token_pos, | |
| 6077 intptr_t* end_token_pos) const { | |
| 6078 ASSERT(var_index < Length()); | |
| 6079 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | |
| 6080 *scope_id = info->scope_id; | |
| 6081 *begin_token_pos = info->begin_pos; | |
| 6082 *end_token_pos = info->end_pos; | |
| 6083 } | |
| 6084 | |
| 6085 | |
| 6086 intptr_t LocalVarDescriptors::GetSlotIndex(intptr_t var_index) const { | |
| 6087 ASSERT(var_index < Length()); | |
| 6088 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | |
| 6089 return info->index; | |
| 6090 } | |
| 6091 | |
| 6092 | |
| 6093 void LocalVarDescriptors::SetVar(intptr_t var_index, | 6073 void LocalVarDescriptors::SetVar(intptr_t var_index, |
| 6094 const String& name, | 6074 const String& name, |
| 6095 intptr_t stack_slot, | 6075 RawLocalVarDescriptors::VarInfo* info) const { |
| 6096 intptr_t scope_id, | |
| 6097 intptr_t begin_pos, | |
| 6098 intptr_t end_pos) const { | |
| 6099 ASSERT(var_index < Length()); | 6076 ASSERT(var_index < Length()); |
| 6100 const Array& names = Array::Handle(raw_ptr()->names_); | 6077 const Array& names = Array::Handle(raw_ptr()->names_); |
| 6101 ASSERT(Length() == names.Length()); | 6078 ASSERT(Length() == names.Length()); |
| 6102 names.SetAt(var_index, name); | 6079 names.SetAt(var_index, name); |
| 6103 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | 6080 raw_ptr()->data_[var_index] = *info; |
| 6104 info->index = stack_slot; | 6081 } |
| 6105 info->scope_id = scope_id; | 6082 |
| 6106 info->begin_pos = begin_pos; | 6083 |
| 6107 info->end_pos = end_pos; | 6084 void LocalVarDescriptors::GetInfo(intptr_t var_index, |
| 6085 RawLocalVarDescriptors::VarInfo* info) const { |
| 6086 ASSERT(var_index < Length()); |
| 6087 *info = raw_ptr()->data_[var_index]; |
| 6108 } | 6088 } |
| 6109 | 6089 |
| 6110 | 6090 |
| 6111 const char* LocalVarDescriptors::ToCString() const { | 6091 const char* LocalVarDescriptors::ToCString() const { |
| 6112 UNIMPLEMENTED(); | 6092 UNIMPLEMENTED(); |
| 6113 return "LocalVarDescriptors"; | 6093 return "LocalVarDescriptors"; |
| 6114 } | 6094 } |
| 6115 | 6095 |
| 6116 | 6096 |
| 6117 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 6097 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| (...skipping 4004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10122 const String& str = String::Handle(pattern()); | 10102 const String& str = String::Handle(pattern()); |
| 10123 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10103 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10124 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10104 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10125 char* chars = reinterpret_cast<char*>( | 10105 char* chars = reinterpret_cast<char*>( |
| 10126 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10106 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10127 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10107 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10128 return chars; | 10108 return chars; |
| 10129 } | 10109 } |
| 10130 | 10110 |
| 10131 } // namespace dart | 10111 } // namespace dart |
| OLD | NEW |