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

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

Issue 562333004: Recognize Bigint setters and getters. This code will be removed when/if we change the fields to be … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 (ic_data.NumberOfChecks() == 1) && 2955 (ic_data.NumberOfChecks() == 1) &&
2956 (class_ids[0] == kGrowableObjectArrayCid)) { 2956 (class_ids[0] == kGrowableObjectArrayCid)) {
2957 // This is an internal method, no need to check argument types nor 2957 // This is an internal method, no need to check argument types nor
2958 // range. 2958 // range.
2959 Definition* array = call->ArgumentAt(0); 2959 Definition* array = call->ArgumentAt(0);
2960 Definition* value = call->ArgumentAt(1); 2960 Definition* value = call->ArgumentAt(1);
2961 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr( 2961 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2962 GrowableObjectArray::length_offset(), 2962 GrowableObjectArray::length_offset(),
2963 new(I) Value(array), 2963 new(I) Value(array),
2964 new(I) Value(value), 2964 new(I) Value(value),
2965 kNoStoreBarrier,
2966 call->token_pos());
2967 ReplaceCall(call, store);
2968 return true;
2969 }
2970
2971 if ((recognized_kind == MethodRecognizer::kBigint_setUsed) &&
2972 (ic_data.NumberOfChecks() == 1) &&
2973 (class_ids[0] == kBigintCid)) {
2974 // This is an internal method, no need to check argument types nor
2975 // range.
2976 Definition* bigint = call->ArgumentAt(0);
2977 Definition* value = call->ArgumentAt(1);
2978 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2979 Bigint::used_offset(),
2980 new(I) Value(bigint),
2981 new(I) Value(value),
2982 kNoStoreBarrier,
2983 call->token_pos());
2984 ReplaceCall(call, store);
2985 return true;
2986 }
2987
2988 if ((recognized_kind == MethodRecognizer::kBigint_setDigits) &&
2989 (ic_data.NumberOfChecks() == 1) &&
2990 (class_ids[0] == kBigintCid)) {
2991 // This is an internal method, no need to check argument types nor
2992 // range.
2993 Definition* bigint = call->ArgumentAt(0);
2994 Definition* value = call->ArgumentAt(1);
2995 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2996 Bigint::digits_offset(),
2997 new(I) Value(bigint),
2998 new(I) Value(value),
2999 kEmitStoreBarrier,
3000 call->token_pos());
3001 ReplaceCall(call, store);
3002 return true;
3003 }
3004
3005 if ((recognized_kind == MethodRecognizer::kBigint_setNeg) &&
3006 (ic_data.NumberOfChecks() == 1) &&
3007 (class_ids[0] == kBigintCid)) {
3008 // This is an internal method, no need to check argument types nor
3009 // range.
3010 Definition* bigint = call->ArgumentAt(0);
3011 Definition* value = call->ArgumentAt(1);
3012 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
3013 Bigint::neg_offset(),
3014 new(I) Value(bigint),
3015 new(I) Value(value),
2965 kEmitStoreBarrier, 3016 kEmitStoreBarrier,
2966 call->token_pos()); 3017 call->token_pos());
2967 ReplaceCall(call, store); 3018 ReplaceCall(call, store);
2968 return true; 3019 return true;
2969 } 3020 }
2970 3021
2971 if (((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) || 3022 if (((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) ||
2972 (recognized_kind == MethodRecognizer::kStringBaseCharAt)) && 3023 (recognized_kind == MethodRecognizer::kStringBaseCharAt)) &&
2973 (ic_data.NumberOfChecks() == 1) && 3024 (ic_data.NumberOfChecks() == 1) &&
2974 ((class_ids[0] == kOneByteStringCid) || 3025 ((class_ids[0] == kOneByteStringCid) ||
(...skipping 7118 matching lines...) Expand 10 before | Expand all | Expand 10 after
10093 10144
10094 // Insert materializations at environment uses. 10145 // Insert materializations at environment uses.
10095 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10146 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10096 CreateMaterializationAt( 10147 CreateMaterializationAt(
10097 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10148 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10098 } 10149 }
10099 } 10150 }
10100 10151
10101 10152
10102 } // namespace dart 10153 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698