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

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

Issue 2132933003: VM: Remove collection of unused range feedback. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove comment Created 4 years, 5 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/object.h ('k') | runtime/vm/raw_object.h » ('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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 13502 matching lines...) Expand 10 before | Expand all | Expand 10 after
13513 obj = from_array.At(i); 13513 obj = from_array.At(i);
13514 cloned_array.SetAt(i, obj); 13514 cloned_array.SetAt(i, obj);
13515 } 13515 }
13516 result.set_ic_data_array(cloned_array); 13516 result.set_ic_data_array(cloned_array);
13517 // Copy deoptimization reasons. 13517 // Copy deoptimization reasons.
13518 result.SetDeoptReasons(from.DeoptReasons()); 13518 result.SetDeoptReasons(from.DeoptReasons());
13519 return result.raw(); 13519 return result.raw();
13520 } 13520 }
13521 13521
13522 13522
13523 static Token::Kind RecognizeArithmeticOp(const String& name) {
13524 ASSERT(name.IsSymbol());
13525 if (name.raw() == Symbols::Plus().raw()) {
13526 return Token::kADD;
13527 } else if (name.raw() == Symbols::Minus().raw()) {
13528 return Token::kSUB;
13529 } else if (name.raw() == Symbols::Star().raw()) {
13530 return Token::kMUL;
13531 } else if (name.raw() == Symbols::Slash().raw()) {
13532 return Token::kDIV;
13533 } else if (name.raw() == Symbols::TruncDivOperator().raw()) {
13534 return Token::kTRUNCDIV;
13535 } else if (name.raw() == Symbols::Percent().raw()) {
13536 return Token::kMOD;
13537 } else if (name.raw() == Symbols::BitOr().raw()) {
13538 return Token::kBIT_OR;
13539 } else if (name.raw() == Symbols::Ampersand().raw()) {
13540 return Token::kBIT_AND;
13541 } else if (name.raw() == Symbols::Caret().raw()) {
13542 return Token::kBIT_XOR;
13543 } else if (name.raw() == Symbols::LeftShiftOperator().raw()) {
13544 return Token::kSHL;
13545 } else if (name.raw() == Symbols::RightShiftOperator().raw()) {
13546 return Token::kSHR;
13547 } else if (name.raw() == Symbols::Tilde().raw()) {
13548 return Token::kBIT_NOT;
13549 } else if (name.raw() == Symbols::UnaryMinus().raw()) {
13550 return Token::kNEGATE;
13551 }
13552 return Token::kILLEGAL;
13553 }
13554
13555
13556 bool ICData::HasRangeFeedback() const {
13557 const String& target = String::Handle(target_name());
13558 const Token::Kind token_kind = RecognizeArithmeticOp(target);
13559 if (!Token::IsBinaryArithmeticOperator(token_kind) &&
13560 !Token::IsUnaryArithmeticOperator(token_kind)) {
13561 return false;
13562 }
13563
13564 bool initialized = false;
13565 const intptr_t len = NumberOfChecks();
13566 GrowableArray<intptr_t> class_ids;
13567 for (intptr_t i = 0; i < len; i++) {
13568 if (IsUsedAt(i)) {
13569 initialized = true;
13570 GetClassIdsAt(i, &class_ids);
13571 for (intptr_t j = 0; j < class_ids.length(); j++) {
13572 const intptr_t cid = class_ids[j];
13573 if ((cid != kSmiCid) && (cid != kMintCid)) {
13574 return false;
13575 }
13576 }
13577 }
13578 }
13579
13580 return initialized;
13581 }
13582
13583
13584 ICData::RangeFeedback ICData::DecodeRangeFeedbackAt(intptr_t idx) const {
13585 ASSERT((0 <= idx) && (idx < 3));
13586 const uint32_t raw_feedback =
13587 RangeFeedbackBits::decode(raw_ptr()->state_bits_);
13588 const uint32_t feedback =
13589 (raw_feedback >> (idx * kBitsPerRangeFeedback)) & kRangeFeedbackMask;
13590 if ((feedback & kInt64RangeBit) != 0) {
13591 return kInt64Range;
13592 }
13593
13594 if ((feedback & kUint32RangeBit) != 0) {
13595 if ((feedback & kSignedRangeBit) == 0) {
13596 return kUint32Range;
13597 }
13598
13599 // Check if Smi is large enough to accomodate Int33: a mixture of Uint32
13600 // and negative Int32 values.
13601 return (kSmiBits < 33) ? kInt64Range : kSmiRange;
13602 }
13603
13604 if ((feedback & kInt32RangeBit) != 0) {
13605 return kInt32Range;
13606 }
13607
13608 return kSmiRange;
13609 }
13610
13611
13612 Code::Comments& Code::Comments::New(intptr_t count) { 13523 Code::Comments& Code::Comments::New(intptr_t count) {
13613 Comments* comments; 13524 Comments* comments;
13614 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) { 13525 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) {
13615 // This should be caught before we reach here. 13526 // This should be caught before we reach here.
13616 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n", 13527 FATAL1("Fatal error in Code::Comments::New: invalid count %" Pd "\n",
13617 count); 13528 count);
13618 } 13529 }
13619 if (count == 0) { 13530 if (count == 0) {
13620 comments = new Comments(Object::empty_array()); 13531 comments = new Comments(Object::empty_array());
13621 } else { 13532 } else {
(...skipping 9046 matching lines...) Expand 10 before | Expand all | Expand 10 after
22668 return UserTag::null(); 22579 return UserTag::null();
22669 } 22580 }
22670 22581
22671 22582
22672 const char* UserTag::ToCString() const { 22583 const char* UserTag::ToCString() const {
22673 const String& tag_label = String::Handle(label()); 22584 const String& tag_label = String::Handle(label());
22674 return tag_label.ToCString(); 22585 return tag_label.ToCString();
22675 } 22586 }
22676 22587
22677 } // namespace dart 22588 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698