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

Side by Side Diff: src/type-info.cc

Issue 10831153: Improve load IC so it can call a native accessor even if the holder is (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 4 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 return false; 89 return false;
90 } 90 }
91 91
92 92
93 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { 93 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
94 Handle<Object> map_or_code = GetInfo(expr->id()); 94 Handle<Object> map_or_code = GetInfo(expr->id());
95 if (map_or_code->IsMap()) return true; 95 if (map_or_code->IsMap()) return true;
96 if (map_or_code->IsCode()) { 96 if (map_or_code->IsCode()) {
97 Handle<Code> code = Handle<Code>::cast(map_or_code); 97 Handle<Code> code = Handle<Code>::cast(map_or_code);
98 return code->is_keyed_load_stub() && 98 bool preliminary_checks = code->is_keyed_load_stub() &&
99 code->ic_state() == MONOMORPHIC && 99 code->ic_state() == MONOMORPHIC &&
100 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL && 100 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
101 code->FindFirstMap() != NULL && 101 if (!preliminary_checks) return false;
102 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); 102 Map* map = code->FindFirstMap();
103 return map != NULL && !CanRetainOtherContext(map, *global_context_);
103 } 104 }
104 return false; 105 return false;
105 } 106 }
106 107
107 108
108 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { 109 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) {
109 Handle<Object> map_or_code = GetInfo(expr->id()); 110 Handle<Object> map_or_code = GetInfo(expr->id());
110 if (map_or_code->IsCode()) { 111 if (map_or_code->IsCode()) {
111 Handle<Code> code = Handle<Code>::cast(map_or_code); 112 Handle<Code> code = Handle<Code>::cast(map_or_code);
112 Builtins* builtins = isolate_->builtins(); 113 Builtins* builtins = isolate_->builtins();
113 return code->is_keyed_load_stub() && 114 return code->is_keyed_load_stub() &&
114 *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) && 115 *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) &&
115 code->ic_state() == MEGAMORPHIC; 116 code->ic_state() == MEGAMORPHIC;
116 } 117 }
117 return false; 118 return false;
118 } 119 }
119 120
120 121
121 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) { 122 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) {
122 Handle<Object> map_or_code = GetInfo(expr->id()); 123 Handle<Object> map_or_code = GetInfo(expr->id());
123 if (map_or_code->IsMap()) return true; 124 if (map_or_code->IsMap()) return true;
124 if (map_or_code->IsCode()) { 125 if (map_or_code->IsCode()) {
125 Handle<Code> code = Handle<Code>::cast(map_or_code); 126 Handle<Code> code = Handle<Code>::cast(map_or_code);
126 bool allow_growth = 127 bool allow_growth =
127 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == 128 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) ==
128 ALLOW_JSARRAY_GROWTH; 129 ALLOW_JSARRAY_GROWTH;
129 return code->is_keyed_store_stub() && 130 bool preliminary_checks =
131 code->is_keyed_store_stub() &&
130 !allow_growth && 132 !allow_growth &&
131 code->ic_state() == MONOMORPHIC && 133 code->ic_state() == MONOMORPHIC &&
132 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL && 134 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL;
133 code->FindFirstMap() != NULL && 135 if (!preliminary_checks) return false;
134 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); 136 Map* map = code->FindFirstMap();
137 return map != NULL && !CanRetainOtherContext(map, *global_context_);
135 } 138 }
136 return false; 139 return false;
137 } 140 }
138 141
139 142
140 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) { 143 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) {
141 Handle<Object> map_or_code = GetInfo(expr->id()); 144 Handle<Object> map_or_code = GetInfo(expr->id());
142 if (map_or_code->IsCode()) { 145 if (map_or_code->IsCode()) {
143 Handle<Code> code = Handle<Code>::cast(map_or_code); 146 Handle<Code> code = Handle<Code>::cast(map_or_code);
144 Builtins* builtins = isolate_->builtins(); 147 Builtins* builtins = isolate_->builtins();
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 USE(maybe_result); 720 USE(maybe_result);
718 #ifdef DEBUG 721 #ifdef DEBUG
719 Object* result = NULL; 722 Object* result = NULL;
720 // Dictionary has been allocated with sufficient size for all elements. 723 // Dictionary has been allocated with sufficient size for all elements.
721 ASSERT(maybe_result->ToObject(&result)); 724 ASSERT(maybe_result->ToObject(&result));
722 ASSERT(*dictionary_ == result); 725 ASSERT(*dictionary_ == result);
723 #endif 726 #endif
724 } 727 }
725 728
726 } } // namespace v8::internal 729 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698