Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: runtime/vm/precompiler.cc

Issue 1420433004: Move selector and arguments descriptor into MegamorphicCache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/code_patcher.h" 7 #include "vm/code_patcher.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/log.h" 10 #include "vm/log.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 AddFunction(target); 350 AddFunction(target);
351 } 351 }
352 } 352 }
353 353
354 #if defined(TARGET_ARCH_IA32) 354 #if defined(TARGET_ARCH_IA32)
355 FATAL("Callee scanning unimplemented for IA32"); 355 FATAL("Callee scanning unimplemented for IA32");
356 #endif 356 #endif
357 357
358 const ObjectPool& pool = ObjectPool::Handle(Z, code.GetObjectPool()); 358 const ObjectPool& pool = ObjectPool::Handle(Z, code.GetObjectPool());
359 ICData& call_site = ICData::Handle(Z); 359 ICData& call_site = ICData::Handle(Z);
360 MegamorphicCache& cache = MegamorphicCache::Handle(Z);
360 String& selector = String::Handle(Z); 361 String& selector = String::Handle(Z);
361 Field& field = Field::Handle(Z); 362 Field& field = Field::Handle(Z);
362 Class& cls = Class::Handle(Z); 363 Class& cls = Class::Handle(Z);
363 Instance& instance = Instance::Handle(Z); 364 Instance& instance = Instance::Handle(Z);
364 Code& target_code = Code::Handle(Z); 365 Code& target_code = Code::Handle(Z);
365 for (intptr_t i = 0; i < pool.Length(); i++) { 366 for (intptr_t i = 0; i < pool.Length(); i++) {
366 if (pool.InfoAt(i) == ObjectPool::kTaggedObject) { 367 if (pool.InfoAt(i) == ObjectPool::kTaggedObject) {
367 entry = pool.ObjectAt(i); 368 entry = pool.ObjectAt(i);
368 if (entry.IsICData()) { 369 if (entry.IsICData()) {
369 call_site ^= entry.raw(); 370 call_site ^= entry.raw();
370 if (call_site.NumberOfChecks() == 1) { 371 if (call_site.NumberOfChecks() == 1) {
371 // Probably a static call. 372 // Probably a static call.
372 target = call_site.GetTargetAt(0); 373 target = call_site.GetTargetAt(0);
373 AddFunction(target); 374 AddFunction(target);
374 if (!target.is_static()) { 375 if (!target.is_static()) {
375 // Super call (should not enqueue selector) or dynamic call with a 376 // Super call (should not enqueue selector) or dynamic call with a
376 // CHA prediction (should enqueue selector). 377 // CHA prediction (should enqueue selector).
377 selector = call_site.target_name(); 378 selector = call_site.target_name();
378 AddSelector(selector); 379 AddSelector(selector);
379 } 380 }
380 } else { 381 } else {
381 // A dynamic call. 382 // A dynamic call.
382 selector = call_site.target_name(); 383 selector = call_site.target_name();
383 AddSelector(selector); 384 AddSelector(selector);
384 if (selector.raw() == Symbols::Call().raw()) { 385 if (selector.raw() == Symbols::Call().raw()) {
385 // Potential closure call. 386 // Potential closure call.
386 AddClosureCall(call_site); 387 AddClosureCall(call_site);
387 } 388 }
388 } 389 }
390 } else if (entry.IsMegamorphicCache()) {
391 // A dynamic call.
392 cache ^= entry.raw();
393 selector = cache.target_name();
394 AddSelector(selector);
389 } else if (entry.IsField()) { 395 } else if (entry.IsField()) {
390 // Potential need for field initializer. 396 // Potential need for field initializer.
391 field ^= entry.raw(); 397 field ^= entry.raw();
392 AddField(field); 398 AddField(field);
393 } else if (entry.IsInstance()) { 399 } else if (entry.IsInstance()) {
394 // Const object, literal or args descriptor. 400 // Const object, literal or args descriptor.
395 instance ^= entry.raw(); 401 instance ^= entry.raw();
396 AddConstObject(instance); 402 AddConstObject(instance);
397 } else if (entry.IsFunction()) { 403 } else if (entry.IsFunction()) {
398 // Local closure function. 404 // Local closure function.
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 continue; // class 'dynamic' is in the read-only VM isolate. 879 continue; // class 'dynamic' is in the read-only VM isolate.
874 } 880 }
875 cls.EnsureIsFinalized(T); 881 cls.EnsureIsFinalized(T);
876 } 882 }
877 } 883 }
878 I->set_all_classes_finalized(true); 884 I->set_all_classes_finalized(true);
879 } 885 }
880 886
881 887
882 } // namespace dart 888 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698