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

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

Issue 11090027: Address Florian's comments. (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 7383 matching lines...) Expand 10 before | Expand all | Expand 10 after
7394 7394
7395 void ICData::WriteSentinel() const { 7395 void ICData::WriteSentinel() const {
7396 const Smi& sentinel_value = Smi::Handle(Smi::New(kIllegalCid)); 7396 const Smi& sentinel_value = Smi::Handle(Smi::New(kIllegalCid));
7397 const Array& data = Array::Handle(ic_data()); 7397 const Array& data = Array::Handle(ic_data());
7398 for (intptr_t i = 1; i <= TestEntryLength(); i++) { 7398 for (intptr_t i = 1; i <= TestEntryLength(); i++) {
7399 data.SetAt(data.Length() - i, sentinel_value); 7399 data.SetAt(data.Length() - i, sentinel_value);
7400 } 7400 }
7401 } 7401 }
7402 7402
7403 7403
7404 #if defined(DEBUG)
7404 // Used in asserts to verify that a check is not added twice. 7405 // Used in asserts to verify that a check is not added twice.
7405 bool ICData::HasCheck(const GrowableArray<intptr_t>& cids) const { 7406 bool ICData::HasCheck(const GrowableArray<intptr_t>& cids) const {
7406 for (intptr_t i = 0; i < NumberOfChecks(); i++) { 7407 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
7407 GrowableArray<intptr_t> class_ids; 7408 GrowableArray<intptr_t> class_ids;
7408 Function& target = Function::Handle(); 7409 Function& target = Function::Handle();
7409 GetCheckAt(i, &class_ids, &target); 7410 GetCheckAt(i, &class_ids, &target);
7410 bool matches = true; 7411 bool matches = true;
7411 for (intptr_t k = 0; k < class_ids.length(); k++) { 7412 for (intptr_t k = 0; k < class_ids.length(); k++) {
7412 if (class_ids[k] != cids[k]) { 7413 if (class_ids[k] != cids[k]) {
7413 matches = false; 7414 matches = false;
7414 break; 7415 break;
7415 } 7416 }
7416 } 7417 }
7417 if (matches) { 7418 if (matches) {
7418 return true; 7419 return true;
7419 } 7420 }
7420 } 7421 }
7421 return false; 7422 return false;
7422 } 7423 }
7424 #endif // DEBUG
7423 7425
7424 7426
7425 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids, 7427 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
7426 const Function& target) const { 7428 const Function& target) const {
7427 ASSERT(!HasCheck(class_ids)); 7429 DEBUG_ASSERT(!HasCheck(class_ids));
7428 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'. 7430 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'.
7429 ASSERT(class_ids.length() == num_args_tested()); 7431 ASSERT(class_ids.length() == num_args_tested());
7430 const intptr_t old_num = NumberOfChecks(); 7432 const intptr_t old_num = NumberOfChecks();
7431 Array& data = Array::Handle(ic_data()); 7433 Array& data = Array::Handle(ic_data());
7432 const intptr_t new_len = data.Length() + TestEntryLength(); 7434 const intptr_t new_len = data.Length() + TestEntryLength();
7433 data = Array::Grow(data, new_len, Heap::kOld); 7435 data = Array::Grow(data, new_len, Heap::kOld);
7434 set_ic_data(data); 7436 set_ic_data(data);
7435 WriteSentinel(); 7437 WriteSentinel();
7436 intptr_t data_pos = old_num * TestEntryLength(); 7438 intptr_t data_pos = old_num * TestEntryLength();
7437 for (intptr_t i = 0; i < class_ids.length(); i++) { 7439 for (intptr_t i = 0; i < class_ids.length(); i++) {
(...skipping 4758 matching lines...) Expand 10 before | Expand all | Expand 10 after
12196 } 12198 }
12197 return result.raw(); 12199 return result.raw();
12198 } 12200 }
12199 12201
12200 12202
12201 const char* WeakProperty::ToCString() const { 12203 const char* WeakProperty::ToCString() const {
12202 return "_WeakProperty"; 12204 return "_WeakProperty";
12203 } 12205 }
12204 12206
12205 } // namespace dart 12207 } // 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