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

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

Issue 19792007: Recognize Math's min and max function for doubles and inline the operation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 8893 matching lines...) Expand 10 before | Expand all | Expand 10 after
8904 } 8904 }
8905 8905
8906 8906
8907 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids, 8907 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
8908 const Function& target) const { 8908 const Function& target) const {
8909 DEBUG_ASSERT(!HasCheck(class_ids)); 8909 DEBUG_ASSERT(!HasCheck(class_ids));
8910 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'. 8910 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'.
8911 ASSERT(class_ids.length() == num_args_tested()); 8911 ASSERT(class_ids.length() == num_args_tested());
8912 const intptr_t old_num = NumberOfChecks(); 8912 const intptr_t old_num = NumberOfChecks();
8913 Array& data = Array::Handle(ic_data()); 8913 Array& data = Array::Handle(ic_data());
8914 // ICData of static calls with num_args_tested() > 0 have initially a
8915 // dummy set of cids entered (see ICData::AddTarget). That entry is
8916 // overwritten by first real type feedback data.
8917 if (old_num == 1) {
8918 bool has_dummy_entry = true;
8919 for (intptr_t i = 0; i < num_args_tested(); i++) {
8920 if (Smi::Value(Smi::RawCast(data.At(i))) != kObjectCid) {
8921 has_dummy_entry = false;
8922 break;
8923 }
8924 }
8925 if (has_dummy_entry) {
8926 ASSERT(target.raw() == data.At(num_args_tested()));
8927 // Replace dummy entry.
8928 Smi& value = Smi::Handle();
8929 for (intptr_t i = 0; i < num_args_tested(); i++) {
8930 ASSERT(class_ids[i] != kIllegalCid);
8931 value = Smi::New(class_ids[i]);
8932 data.SetAt(i, value);
8933 }
8934 return;
8935 }
8936 }
8914 const intptr_t new_len = data.Length() + TestEntryLength(); 8937 const intptr_t new_len = data.Length() + TestEntryLength();
8915 data = Array::Grow(data, new_len, Heap::kOld); 8938 data = Array::Grow(data, new_len, Heap::kOld);
8916 set_ic_data(data); 8939 set_ic_data(data);
8917 WriteSentinel(data); 8940 WriteSentinel(data);
8918 intptr_t data_pos = old_num * TestEntryLength(); 8941 intptr_t data_pos = old_num * TestEntryLength();
8919 Smi& value = Smi::Handle(); 8942 Smi& value = Smi::Handle();
8920 for (intptr_t i = 0; i < class_ids.length(); i++) { 8943 for (intptr_t i = 0; i < class_ids.length(); i++) {
8921 // kIllegalCid is used as terminating value, do not add it. 8944 // kIllegalCid is used as terminating value, do not add it.
8922 ASSERT(class_ids[i] != kIllegalCid); 8945 ASSERT(class_ids[i] != kIllegalCid);
8923 value = Smi::New(class_ids[i]); 8946 value = Smi::New(class_ids[i]);
(...skipping 5324 matching lines...) Expand 10 before | Expand all | Expand 10 after
14248 } 14271 }
14249 14272
14250 14273
14251 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14274 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14252 stream->OpenObject(); 14275 stream->OpenObject();
14253 stream->CloseObject(); 14276 stream->CloseObject();
14254 } 14277 }
14255 14278
14256 14279
14257 } // namespace dart 14280 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698