| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 | 267 |
| 268 static bool HasInterceptorGetter(JSObject* object) { | 268 static bool HasInterceptorGetter(JSObject* object) { |
| 269 return !object->GetNamedInterceptor()->getter()->IsUndefined(); | 269 return !object->GetNamedInterceptor()->getter()->IsUndefined(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 | 272 |
| 273 static void LookupForRead(Object* object, | 273 static void LookupForRead(Object* object, |
| 274 String* name, | 274 String* name, |
| 275 LookupResult* lookup) { | 275 LookupResult* lookup) { |
| 276 object->Lookup(name, lookup); | 276 AssertNoAllocation no_gc; // pointers must stay valid |
| 277 if (lookup->IsNotFound() || lookup->type() != INTERCEPTOR) { | 277 |
| 278 return; | 278 // Skip all the objects with named interceptors, but |
| 279 // without actual getter. |
| 280 while (true) { |
| 281 object->Lookup(name, lookup); |
| 282 // Besides normal conditions (property not found or it's not |
| 283 // an interceptor), bail out of lookup is not cacheable: we won't |
| 284 // be able to IC it anyway and regular lookup should work fine. |
| 285 if (lookup->IsNotFound() || lookup->type() != INTERCEPTOR || |
| 286 !lookup->IsCacheable()) { |
| 287 return; |
| 288 } |
| 289 |
| 290 JSObject* holder = lookup->holder(); |
| 291 if (HasInterceptorGetter(holder)) { |
| 292 return; |
| 293 } |
| 294 |
| 295 holder->LocalLookupRealNamedProperty(name, lookup); |
| 296 if (lookup->IsValid()) { |
| 297 ASSERT(lookup->type() != INTERCEPTOR); |
| 298 return; |
| 299 } |
| 300 |
| 301 Object* proto = holder->GetPrototype(); |
| 302 if (proto->IsNull()) { |
| 303 lookup->NotFound(); |
| 304 return; |
| 305 } |
| 306 |
| 307 object = proto; |
| 279 } | 308 } |
| 280 | |
| 281 JSObject* holder = lookup->holder(); | |
| 282 if (HasInterceptorGetter(holder)) { | |
| 283 return; | |
| 284 } | |
| 285 | |
| 286 // There is no getter, just skip it and lookup down the proto chain | |
| 287 holder->LocalLookupRealNamedProperty(name, lookup); | |
| 288 if (lookup->IsValid()) { | |
| 289 return; | |
| 290 } | |
| 291 | |
| 292 Object* proto = holder->GetPrototype(); | |
| 293 if (proto == Heap::null_value()) { | |
| 294 return; | |
| 295 } | |
| 296 | |
| 297 LookupForRead(proto, name, lookup); | |
| 298 } | 309 } |
| 299 | 310 |
| 300 | 311 |
| 301 Object* CallIC::TryCallAsFunction(Object* object) { | 312 Object* CallIC::TryCallAsFunction(Object* object) { |
| 302 HandleScope scope; | 313 HandleScope scope; |
| 303 Handle<Object> target(object); | 314 Handle<Object> target(object); |
| 304 Handle<Object> delegate = Execution::GetFunctionDelegate(target); | 315 Handle<Object> delegate = Execution::GetFunctionDelegate(target); |
| 305 | 316 |
| 306 if (delegate->IsJSFunction()) { | 317 if (delegate->IsJSFunction()) { |
| 307 // Patch the receiver and use the delegate as the function to | 318 // Patch the receiver and use the delegate as the function to |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 #undef ADDR | 1366 #undef ADDR |
| 1356 }; | 1367 }; |
| 1357 | 1368 |
| 1358 | 1369 |
| 1359 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1370 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 1360 return IC_utilities[id]; | 1371 return IC_utilities[id]; |
| 1361 } | 1372 } |
| 1362 | 1373 |
| 1363 | 1374 |
| 1364 } } // namespace v8::internal | 1375 } } // namespace v8::internal |
| OLD | NEW |