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

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

Issue 10826285: Optimize equality for case when all targets are Object.equals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/object.h ('k') | no next file » | 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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 7597 matching lines...) Expand 10 before | Expand all | Expand 10 after
7608 } else { 7608 } else {
7609 // This will make sure that Smi is first if it exists. 7609 // This will make sure that Smi is first if it exists.
7610 result.AddReceiverCheck(class_id, 7610 result.AddReceiverCheck(class_id,
7611 Function::Handle(GetTargetAt(i))); 7611 Function::Handle(GetTargetAt(i)));
7612 } 7612 }
7613 } 7613 }
7614 return result.raw(); 7614 return result.raw();
7615 } 7615 }
7616 7616
7617 7617
7618 bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const {
7619 if (NumberOfChecks() == 0) return false;
7620 Class& cls = Class::Handle();
7621 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
7622 cls = Function::Handle(GetTargetAt(i)).owner();
7623 if (cls.id() != owner_cid) {
7624 return false;
7625 }
7626 }
7627 return true;
7628 }
7629
7630
7631 bool ICData::AllReceiversAreNumbers() const {
7632 if (NumberOfChecks() == 0) return false;
7633 Class& cls = Class::Handle();
7634 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
7635 cls = Function::Handle(GetTargetAt(i)).owner();
7636 const intptr_t cid = cls.id();
7637 if ((cid != kSmiCid) &&
7638 (cid != kMintCid) &&
7639 (cid != kBigintCid) &&
7640 (cid != kDoubleCid)) {
7641 return false;
7642 }
7643 }
7644 return true;
7645 }
7646
7647
7618 RawICData* ICData::New(const Function& function, 7648 RawICData* ICData::New(const Function& function,
7619 const String& target_name, 7649 const String& target_name,
7620 intptr_t deopt_id, 7650 intptr_t deopt_id,
7621 intptr_t num_args_tested) { 7651 intptr_t num_args_tested) {
7622 ASSERT(Object::icdata_class() != Class::null()); 7652 ASSERT(Object::icdata_class() != Class::null());
7623 ASSERT(num_args_tested > 0); 7653 ASSERT(num_args_tested > 0);
7624 ICData& result = ICData::Handle(); 7654 ICData& result = ICData::Handle();
7625 { 7655 {
7626 // IC data objects are long living objects, allocate them in old generation. 7656 // IC data objects are long living objects, allocate them in old generation.
7627 RawObject* raw = Object::Allocate(ICData::kClassId, 7657 RawObject* raw = Object::Allocate(ICData::kClassId,
(...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after
11028 const char* JSRegExp::ToCString() const { 11058 const char* JSRegExp::ToCString() const {
11029 const String& str = String::Handle(pattern()); 11059 const String& str = String::Handle(pattern());
11030 const char* format = "JSRegExp: pattern=%s flags=%s"; 11060 const char* format = "JSRegExp: pattern=%s flags=%s";
11031 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 11061 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
11032 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 11062 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
11033 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 11063 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
11034 return chars; 11064 return chars;
11035 } 11065 }
11036 11066
11037 } // namespace dart 11067 } // namespace dart
OLDNEW
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698