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

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

Issue 10981010: Move HasOneTarget to ICData. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « 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 8278 matching lines...) Expand 10 before | Expand all | Expand 10 after
8289 (cid != kMintCid) && 8289 (cid != kMintCid) &&
8290 (cid != kBigintCid) && 8290 (cid != kBigintCid) &&
8291 (cid != kDoubleCid)) { 8291 (cid != kDoubleCid)) {
8292 return false; 8292 return false;
8293 } 8293 }
8294 } 8294 }
8295 return true; 8295 return true;
8296 } 8296 }
8297 8297
8298 8298
8299 // Returns true if all targets are the same.
8300 // TODO(srdjan): if targets are native use their C_function to compare.
8301 bool ICData::HasOneTarget() const {
8302 ASSERT(NumberOfChecks() > 0);
8303 const Function& first_target = Function::Handle(GetTargetAt(0));
8304 Function& test_target = Function::Handle();
8305 for (intptr_t i = 1; i < NumberOfChecks(); i++) {
8306 test_target = GetTargetAt(i);
8307 if (first_target.raw() != test_target.raw()) {
8308 return false;
8309 }
8310 }
8311 return true;
8312 }
8313
8314
8299 RawICData* ICData::New(const Function& function, 8315 RawICData* ICData::New(const Function& function,
8300 const String& target_name, 8316 const String& target_name,
8301 intptr_t deopt_id, 8317 intptr_t deopt_id,
8302 intptr_t num_args_tested) { 8318 intptr_t num_args_tested) {
8303 ASSERT(Object::icdata_class() != Class::null()); 8319 ASSERT(Object::icdata_class() != Class::null());
8304 ASSERT(num_args_tested > 0); 8320 ASSERT(num_args_tested > 0);
8305 ICData& result = ICData::Handle(); 8321 ICData& result = ICData::Handle();
8306 { 8322 {
8307 // IC data objects are long living objects, allocate them in old generation. 8323 // IC data objects are long living objects, allocate them in old generation.
8308 RawObject* raw = Object::Allocate(ICData::kClassId, 8324 RawObject* raw = Object::Allocate(ICData::kClassId,
(...skipping 3730 matching lines...) Expand 10 before | Expand all | Expand 10 after
12039 } 12055 }
12040 return result.raw(); 12056 return result.raw();
12041 } 12057 }
12042 12058
12043 12059
12044 const char* WeakProperty::ToCString() const { 12060 const char* WeakProperty::ToCString() const {
12045 return "_WeakProperty"; 12061 return "_WeakProperty";
12046 } 12062 }
12047 12063
12048 } // namespace dart 12064 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698