| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/precompiler.h" | 5 #include "vm/precompiler.h" |
| 6 | 6 |
| 7 #include "vm/cha.h" | 7 #include "vm/cha.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/hash_table.h" | 10 #include "vm/hash_table.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // discovered through _getMainClosure. | 147 // discovered through _getMainClosure. |
| 148 | 148 |
| 149 AddSelector(Symbols::NoSuchMethod()); | 149 AddSelector(Symbols::NoSuchMethod()); |
| 150 | 150 |
| 151 AddSelector(Symbols::Call()); // For speed, not correctness. | 151 AddSelector(Symbols::Call()); // For speed, not correctness. |
| 152 | 152 |
| 153 // Allocated from C++. | 153 // Allocated from C++. |
| 154 static const intptr_t kExternallyAllocatedCids[] = { | 154 static const intptr_t kExternallyAllocatedCids[] = { |
| 155 kBoolCid, | 155 kBoolCid, |
| 156 kNullCid, | 156 kNullCid, |
| 157 kClosureCid, |
| 157 | 158 |
| 158 kSmiCid, | 159 kSmiCid, |
| 159 kMintCid, | 160 kMintCid, |
| 160 kBigintCid, | 161 kBigintCid, |
| 161 kDoubleCid, | 162 kDoubleCid, |
| 162 | 163 |
| 163 kOneByteStringCid, | 164 kOneByteStringCid, |
| 164 kTwoByteStringCid, | 165 kTwoByteStringCid, |
| 165 kExternalOneByteStringCid, | 166 kExternalOneByteStringCid, |
| 166 kExternalTwoByteStringCid, | 167 kExternalTwoByteStringCid, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 194 | 195 |
| 195 kTypedDataFloat32x4ArrayCid, | 196 kTypedDataFloat32x4ArrayCid, |
| 196 kTypedDataInt32x4ArrayCid, | 197 kTypedDataInt32x4ArrayCid, |
| 197 kTypedDataFloat64x2ArrayCid, | 198 kTypedDataFloat64x2ArrayCid, |
| 198 | 199 |
| 199 kInt32x4Cid, | 200 kInt32x4Cid, |
| 200 kFloat32x4Cid, | 201 kFloat32x4Cid, |
| 201 kFloat64x2Cid, | 202 kFloat64x2Cid, |
| 202 | 203 |
| 203 kTypeCid, | 204 kTypeCid, |
| 205 kFunctionTypeCid, |
| 204 kTypeRefCid, | 206 kTypeRefCid, |
| 205 kTypeParameterCid, | 207 kTypeParameterCid, |
| 206 kBoundedTypeCid, | 208 kBoundedTypeCid, |
| 207 kLibraryPrefixCid, | 209 kLibraryPrefixCid, |
| 208 | 210 |
| 209 kJSRegExpCid, | 211 kJSRegExpCid, |
| 210 kUserTagCid, | 212 kUserTagCid, |
| 211 kStacktraceCid, | 213 kStacktraceCid, |
| 212 kWeakPropertyCid, | 214 kWeakPropertyCid, |
| 213 kCapabilityCid, | 215 kCapabilityCid, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 463 } |
| 462 } | 464 } |
| 463 | 465 |
| 464 | 466 |
| 465 void Precompiler::AddConstObject(const Instance& instance) { | 467 void Precompiler::AddConstObject(const Instance& instance) { |
| 466 const Class& cls = Class::Handle(Z, instance.clazz()); | 468 const Class& cls = Class::Handle(Z, instance.clazz()); |
| 467 AddInstantiatedClass(cls); | 469 AddInstantiatedClass(cls); |
| 468 | 470 |
| 469 if (instance.IsClosure()) { | 471 if (instance.IsClosure()) { |
| 470 // An implicit static closure. | 472 // An implicit static closure. |
| 471 const Function& func = Function::Handle(Z, Closure::function(instance)); | 473 const Function& func = |
| 474 Function::Handle(Z, Closure::Cast(instance).function()); |
| 472 ASSERT(func.is_static()); | 475 ASSERT(func.is_static()); |
| 473 AddFunction(func); | 476 AddFunction(func); |
| 474 return; | 477 return; |
| 475 } | 478 } |
| 476 | 479 |
| 477 // Can't ask immediate objects if they're canoncial. | 480 // Can't ask immediate objects if they're canoncial. |
| 478 if (instance.IsSmi()) return; | 481 if (instance.IsSmi()) return; |
| 479 | 482 |
| 480 // Some Instances in the ObjectPool aren't const objects, such as | 483 // Some Instances in the ObjectPool aren't const objects, such as |
| 481 // argument descriptors. | 484 // argument descriptors. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 504 }; | 507 }; |
| 505 | 508 |
| 506 ConstObjectVisitor visitor(this, I); | 509 ConstObjectVisitor visitor(this, I); |
| 507 instance.raw()->VisitPointers(&visitor); | 510 instance.raw()->VisitPointers(&visitor); |
| 508 } | 511 } |
| 509 | 512 |
| 510 | 513 |
| 511 void Precompiler::AddClosureCall(const ICData& call_site) { | 514 void Precompiler::AddClosureCall(const ICData& call_site) { |
| 512 const Array& arguments_descriptor = | 515 const Array& arguments_descriptor = |
| 513 Array::Handle(Z, call_site.arguments_descriptor()); | 516 Array::Handle(Z, call_site.arguments_descriptor()); |
| 514 const Type& function_impl = | |
| 515 Type::Handle(Z, I->object_store()->function_impl_type()); | |
| 516 const Class& cache_class = | 517 const Class& cache_class = |
| 517 Class::Handle(Z, function_impl.type_class()); | 518 Class::Handle(Z, I->object_store()->closure_class()); |
| 518 const Function& dispatcher = Function::Handle(Z, | 519 const Function& dispatcher = Function::Handle(Z, |
| 519 cache_class.GetInvocationDispatcher(Symbols::Call(), | 520 cache_class.GetInvocationDispatcher(Symbols::Call(), |
| 520 arguments_descriptor, | 521 arguments_descriptor, |
| 521 RawFunction::kInvokeFieldDispatcher, | 522 RawFunction::kInvokeFieldDispatcher, |
| 522 true /* create_if_absent */)); | 523 true /* create_if_absent */)); |
| 523 AddFunction(dispatcher); | 524 AddFunction(dispatcher); |
| 524 } | 525 } |
| 525 | 526 |
| 526 | 527 |
| 527 void Precompiler::AddField(const Field& field) { | 528 void Precompiler::AddField(const Field& field) { |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 cls = it.GetNextClass(); | 1141 cls = it.GetNextClass(); |
| 1141 if (cls.IsDynamicClass()) { | 1142 if (cls.IsDynamicClass()) { |
| 1142 continue; // class 'dynamic' is in the read-only VM isolate. | 1143 continue; // class 'dynamic' is in the read-only VM isolate. |
| 1143 } | 1144 } |
| 1144 cls.set_is_allocated(false); | 1145 cls.set_is_allocated(false); |
| 1145 } | 1146 } |
| 1146 } | 1147 } |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 } // namespace dart | 1150 } // namespace dart |
| OLD | NEW |