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

Side by Side Diff: runtime/vm/method_recognizer.h

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/message_test.cc ('k') | runtime/vm/method_recognizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 RUNTIME_VM_METHOD_RECOGNIZER_H_ 5 #ifndef RUNTIME_VM_METHOD_RECOGNIZER_H_
6 #define RUNTIME_VM_METHOD_RECOGNIZER_H_ 6 #define RUNTIME_VM_METHOD_RECOGNIZER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // clang-format off
12 // (class-name, function-name, recognized enum, result type, fingerprint). 13 // (class-name, function-name, recognized enum, result type, fingerprint).
13 // When adding a new function add a 0 as fingerprint, build and run to get the 14 // When adding a new function add a 0 as fingerprint, build and run to get the
14 // correct fingerprint from the mismatch error. 15 // correct fingerprint from the mismatch error.
15 #define OTHER_RECOGNIZED_LIST(V) \ 16 #define OTHER_RECOGNIZED_LIST(V) \
16 V(::, identical, ObjectIdentical, Bool, 0x49c6e96a) \ 17 V(::, identical, ObjectIdentical, Bool, 0x49c6e96a) \
17 V(ClassID, getID, ClassIDgetID, Smi, 0x528fd455) \ 18 V(ClassID, getID, ClassIDgetID, Smi, 0x528fd455) \
18 V(Object, Object., ObjectConstructor, Dynamic, 0x681617fe) \ 19 V(Object, Object., ObjectConstructor, Dynamic, 0x681617fe) \
19 V(_List, ., ObjectArrayAllocate, Array, 0x63078b15) \ 20 V(_List, ., ObjectArrayAllocate, Array, 0x63078b15) \
20 V(_TypedList, _getInt8, ByteArrayBaseGetInt8, Smi, 0x59e7291d) \ 21 V(_TypedList, _getInt8, ByteArrayBaseGetInt8, Smi, 0x59e7291d) \
21 V(_TypedList, _getUint8, ByteArrayBaseGetUint8, Smi, 0x38d3e5bf) \ 22 V(_TypedList, _getUint8, ByteArrayBaseGetUint8, Smi, 0x38d3e5bf) \
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x4e82d1e9) \ 484 V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x4e82d1e9) \
484 V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0x4f3587fc) \ 485 V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0x4f3587fc) \
485 V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x6cef30ee) \ 486 V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x6cef30ee) \
486 V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0x64f938ac) \ 487 V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0x64f938ac) \
487 V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x3693c029) \ 488 V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x3693c029) \
488 V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x74bbf260) \ 489 V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x74bbf260) \
489 V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x6e72f2a4) \ 490 V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x6e72f2a4) \
490 V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x4765edda) \ 491 V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x4765edda) \
491 V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x7cca4533) \ 492 V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x7cca4533) \
492 V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x7631bdbc) \ 493 V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x7631bdbc) \
493 V(Object, get:runtimeType, ObjectRuntimeType, 0x00e7c26b) \ 494 V(Object, get:runtimeType, ObjectRuntimeType, 0x00e7c26b)
495
496 // clang-format on
494 497
495 // Forward declarations. 498 // Forward declarations.
496 class Function; 499 class Function;
497 500
498 // Class that recognizes the name and owner of a function and returns the 501 // Class that recognizes the name and owner of a function and returns the
499 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable 502 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable
500 // functions. 503 // functions.
501 class MethodRecognizer : public AllStatic { 504 class MethodRecognizer : public AllStatic {
502 public: 505 public:
503 enum Kind { 506 enum Kind {
504 kUnknown, 507 kUnknown,
505 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, type, fp) \ 508 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name, type, fp) \
506 k##enum_name, 509 k##enum_name,
507 RECOGNIZED_LIST(DEFINE_ENUM_LIST) 510 RECOGNIZED_LIST(DEFINE_ENUM_LIST)
508 #undef DEFINE_ENUM_LIST 511 #undef DEFINE_ENUM_LIST
509 kNumRecognizedMethods 512 kNumRecognizedMethods
510 }; 513 };
511 514
512 static Kind RecognizeKind(const Function& function); 515 static Kind RecognizeKind(const Function& function);
513 static bool AlwaysInline(const Function& function); 516 static bool AlwaysInline(const Function& function);
514 static bool PolymorphicTarget(const Function& function); 517 static bool PolymorphicTarget(const Function& function);
515 static intptr_t ResultCid(const Function& function); 518 static intptr_t ResultCid(const Function& function);
516 static intptr_t MethodKindToReceiverCid(Kind kind); 519 static intptr_t MethodKindToReceiverCid(Kind kind);
517 static const char* KindToCString(Kind kind); 520 static const char* KindToCString(Kind kind);
518 #if defined(DART_NO_SNAPSHOT) 521 #if defined(DART_NO_SNAPSHOT)
519 static void InitializeState(); 522 static void InitializeState();
520 #endif // defined(DART_NO_SNAPSHOT). 523 #endif // defined(DART_NO_SNAPSHOT).
521 }; 524 };
522 525
523 526
524 #if defined(DART_NO_SNAPSHOT) 527 #if defined(DART_NO_SNAPSHOT)
525 #define CHECK_FINGERPRINT2(f, p0, p1, fp) \ 528 #define CHECK_FINGERPRINT2(f, p0, p1, fp) \
526 ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1, fp)) 529 ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1, fp))
527 530
528 #define CHECK_FINGERPRINT3(f, p0, p1, p2, fp) \ 531 #define CHECK_FINGERPRINT3(f, p0, p1, p2, fp) \
529 ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1 ", " #p2, fp)) 532 ASSERT(f.CheckSourceFingerprint(#p0 ", " #p1 ", " #p2, fp))
530 #endif // defined(DART_NO_SNAPSHOT). 533 #endif // defined(DART_NO_SNAPSHOT).
531 534
532 535
536 // clang-format off
533 // List of recognized list factories: 537 // List of recognized list factories:
534 // (factory-name-symbol, result-cid, fingerprint). 538 // (factory-name-symbol, result-cid, fingerprint).
535 #define RECOGNIZED_LIST_FACTORY_LIST(V) \ 539 #define RECOGNIZED_LIST_FACTORY_LIST(V) \
536 V(_ListFactory, kArrayCid, 0x63078b15) \ 540 V(_ListFactory, kArrayCid, 0x63078b15) \
537 V(_GrowableListWithData, kGrowableObjectArrayCid, 0x25a786de) \ 541 V(_GrowableListWithData, kGrowableObjectArrayCid, 0x25a786de) \
538 V(_GrowableListFactory, kGrowableObjectArrayCid, 0x4f4d4790) \ 542 V(_GrowableListFactory, kGrowableObjectArrayCid, 0x4f4d4790) \
539 V(_Int8ArrayFactory, kTypedDataInt8ArrayCid, 0x2e7749e3) \ 543 V(_Int8ArrayFactory, kTypedDataInt8ArrayCid, 0x2e7749e3) \
540 V(_Uint8ArrayFactory, kTypedDataUint8ArrayCid, 0x6ab75439) \ 544 V(_Uint8ArrayFactory, kTypedDataUint8ArrayCid, 0x6ab75439) \
541 V(_Uint8ClampedArrayFactory, kTypedDataUint8ClampedArrayCid, 0x183129d7) \ 545 V(_Uint8ClampedArrayFactory, kTypedDataUint8ClampedArrayCid, 0x183129d7) \
542 V(_Int16ArrayFactory, kTypedDataInt16ArrayCid, 0x14b563ea) \ 546 V(_Int16ArrayFactory, kTypedDataInt16ArrayCid, 0x14b563ea) \
543 V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 0x07456be4) \ 547 V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 0x07456be4) \
544 V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 0x5bd49250) \ 548 V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 0x5bd49250) \
545 V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 0x3c59b3a4) \ 549 V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 0x3c59b3a4) \
546 V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 0x57d85ac7) \ 550 V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 0x57d85ac7) \
547 V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 0x2c093004) \ 551 V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 0x2c093004) \
548 V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 0x501be4f1) \ 552 V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 0x501be4f1) \
549 V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 0x738e124b) \ 553 V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 0x738e124b) \
550 V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 0x7a7dd718) \ 554 V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 0x7a7dd718)
551 555
556 // clang-format on
552 557
553 // Class that recognizes factories and returns corresponding result cid. 558 // Class that recognizes factories and returns corresponding result cid.
554 class FactoryRecognizer : public AllStatic { 559 class FactoryRecognizer : public AllStatic {
555 public: 560 public:
556 // Return kDynamicCid if factory is not recognized. 561 // Return kDynamicCid if factory is not recognized.
557 static intptr_t ResultCid(const Function& factory); 562 static intptr_t ResultCid(const Function& factory);
558 }; 563 };
559 564
560 } // namespace dart 565 } // namespace dart
561 566
562 #endif // RUNTIME_VM_METHOD_RECOGNIZER_H_ 567 #endif // RUNTIME_VM_METHOD_RECOGNIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/message_test.cc ('k') | runtime/vm/method_recognizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698