| 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/program_visitor.h" | 5 #include "vm/program_visitor.h" |
| 6 | 6 |
| 7 #include "vm/deopt_instructions.h" | 7 #include "vm/deopt_instructions.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/hash_map.h" | 10 #include "vm/hash_map.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 274 } |
| 275 | 275 |
| 276 static inline bool IsKeyEqual(Pair pair, Key key) { | 276 static inline bool IsKeyEqual(Pair pair, Key key) { |
| 277 return pair->CanonicalizeEquals(*key); | 277 return pair->CanonicalizeEquals(*key); |
| 278 } | 278 } |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 typedef DirectChainedHashMap<TypedDataKeyValueTrait> TypedDataSet; | 281 typedef DirectChainedHashMap<TypedDataKeyValueTrait> TypedDataSet; |
| 282 | 282 |
| 283 | 283 |
| 284 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 284 void ProgramVisitor::DedupDeoptEntries() { | 285 void ProgramVisitor::DedupDeoptEntries() { |
| 285 class DedupDeoptEntriesVisitor : public FunctionVisitor { | 286 class DedupDeoptEntriesVisitor : public FunctionVisitor { |
| 286 public: | 287 public: |
| 287 explicit DedupDeoptEntriesVisitor(Zone* zone) | 288 explicit DedupDeoptEntriesVisitor(Zone* zone) |
| 288 : zone_(zone), | 289 : zone_(zone), |
| 289 canonical_deopt_entries_(), | 290 canonical_deopt_entries_(), |
| 290 code_(Code::Handle(zone)), | 291 code_(Code::Handle(zone)), |
| 291 deopt_table_(Array::Handle(zone)), | 292 deopt_table_(Array::Handle(zone)), |
| 292 deopt_entry_(TypedData::Handle(zone)), | 293 deopt_entry_(TypedData::Handle(zone)), |
| 293 offset_(Smi::Handle(zone)), | 294 offset_(Smi::Handle(zone)), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 Code& code_; | 331 Code& code_; |
| 331 Array& deopt_table_; | 332 Array& deopt_table_; |
| 332 TypedData& deopt_entry_; | 333 TypedData& deopt_entry_; |
| 333 Smi& offset_; | 334 Smi& offset_; |
| 334 Smi& reason_and_flags_; | 335 Smi& reason_and_flags_; |
| 335 }; | 336 }; |
| 336 | 337 |
| 337 DedupDeoptEntriesVisitor visitor(Thread::Current()->zone()); | 338 DedupDeoptEntriesVisitor visitor(Thread::Current()->zone()); |
| 338 ProgramVisitor::VisitFunctions(&visitor); | 339 ProgramVisitor::VisitFunctions(&visitor); |
| 339 } | 340 } |
| 341 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 340 | 342 |
| 341 | 343 |
| 342 class CodeSourceMapKeyValueTrait { | 344 class CodeSourceMapKeyValueTrait { |
| 343 public: | 345 public: |
| 344 // Typedefs needed for the DirectChainedHashMap template. | 346 // Typedefs needed for the DirectChainedHashMap template. |
| 345 typedef const CodeSourceMap* Key; | 347 typedef const CodeSourceMap* Key; |
| 346 typedef const CodeSourceMap* Value; | 348 typedef const CodeSourceMap* Value; |
| 347 typedef const CodeSourceMap* Pair; | 349 typedef const CodeSourceMap* Pair; |
| 348 | 350 |
| 349 static Key KeyOf(Pair kv) { return kv; } | 351 static Key KeyOf(Pair kv) { return kv; } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 void ProgramVisitor::Dedup() { | 602 void ProgramVisitor::Dedup() { |
| 601 Thread* thread = Thread::Current(); | 603 Thread* thread = Thread::Current(); |
| 602 StackZone stack_zone(thread); | 604 StackZone stack_zone(thread); |
| 603 HANDLESCOPE(thread); | 605 HANDLESCOPE(thread); |
| 604 | 606 |
| 605 // TODO(rmacnak): Bind static calls whose target has been compiled. Forward | 607 // TODO(rmacnak): Bind static calls whose target has been compiled. Forward |
| 606 // references to disabled code. | 608 // references to disabled code. |
| 607 ShareMegamorphicBuckets(); | 609 ShareMegamorphicBuckets(); |
| 608 DedupStackMaps(); | 610 DedupStackMaps(); |
| 609 DedupPcDescriptors(); | 611 DedupPcDescriptors(); |
| 610 DedupDeoptEntries(); | 612 NOT_IN_PRECOMPILED(DedupDeoptEntries()); |
| 611 DedupCodeSourceMaps(); | 613 DedupCodeSourceMaps(); |
| 612 DedupLists(); | 614 DedupLists(); |
| 613 | 615 |
| 614 if (!FLAG_profiler) { | 616 if (!FLAG_profiler) { |
| 615 // Reduces binary size but obfuscates profiler results. | 617 // Reduces binary size but obfuscates profiler results. |
| 616 DedupInstructions(); | 618 DedupInstructions(); |
| 617 } | 619 } |
| 618 } | 620 } |
| 619 | 621 |
| 620 } // namespace dart | 622 } // namespace dart |
| OLD | NEW |