| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 4592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4603 | 4603 |
| 4604 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 4604 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 4605 ASSERT(var_index < Length()); | 4605 ASSERT(var_index < Length()); |
| 4606 const Array& names = Array::Handle(raw_ptr()->names_); | 4606 const Array& names = Array::Handle(raw_ptr()->names_); |
| 4607 ASSERT(Length() == names.Length()); | 4607 ASSERT(Length() == names.Length()); |
| 4608 const String& name = String::CheckedHandle(names.At(var_index)); | 4608 const String& name = String::CheckedHandle(names.At(var_index)); |
| 4609 return name.raw(); | 4609 return name.raw(); |
| 4610 } | 4610 } |
| 4611 | 4611 |
| 4612 | 4612 |
| 4613 void LocalVarDescriptors::GetRange(intptr_t var_index, | 4613 void LocalVarDescriptors::GetScopeInfo( |
| 4614 intptr_t* begin_token_pos, | 4614 intptr_t var_index, |
| 4615 intptr_t* end_token_pos) const { | 4615 intptr_t* scope_id, |
| 4616 intptr_t* begin_token_pos, |
| 4617 intptr_t* end_token_pos) const { |
| 4616 ASSERT(var_index < Length()); | 4618 ASSERT(var_index < Length()); |
| 4617 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | 4619 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; |
| 4620 *scope_id = info->scope_id; |
| 4618 *begin_token_pos = info->begin_pos; | 4621 *begin_token_pos = info->begin_pos; |
| 4619 *end_token_pos = info->end_pos; | 4622 *end_token_pos = info->end_pos; |
| 4620 } | 4623 } |
| 4621 | 4624 |
| 4622 | 4625 |
| 4623 intptr_t LocalVarDescriptors::GetSlotIndex(intptr_t var_index) const { | 4626 intptr_t LocalVarDescriptors::GetSlotIndex(intptr_t var_index) const { |
| 4624 ASSERT(var_index < Length()); | 4627 ASSERT(var_index < Length()); |
| 4625 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | 4628 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; |
| 4626 return info->index; | 4629 return info->index; |
| 4627 } | 4630 } |
| 4628 | 4631 |
| 4629 | 4632 |
| 4630 void LocalVarDescriptors::SetVar(intptr_t var_index, | 4633 void LocalVarDescriptors::SetVar(intptr_t var_index, |
| 4631 const String& name, | 4634 const String& name, |
| 4632 intptr_t stack_slot, | 4635 intptr_t stack_slot, |
| 4633 intptr_t begin_pos, | 4636 intptr_t scope_id, |
| 4634 intptr_t end_pos) const { | 4637 intptr_t begin_pos, |
| 4638 intptr_t end_pos) const { |
| 4635 ASSERT(var_index < Length()); | 4639 ASSERT(var_index < Length()); |
| 4636 const Array& names = Array::Handle(raw_ptr()->names_); | 4640 const Array& names = Array::Handle(raw_ptr()->names_); |
| 4637 ASSERT(Length() == names.Length()); | 4641 ASSERT(Length() == names.Length()); |
| 4638 names.SetAt(var_index, name); | 4642 names.SetAt(var_index, name); |
| 4639 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; | 4643 RawLocalVarDescriptors::VarInfo *info = &raw_ptr()->data_[var_index]; |
| 4640 info->index = stack_slot; | 4644 info->index = stack_slot; |
| 4645 info->scope_id = scope_id; |
| 4641 info->begin_pos = begin_pos; | 4646 info->begin_pos = begin_pos; |
| 4642 info->end_pos = end_pos; | 4647 info->end_pos = end_pos; |
| 4643 } | 4648 } |
| 4644 | 4649 |
| 4645 | 4650 |
| 4646 const char* LocalVarDescriptors::ToCString() const { | 4651 const char* LocalVarDescriptors::ToCString() const { |
| 4647 UNIMPLEMENTED(); | 4652 UNIMPLEMENTED(); |
| 4648 return ""; | 4653 return "LocalVarDescriptors"; |
| 4649 } | 4654 } |
| 4650 | 4655 |
| 4651 | 4656 |
| 4652 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { | 4657 RawLocalVarDescriptors* LocalVarDescriptors::New(intptr_t num_variables) { |
| 4653 const Class& cls = Class::Handle(Object::var_descriptors_class()); | 4658 const Class& cls = Class::Handle(Object::var_descriptors_class()); |
| 4654 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); | 4659 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); |
| 4655 { | 4660 { |
| 4656 uword size = LocalVarDescriptors::InstanceSize(num_variables); | 4661 uword size = LocalVarDescriptors::InstanceSize(num_variables); |
| 4657 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); | 4662 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); |
| 4658 NoGCScope no_gc; | 4663 NoGCScope no_gc; |
| (...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7504 const String& str = String::Handle(pattern()); | 7509 const String& str = String::Handle(pattern()); |
| 7505 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7510 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 7506 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7511 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 7507 char* chars = reinterpret_cast<char*>( | 7512 char* chars = reinterpret_cast<char*>( |
| 7508 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7513 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 7509 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7514 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 7510 return chars; | 7515 return chars; |
| 7511 } | 7516 } |
| 7512 | 7517 |
| 7513 } // namespace dart | 7518 } // namespace dart |
| OLD | NEW |