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

Side by Side Diff: src/ic.cc

Issue 253843006: Object::Lookup(), JSObject::*Lookup*() and JSReceiver::*Lookup*() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments Created 6 years, 7 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 | « src/hydrogen.cc ('k') | src/json-stringifier.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "api.h" 8 #include "api.h"
9 #include "arguments.h" 9 #include "arguments.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return !object->GetNamedInterceptor()->setter()->IsUndefined(); 185 return !object->GetNamedInterceptor()->setter()->IsUndefined();
186 } 186 }
187 187
188 188
189 static void LookupForRead(Handle<Object> object, 189 static void LookupForRead(Handle<Object> object,
190 Handle<String> name, 190 Handle<String> name,
191 LookupResult* lookup) { 191 LookupResult* lookup) {
192 // Skip all the objects with named interceptors, but 192 // Skip all the objects with named interceptors, but
193 // without actual getter. 193 // without actual getter.
194 while (true) { 194 while (true) {
195 object->Lookup(*name, lookup); 195 object->Lookup(name, lookup);
196 // Besides normal conditions (property not found or it's not 196 // Besides normal conditions (property not found or it's not
197 // an interceptor), bail out if lookup is not cacheable: we won't 197 // an interceptor), bail out if lookup is not cacheable: we won't
198 // be able to IC it anyway and regular lookup should work fine. 198 // be able to IC it anyway and regular lookup should work fine.
199 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) { 199 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) {
200 return; 200 return;
201 } 201 }
202 202
203 Handle<JSObject> holder(lookup->holder(), lookup->isolate()); 203 Handle<JSObject> holder(lookup->holder(), lookup->isolate());
204 if (HasInterceptorGetter(*holder)) { 204 if (HasInterceptorGetter(*holder)) {
205 return; 205 return;
206 } 206 }
207 207
208 holder->LocalLookupRealNamedProperty(*name, lookup); 208 holder->LocalLookupRealNamedProperty(name, lookup);
209 if (lookup->IsFound()) { 209 if (lookup->IsFound()) {
210 ASSERT(!lookup->IsInterceptor()); 210 ASSERT(!lookup->IsInterceptor());
211 return; 211 return;
212 } 212 }
213 213
214 Handle<Object> proto(holder->GetPrototype(), lookup->isolate()); 214 Handle<Object> proto(holder->GetPrototype(), lookup->isolate());
215 if (proto->IsNull()) { 215 if (proto->IsNull()) {
216 ASSERT(!lookup->IsFound()); 216 ASSERT(!lookup->IsFound());
217 return; 217 return;
218 } 218 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (IsMoreGeneralElementsKindTransition(old_map->elements_kind(), 276 if (IsMoreGeneralElementsKindTransition(old_map->elements_kind(),
277 map->elements_kind())) { 277 map->elements_kind())) {
278 return true; 278 return true;
279 } 279 }
280 } 280 }
281 } 281 }
282 282
283 if (receiver->IsGlobalObject()) { 283 if (receiver->IsGlobalObject()) {
284 LookupResult lookup(isolate()); 284 LookupResult lookup(isolate());
285 GlobalObject* global = GlobalObject::cast(*receiver); 285 GlobalObject* global = GlobalObject::cast(*receiver);
286 global->LocalLookupRealNamedProperty(*name, &lookup); 286 global->LocalLookupRealNamedProperty(name, &lookup);
287 if (!lookup.IsFound()) return false; 287 if (!lookup.IsFound()) return false;
288 PropertyCell* cell = global->GetPropertyCell(&lookup); 288 PropertyCell* cell = global->GetPropertyCell(&lookup);
289 return cell->type()->IsConstant(); 289 return cell->type()->IsConstant();
290 } 290 }
291 291
292 return false; 292 return false;
293 } 293 }
294 294
295 295
296 void IC::TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name) { 296 void IC::TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name) {
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 return result; 1159 return result;
1160 } 1160 }
1161 1161
1162 1162
1163 static bool LookupForWrite(Handle<JSObject> receiver, 1163 static bool LookupForWrite(Handle<JSObject> receiver,
1164 Handle<String> name, 1164 Handle<String> name,
1165 Handle<Object> value, 1165 Handle<Object> value,
1166 LookupResult* lookup, 1166 LookupResult* lookup,
1167 IC* ic) { 1167 IC* ic) {
1168 Handle<JSObject> holder = receiver; 1168 Handle<JSObject> holder = receiver;
1169 receiver->Lookup(*name, lookup); 1169 receiver->Lookup(name, lookup);
1170 if (lookup->IsFound()) { 1170 if (lookup->IsFound()) {
1171 if (lookup->IsInterceptor() && !HasInterceptorSetter(lookup->holder())) { 1171 if (lookup->IsInterceptor() && !HasInterceptorSetter(lookup->holder())) {
1172 receiver->LocalLookupRealNamedProperty(*name, lookup); 1172 receiver->LocalLookupRealNamedProperty(name, lookup);
1173 if (!lookup->IsFound()) return false; 1173 if (!lookup->IsFound()) return false;
1174 } 1174 }
1175 1175
1176 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false; 1176 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false;
1177 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value); 1177 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value);
1178 if (lookup->IsPropertyCallbacks()) return true; 1178 if (lookup->IsPropertyCallbacks()) return true;
1179 // JSGlobalProxy either stores on the global object in the prototype, or 1179 // JSGlobalProxy either stores on the global object in the prototype, or
1180 // goes into the runtime if access checks are needed, so this is always 1180 // goes into the runtime if access checks are needed, so this is always
1181 // safe. 1181 // safe.
1182 if (receiver->IsJSGlobalProxy()) { 1182 if (receiver->IsJSGlobalProxy()) {
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 ASSERT(args.length() == 2); 1869 ASSERT(args.length() == 2);
1870 Handle<JSArray> receiver = args.at<JSArray>(0); 1870 Handle<JSArray> receiver = args.at<JSArray>(0);
1871 Handle<Object> len = args.at<Object>(1); 1871 Handle<Object> len = args.at<Object>(1);
1872 1872
1873 // The generated code should filter out non-Smis before we get here. 1873 // The generated code should filter out non-Smis before we get here.
1874 ASSERT(len->IsSmi()); 1874 ASSERT(len->IsSmi());
1875 1875
1876 #ifdef DEBUG 1876 #ifdef DEBUG
1877 // The length property has to be a writable callback property. 1877 // The length property has to be a writable callback property.
1878 LookupResult debug_lookup(isolate); 1878 LookupResult debug_lookup(isolate);
1879 receiver->LocalLookup(isolate->heap()->length_string(), &debug_lookup); 1879 receiver->LocalLookup(isolate->factory()->length_string(), &debug_lookup);
1880 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); 1880 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly());
1881 #endif 1881 #endif
1882 1882
1883 RETURN_FAILURE_ON_EXCEPTION( 1883 RETURN_FAILURE_ON_EXCEPTION(
1884 isolate, JSArray::SetElementsLength(receiver, len)); 1884 isolate, JSArray::SetElementsLength(receiver, len));
1885 return *len; 1885 return *len;
1886 } 1886 }
1887 1887
1888 1888
1889 // Extend storage is called in a store inline cache when 1889 // Extend storage is called in a store inline cache when
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 #undef ADDR 2908 #undef ADDR
2909 }; 2909 };
2910 2910
2911 2911
2912 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2912 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2913 return IC_utilities[id]; 2913 return IC_utilities[id];
2914 } 2914 }
2915 2915
2916 2916
2917 } } // namespace v8::internal 2917 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698