Chromium Code Reviews| 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 6108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6119 const String& name = String::Handle(target_name()); | 6119 const String& name = String::Handle(target_name()); |
| 6120 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; | 6120 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString()) + 1; |
| 6121 char* chars = reinterpret_cast<char*>( | 6121 char* chars = reinterpret_cast<char*>( |
| 6122 Isolate::Current()->current_zone()->Allocate(len)); | 6122 Isolate::Current()->current_zone()->Allocate(len)); |
| 6123 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 6123 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
| 6124 return chars; | 6124 return chars; |
| 6125 } | 6125 } |
| 6126 | 6126 |
| 6127 | 6127 |
| 6128 void ICData::set_function(const Function& value) const { | 6128 void ICData::set_function(const Function& value) const { |
| 6129 raw_ptr()->function_ = value.raw(); | 6129 StorePointer(&raw_ptr()->function_, value.raw()); |
| 6130 } | 6130 } |
| 6131 | 6131 |
| 6132 | 6132 |
| 6133 void ICData::set_target_name(const String& value) const { | 6133 void ICData::set_target_name(const String& value) const { |
| 6134 raw_ptr()->target_name_ = value.raw(); | 6134 StorePointer(&raw_ptr()->target_name_, value.raw()); |
| 6135 } | 6135 } |
| 6136 | 6136 |
| 6137 | 6137 |
| 6138 void ICData::set_id(intptr_t value) const { | 6138 void ICData::set_id(intptr_t value) const { |
| 6139 raw_ptr()->id_ = value; | 6139 raw_ptr()->id_ = value; |
| 6140 } | 6140 } |
| 6141 | 6141 |
| 6142 | 6142 |
| 6143 void ICData::set_num_args_tested(intptr_t value) const { | 6143 void ICData::set_num_args_tested(intptr_t value) const { |
| 6144 raw_ptr()->num_args_tested_ = value; | 6144 raw_ptr()->num_args_tested_ = value; |
| 6145 } | 6145 } |
| 6146 | 6146 |
| 6147 | 6147 |
| 6148 void ICData::set_ic_data(const Array& value) const { | 6148 void ICData::set_ic_data(const Array& value) const { |
| 6149 raw_ptr()->ic_data_ = value.raw(); | 6149 StorePointer(&raw_ptr()->ic_data_, value.raw()); |
| 6150 } | 6150 } |
| 6151 | 6151 |
| 6152 | 6152 |
| 6153 intptr_t ICData::TestEntryLength() const { | 6153 intptr_t ICData::TestEntryLength() const { |
| 6154 return num_args_tested() + 1 /* target function*/; | 6154 return num_args_tested() + 1 /* target function*/; |
| 6155 } | 6155 } |
| 6156 | 6156 |
| 6157 | 6157 |
| 6158 intptr_t ICData::NumberOfChecks() const { | 6158 intptr_t ICData::NumberOfChecks() const { |
| 6159 // Do not count the sentinel; | 6159 // Do not count the sentinel; |
| (...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8529 growable_array.SetData(new_array); | 8529 growable_array.SetData(new_array); |
| 8530 | 8530 |
| 8531 // If there is any left over space fill it with either an Array object or | 8531 // If there is any left over space fill it with either an Array object or |
| 8532 // just a plain object (depending on the amount of left over space) so | 8532 // just a plain object (depending on the amount of left over space) so |
| 8533 // that it can be traversed over successfully during garbage collection. | 8533 // that it can be traversed over successfully during garbage collection. |
| 8534 if (capacity_size != used_size) { | 8534 if (capacity_size != used_size) { |
| 8535 ASSERT(capacity_len > used_len); | 8535 ASSERT(capacity_len > used_len); |
| 8536 intptr_t leftover_size = capacity_size - used_size; | 8536 intptr_t leftover_size = capacity_size - used_size; |
| 8537 | 8537 |
| 8538 uword addr = RawObject::ToAddr(array.raw()) + used_size; | 8538 uword addr = RawObject::ToAddr(array.raw()) + used_size; |
| 8539 tags = 0; | |
|
cshapiro
2012/04/18 20:52:00
This seems like a strange idiom but I may not unde
siva
2012/04/18 21:21:17
This is in preparation for merging the tags fields
| |
| 8539 if (leftover_size >= Array::InstanceSize(0)) { | 8540 if (leftover_size >= Array::InstanceSize(0)) { |
| 8540 // As we have enough space to use an array object, update the leftover | 8541 // As we have enough space to use an array object, update the leftover |
| 8541 // space as an Array object. | 8542 // space as an Array object. |
| 8542 RawArray* raw = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr)); | 8543 RawArray* raw = reinterpret_cast<RawArray*>(RawObject::FromAddr(addr)); |
| 8543 raw->ptr()->class_ = isolate->object_store()->array_class(); | 8544 raw->ptr()->class_ = isolate->object_store()->array_class(); |
| 8544 tags = RawObject::SizeTag::update(leftover_size, tags); | 8545 tags = RawObject::SizeTag::update(leftover_size, tags); |
| 8545 raw->ptr()->tags_ = tags; | 8546 raw->ptr()->tags_ = tags; |
| 8546 intptr_t leftover_len = | 8547 intptr_t leftover_len = |
| 8547 ((leftover_size - Array::InstanceSize(0)) / kWordSize); | 8548 ((leftover_size - Array::InstanceSize(0)) / kWordSize); |
| 8548 raw->ptr()->tags_ = tags; | 8549 raw->ptr()->tags_ = tags; |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9129 const String& str = String::Handle(pattern()); | 9130 const String& str = String::Handle(pattern()); |
| 9130 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9131 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9131 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9132 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9132 char* chars = reinterpret_cast<char*>( | 9133 char* chars = reinterpret_cast<char*>( |
| 9133 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9134 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9134 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9135 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9135 return chars; | 9136 return chars; |
| 9136 } | 9137 } |
| 9137 | 9138 |
| 9138 } // namespace dart | 9139 } // namespace dart |
| OLD | NEW |