| OLD | NEW |
| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (HasInterceptorGetter(*holder)) { | 216 if (HasInterceptorGetter(*holder)) { |
| 217 return; | 217 return; |
| 218 } | 218 } |
| 219 | 219 |
| 220 holder->LookupOwnRealNamedProperty(name, lookup); | 220 holder->LookupOwnRealNamedProperty(name, lookup); |
| 221 if (lookup->IsFound()) { | 221 if (lookup->IsFound()) { |
| 222 ASSERT(!lookup->IsInterceptor()); | 222 ASSERT(!lookup->IsInterceptor()); |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 | 225 |
| 226 Handle<Object> proto(holder->GetPrototype(), lookup->isolate()); | 226 PrototypeIterator iter(lookup->isolate(), holder); |
| 227 if (proto->IsNull()) { | 227 if (iter.IsAtEnd()) { |
| 228 ASSERT(!lookup->IsFound()); | 228 ASSERT(!lookup->IsFound()); |
| 229 return; | 229 return; |
| 230 } | 230 } |
| 231 | 231 |
| 232 object = proto; | 232 object = PrototypeIterator::GetCurrent(iter); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| 237 bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, | 237 bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver, |
| 238 Handle<String> name) { | 238 Handle<String> name) { |
| 239 if (!IsNameCompatibleWithMonomorphicPrototypeFailure(name)) return false; | 239 if (!IsNameCompatibleWithMonomorphicPrototypeFailure(name)) return false; |
| 240 | 240 |
| 241 InlineCacheHolderFlag cache_holder = | 241 InlineCacheHolderFlag cache_holder = |
| 242 Code::ExtractCacheHolderFromFlags(target()->flags()); | 242 Code::ExtractCacheHolderFromFlags(target()->flags()); |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 if (!lookup->IsFound()) return false; | 1229 if (!lookup->IsFound()) return false; |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false; | 1232 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false; |
| 1233 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value); | 1233 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value); |
| 1234 if (lookup->IsPropertyCallbacks()) return true; | 1234 if (lookup->IsPropertyCallbacks()) return true; |
| 1235 // JSGlobalProxy either stores on the global object in the prototype, or | 1235 // JSGlobalProxy either stores on the global object in the prototype, or |
| 1236 // goes into the runtime if access checks are needed, so this is always | 1236 // goes into the runtime if access checks are needed, so this is always |
| 1237 // safe. | 1237 // safe. |
| 1238 if (receiver->IsJSGlobalProxy()) { | 1238 if (receiver->IsJSGlobalProxy()) { |
| 1239 return lookup->holder() == receiver->GetPrototype(); | 1239 PrototypeIterator iter(lookup->isolate(), receiver); |
| 1240 return lookup->holder() == *PrototypeIterator::GetCurrent(iter); |
| 1240 } | 1241 } |
| 1241 // Currently normal holders in the prototype chain are not supported. They | 1242 // Currently normal holders in the prototype chain are not supported. They |
| 1242 // would require a runtime positive lookup and verification that the details | 1243 // would require a runtime positive lookup and verification that the details |
| 1243 // have not changed. | 1244 // have not changed. |
| 1244 if (lookup->IsInterceptor() || lookup->IsNormal()) return false; | 1245 if (lookup->IsInterceptor() || lookup->IsNormal()) return false; |
| 1245 holder = Handle<JSObject>(lookup->holder(), lookup->isolate()); | 1246 holder = Handle<JSObject>(lookup->holder(), lookup->isolate()); |
| 1246 } | 1247 } |
| 1247 | 1248 |
| 1248 // While normally LookupTransition gets passed the receiver, in this case we | 1249 // While normally LookupTransition gets passed the receiver, in this case we |
| 1249 // pass the holder of the property that we overwrite. This keeps the holder in | 1250 // pass the holder of the property that we overwrite. This keeps the holder in |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 } else { | 1450 } else { |
| 1450 switch (lookup->type()) { | 1451 switch (lookup->type()) { |
| 1451 case FIELD: | 1452 case FIELD: |
| 1452 return compiler.CompileStoreField(receiver, lookup, name); | 1453 return compiler.CompileStoreField(receiver, lookup, name); |
| 1453 case NORMAL: | 1454 case NORMAL: |
| 1454 if (kind() == Code::KEYED_STORE_IC) break; | 1455 if (kind() == Code::KEYED_STORE_IC) break; |
| 1455 if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) { | 1456 if (receiver->IsJSGlobalProxy() || receiver->IsGlobalObject()) { |
| 1456 // The stub generated for the global object picks the value directly | 1457 // The stub generated for the global object picks the value directly |
| 1457 // from the property cell. So the property must be directly on the | 1458 // from the property cell. So the property must be directly on the |
| 1458 // global object. | 1459 // global object. |
| 1459 Handle<GlobalObject> global = receiver->IsJSGlobalProxy() | 1460 PrototypeIterator iter(isolate(), receiver); |
| 1460 ? handle(GlobalObject::cast(receiver->GetPrototype())) | 1461 Handle<GlobalObject> global = |
| 1461 : Handle<GlobalObject>::cast(receiver); | 1462 receiver->IsJSGlobalProxy() |
| 1463 ? Handle<GlobalObject>::cast( |
| 1464 PrototypeIterator::GetCurrent(iter)) |
| 1465 : Handle<GlobalObject>::cast(receiver); |
| 1462 Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate()); | 1466 Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate()); |
| 1463 Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value); | 1467 Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value); |
| 1464 StoreGlobalStub stub( | 1468 StoreGlobalStub stub( |
| 1465 isolate(), union_type->IsConstant(), receiver->IsJSGlobalProxy()); | 1469 isolate(), union_type->IsConstant(), receiver->IsJSGlobalProxy()); |
| 1466 Handle<Code> code = stub.GetCodeCopyFromTemplate(global, cell); | 1470 Handle<Code> code = stub.GetCodeCopyFromTemplate(global, cell); |
| 1467 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. | 1471 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. |
| 1468 HeapObject::UpdateMapCodeCache(receiver, name, code); | 1472 HeapObject::UpdateMapCodeCache(receiver, name, code); |
| 1469 return code; | 1473 return code; |
| 1470 } | 1474 } |
| 1471 ASSERT(holder.is_identical_to(receiver)); | 1475 ASSERT(holder.is_identical_to(receiver)); |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3093 #undef ADDR | 3097 #undef ADDR |
| 3094 }; | 3098 }; |
| 3095 | 3099 |
| 3096 | 3100 |
| 3097 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3101 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3098 return IC_utilities[id]; | 3102 return IC_utilities[id]; |
| 3099 } | 3103 } |
| 3100 | 3104 |
| 3101 | 3105 |
| 3102 } } // namespace v8::internal | 3106 } } // namespace v8::internal |
| OLD | NEW |