| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 bool is_const() const { return raw_ptr()->is_const_; } | 1241 bool is_const() const { return raw_ptr()->is_const_; } |
| 1242 bool IsConstructor() const { | 1242 bool IsConstructor() const { |
| 1243 return (kind() == RawFunction::kConstructor) && !is_static(); | 1243 return (kind() == RawFunction::kConstructor) && !is_static(); |
| 1244 } | 1244 } |
| 1245 bool IsFactory() const { | 1245 bool IsFactory() const { |
| 1246 return (kind() == RawFunction::kConstructor) && is_static(); | 1246 return (kind() == RawFunction::kConstructor) && is_static(); |
| 1247 } | 1247 } |
| 1248 bool IsAbstract() const { | 1248 bool IsAbstract() const { |
| 1249 return kind() == RawFunction::kAbstract; | 1249 return kind() == RawFunction::kAbstract; |
| 1250 } | 1250 } |
| 1251 bool IsDynamicFunction() const { |
| 1252 if (is_static()) { |
| 1253 return false; |
| 1254 } |
| 1255 switch (kind()) { |
| 1256 case RawFunction::kFunction: |
| 1257 case RawFunction::kGetterFunction: |
| 1258 case RawFunction::kSetterFunction: |
| 1259 case RawFunction::kImplicitGetter: |
| 1260 case RawFunction::kImplicitSetter: |
| 1261 return true; |
| 1262 case RawFunction::kConstructor: |
| 1263 case RawFunction::kConstImplicitGetter: |
| 1264 case RawFunction::kAbstract: |
| 1265 return false; |
| 1266 default: |
| 1267 UNREACHABLE(); |
| 1268 return false; |
| 1269 } |
| 1270 } |
| 1271 bool IsStaticFunction() const { |
| 1272 if (!is_static()) { |
| 1273 return false; |
| 1274 } |
| 1275 switch (kind()) { |
| 1276 case RawFunction::kFunction: |
| 1277 case RawFunction::kGetterFunction: |
| 1278 case RawFunction::kSetterFunction: |
| 1279 case RawFunction::kImplicitGetter: |
| 1280 case RawFunction::kImplicitSetter: |
| 1281 case RawFunction::kConstImplicitGetter: |
| 1282 return true; |
| 1283 case RawFunction::kConstructor: |
| 1284 return false; |
| 1285 default: |
| 1286 UNREACHABLE(); |
| 1287 return false; |
| 1288 } |
| 1289 } |
| 1251 bool IsInFactoryScope() const; | 1290 bool IsInFactoryScope() const; |
| 1252 | 1291 |
| 1253 intptr_t token_index() const { return raw_ptr()->token_index_; } | 1292 intptr_t token_index() const { return raw_ptr()->token_index_; } |
| 1254 | 1293 |
| 1255 static intptr_t num_fixed_parameters_offset() { | 1294 static intptr_t num_fixed_parameters_offset() { |
| 1256 return OFFSET_OF(RawFunction, num_fixed_parameters_); | 1295 return OFFSET_OF(RawFunction, num_fixed_parameters_); |
| 1257 } | 1296 } |
| 1258 intptr_t num_fixed_parameters() const { | 1297 intptr_t num_fixed_parameters() const { |
| 1259 return raw_ptr()->num_fixed_parameters_; | 1298 return raw_ptr()->num_fixed_parameters_; |
| 1260 } | 1299 } |
| (...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3410 set_vtable(Smi::handle_vtable_); | 3449 set_vtable(Smi::handle_vtable_); |
| 3411 return; | 3450 return; |
| 3412 } | 3451 } |
| 3413 #ifdef DEBUG | 3452 #ifdef DEBUG |
| 3414 Heap* isolate_heap = Isolate::Current()->heap(); | 3453 Heap* isolate_heap = Isolate::Current()->heap(); |
| 3415 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 3454 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 3416 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || | 3455 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || |
| 3417 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); | 3456 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); |
| 3418 #endif | 3457 #endif |
| 3419 set_vtable((raw_ == null_) ? | 3458 set_vtable((raw_ == null_) ? |
| 3420 handle_vtable_ : raw_->ptr()->class_->ptr()->handle_vtable_); | 3459 handle_vtable_ : raw_->ptr()->class_->ptr()->handle_vtable_); |
| 3421 } | 3460 } |
| 3422 | 3461 |
| 3423 | 3462 |
| 3424 bool Function::HasCode() const { | 3463 bool Function::HasCode() const { |
| 3425 return code() != Code::null(); | 3464 return code() != Code::null(); |
| 3426 } | 3465 } |
| 3427 | 3466 |
| 3428 | 3467 |
| 3429 intptr_t Field::Offset() const { | 3468 intptr_t Field::Offset() const { |
| 3430 ASSERT(!is_static()); // Offset is valid only for instance fields. | 3469 ASSERT(!is_static()); // Offset is valid only for instance fields. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3449 } | 3488 } |
| 3450 | 3489 |
| 3451 | 3490 |
| 3452 void Context::SetAt(intptr_t index, const Instance& value) const { | 3491 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3453 StorePointer(InstanceAddr(index), value.raw()); | 3492 StorePointer(InstanceAddr(index), value.raw()); |
| 3454 } | 3493 } |
| 3455 | 3494 |
| 3456 } // namespace dart | 3495 } // namespace dart |
| 3457 | 3496 |
| 3458 #endif // VM_OBJECT_H_ | 3497 #endif // VM_OBJECT_H_ |
| OLD | NEW |