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

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

Issue 736113002: Restructure inlining of Bigint accessors, use consistent approach, fixes a potential crash. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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/flow_graph_builder.cc ('k') | runtime/vm/method_recognizer.h » ('j') | 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) 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 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr( 2963 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2964 GrowableObjectArray::length_offset(), 2964 GrowableObjectArray::length_offset(),
2965 new(I) Value(array), 2965 new(I) Value(array),
2966 new(I) Value(value), 2966 new(I) Value(value),
2967 kNoStoreBarrier, 2967 kNoStoreBarrier,
2968 call->token_pos()); 2968 call->token_pos());
2969 ReplaceCall(call, store); 2969 ReplaceCall(call, store);
2970 return true; 2970 return true;
2971 } 2971 }
2972 2972
2973 if ((recognized_kind == MethodRecognizer::kBigint_setUsed) &&
2974 (ic_data.NumberOfChecks() == 1) &&
2975 (class_ids[0] == kBigintCid)) {
2976 // This is an internal method, no need to check argument types nor
2977 // range.
2978 Definition* bigint = call->ArgumentAt(0);
2979 Definition* value = call->ArgumentAt(1);
2980 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2981 Bigint::used_offset(),
2982 new(I) Value(bigint),
2983 new(I) Value(value),
2984 kNoStoreBarrier,
2985 call->token_pos());
2986 ReplaceCall(call, store);
2987 return true;
2988 }
2989
2990 if ((recognized_kind == MethodRecognizer::kBigint_setDigits) &&
2991 (ic_data.NumberOfChecks() == 1) &&
2992 (class_ids[0] == kBigintCid)) {
2993 // This is an internal method, no need to check argument types nor
2994 // range.
2995 Definition* bigint = call->ArgumentAt(0);
2996 Definition* value = call->ArgumentAt(1);
2997 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
2998 Bigint::digits_offset(),
2999 new(I) Value(bigint),
3000 new(I) Value(value),
3001 kEmitStoreBarrier,
3002 call->token_pos());
3003 ReplaceCall(call, store);
3004 return true;
3005 }
3006
3007 if ((recognized_kind == MethodRecognizer::kBigint_setNeg) &&
3008 (ic_data.NumberOfChecks() == 1) &&
3009 (class_ids[0] == kBigintCid)) {
3010 // This is an internal method, no need to check argument types nor
3011 // range.
3012 Definition* bigint = call->ArgumentAt(0);
3013 Definition* value = call->ArgumentAt(1);
3014 StoreInstanceFieldInstr* store = new(I) StoreInstanceFieldInstr(
3015 Bigint::neg_offset(),
3016 new(I) Value(bigint),
3017 new(I) Value(value),
3018 kEmitStoreBarrier,
3019 call->token_pos());
3020 ReplaceCall(call, store);
3021 return true;
3022 }
3023
3024 if (((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) || 2973 if (((recognized_kind == MethodRecognizer::kStringBaseCodeUnitAt) ||
3025 (recognized_kind == MethodRecognizer::kStringBaseCharAt)) && 2974 (recognized_kind == MethodRecognizer::kStringBaseCharAt)) &&
3026 (ic_data.NumberOfChecks() == 1) && 2975 (ic_data.NumberOfChecks() == 1) &&
3027 ((class_ids[0] == kOneByteStringCid) || 2976 ((class_ids[0] == kOneByteStringCid) ||
3028 (class_ids[0] == kTwoByteStringCid))) { 2977 (class_ids[0] == kTwoByteStringCid))) {
3029 return TryReplaceInstanceCallWithInline(call); 2978 return TryReplaceInstanceCallWithInline(call);
3030 } 2979 }
3031 2980
3032 if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) { 2981 if ((class_ids[0] == kOneByteStringCid) && (ic_data.NumberOfChecks() == 1)) {
3033 if (recognized_kind == MethodRecognizer::kOneByteStringSetAt) { 2982 if (recognized_kind == MethodRecognizer::kOneByteStringSetAt) {
(...skipping 7040 matching lines...) Expand 10 before | Expand all | Expand 10 after
10074 10023
10075 // Insert materializations at environment uses. 10024 // Insert materializations at environment uses.
10076 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10025 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10077 CreateMaterializationAt( 10026 CreateMaterializationAt(
10078 exits_collector_.exits()[i], alloc, *slots); 10027 exits_collector_.exits()[i], alloc, *slots);
10079 } 10028 }
10080 } 10029 }
10081 10030
10082 10031
10083 } // namespace dart 10032 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/method_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698