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

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

Issue 1952023002: Minor cleanup based on profiler output of CompileParseFunction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | runtime/vm/snapshot_test.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) 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_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 void ClearRememberedBitUnsynchronized() { 425 void ClearRememberedBitUnsynchronized() {
426 uword tags = ptr()->tags_; 426 uword tags = ptr()->tags_;
427 ptr()->tags_ = RememberedBit::update(false, tags); 427 ptr()->tags_ = RememberedBit::update(false, tags);
428 } 428 }
429 // Returns false if the bit was already set. 429 // Returns false if the bit was already set.
430 // TODO(koda): Add "must use result" annotation here, after we add support. 430 // TODO(koda): Add "must use result" annotation here, after we add support.
431 bool TryAcquireRememberedBit() { 431 bool TryAcquireRememberedBit() {
432 return TryAcquireTagBit<RememberedBit>(); 432 return TryAcquireTagBit<RememberedBit>();
433 } 433 }
434 434
435 #define DEFINE_IS_CID(clazz) \
436 bool Is##clazz() { return ((GetClassId() == k##clazz##Cid)); }
437 CLASS_LIST(DEFINE_IS_CID)
438 #undef DEFINE_IS_CID
439
440 #define DEFINE_IS_CID(clazz) \
441 bool IsTypedData##clazz() { \
442 return ((GetClassId() == kTypedData##clazz##Cid)); \
443 } \
444 bool IsTypedDataView##clazz() { \
445 return ((GetClassId() == kTypedDataView##clazz##Cid)); \
446 } \
447 bool IsExternalTypedData##clazz() { \
448 return ((GetClassId() == kExternalTypedData##clazz##Cid)); \
449 } \
450 CLASS_LIST_TYPED_DATA(DEFINE_IS_CID)
451 #undef DEFINE_IS_CID
452
435 bool IsDartInstance() { 453 bool IsDartInstance() {
436 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); 454 return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
437 } 455 }
438 bool IsFreeListElement() { 456 bool IsFreeListElement() {
439 return ((GetClassId() == kFreeListElement)); 457 return ((GetClassId() == kFreeListElement));
440 } 458 }
441 bool IsScript() {
442 return ((GetClassId() == kScriptCid));
443 }
444 bool IsField() {
445 return ((GetClassId() == kFieldCid));
446 }
447 bool IsFunction() {
448 return ((GetClassId() == kFunctionCid));
449 }
450 bool IsInstructions() {
451 return ((GetClassId() == kInstructionsCid));
452 }
453 bool IsCode() {
454 return ((GetClassId() == kCodeCid));
455 }
456 bool IsString() {
457 return IsStringClassId(GetClassId());
rmacnak 2016/05/05 03:58:29 This isn't the same as GetClassId() == kStringCid.
458 }
459 bool IsStackmap() {
460 return ((GetClassId() == kStackmapCid));
461 }
462 bool IsPcDescriptors() {
463 return ((GetClassId() == kPcDescriptorsCid));
464 }
465 bool IsOneByteString() {
466 return ((GetClassId() == kOneByteStringCid));
467 }
468 459
469 intptr_t Size() const { 460 intptr_t Size() const {
470 uword tags = ptr()->tags_; 461 uword tags = ptr()->tags_;
471 intptr_t result = SizeTag::decode(tags); 462 intptr_t result = SizeTag::decode(tags);
472 if (result != 0) { 463 if (result != 0) {
473 ASSERT(result == SizeFromClass()); 464 ASSERT(result == SizeFromClass());
474 return result; 465 return result;
475 } 466 }
476 result = SizeFromClass(); 467 result = SizeFromClass();
477 ASSERT(result > SizeTag::kMaxSizeTag); 468 ASSERT(result > SizeTag::kMaxSizeTag);
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2418 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2428 kTypedDataInt8ArrayViewCid + 15); 2419 kTypedDataInt8ArrayViewCid + 15);
2429 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2420 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2430 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2421 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2431 return (kNullCid - kTypedDataInt8ArrayCid); 2422 return (kNullCid - kTypedDataInt8ArrayCid);
2432 } 2423 }
2433 2424
2434 } // namespace dart 2425 } // namespace dart
2435 2426
2436 #endif // VM_RAW_OBJECT_H_ 2427 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/profiler_service.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698