| OLD | NEW |
| 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 Handle<String> name, | 1315 Handle<String> name, |
| 1316 LookupResult* lookup) { | 1316 LookupResult* lookup) { |
| 1317 receiver->LocalLookup(*name, lookup); | 1317 receiver->LocalLookup(*name, lookup); |
| 1318 if (!StoreICableLookup(lookup)) { | 1318 if (!StoreICableLookup(lookup)) { |
| 1319 // 2nd chance: There can be accessors somewhere in the prototype chain, but | 1319 // 2nd chance: There can be accessors somewhere in the prototype chain, but |
| 1320 // for compatibility reasons we have to hide this behind a flag. Note that | 1320 // for compatibility reasons we have to hide this behind a flag. Note that |
| 1321 // we explicitly exclude native accessors for now, because the stubs are not | 1321 // we explicitly exclude native accessors for now, because the stubs are not |
| 1322 // yet prepared for this scenario. | 1322 // yet prepared for this scenario. |
| 1323 if (!FLAG_es5_readonly) return false; | 1323 if (!FLAG_es5_readonly) return false; |
| 1324 receiver->Lookup(*name, lookup); | 1324 receiver->Lookup(*name, lookup); |
| 1325 if (!lookup->IsCallbacks()) return false; | 1325 if (!lookup->IsPropertyCallbacks()) return false; |
| 1326 Handle<Object> callback(lookup->GetCallbackObject()); | 1326 Handle<Object> callback(lookup->GetCallbackObject()); |
| 1327 return callback->IsAccessorPair() && StoreICableLookup(lookup); | 1327 return callback->IsAccessorPair() && StoreICableLookup(lookup); |
| 1328 } | 1328 } |
| 1329 | 1329 |
| 1330 if (lookup->IsInterceptor() && | 1330 if (lookup->IsInterceptor() && |
| 1331 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { | 1331 receiver->GetNamedInterceptor()->setter()->IsUndefined()) { |
| 1332 receiver->LocalLookupRealNamedProperty(*name, lookup); | 1332 receiver->LocalLookupRealNamedProperty(*name, lookup); |
| 1333 return StoreICableLookup(lookup); | 1333 return StoreICableLookup(lookup); |
| 1334 } | 1334 } |
| 1335 | 1335 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 break; | 1505 break; |
| 1506 } | 1506 } |
| 1507 case INTERCEPTOR: | 1507 case INTERCEPTOR: |
| 1508 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); | 1508 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); |
| 1509 code = isolate()->stub_cache()->ComputeStoreInterceptor( | 1509 code = isolate()->stub_cache()->ComputeStoreInterceptor( |
| 1510 name, receiver, strict_mode); | 1510 name, receiver, strict_mode); |
| 1511 break; | 1511 break; |
| 1512 case CONSTANT_FUNCTION: | 1512 case CONSTANT_FUNCTION: |
| 1513 return; | 1513 return; |
| 1514 case TRANSITION: { | 1514 case TRANSITION: { |
| 1515 Object* value = lookup->GetTransitionValue(); | 1515 Map* value = lookup->GetTransitionTarget(); |
| 1516 // Callbacks. | |
| 1517 if (value->IsAccessorPair()) return; | |
| 1518 | |
| 1519 Handle<Map> transition(Map::cast(value)); | 1516 Handle<Map> transition(Map::cast(value)); |
| 1520 DescriptorArray* target_descriptors = transition->instance_descriptors(); | 1517 DescriptorArray* target_descriptors = transition->instance_descriptors(); |
| 1521 int descriptor = target_descriptors->LastAdded(); | 1518 int descriptor = target_descriptors->LastAdded(); |
| 1522 PropertyDetails details = target_descriptors->GetDetails(descriptor); | 1519 PropertyDetails details = target_descriptors->GetDetails(descriptor); |
| 1523 | 1520 |
| 1524 if (details.type() != FIELD || details.attributes() != NONE) return; | 1521 if (details.type() != FIELD || details.attributes() != NONE) return; |
| 1525 | 1522 |
| 1526 int field_index = target_descriptors->GetFieldIndex(descriptor); | 1523 int field_index = target_descriptors->GetFieldIndex(descriptor); |
| 1527 code = isolate()->stub_cache()->ComputeStoreField( | 1524 code = isolate()->stub_cache()->ComputeStoreField( |
| 1528 name, receiver, field_index, transition, strict_mode); | 1525 name, receiver, field_index, transition, strict_mode); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 // stub cache. | 1968 // stub cache. |
| 1972 Handle<Code> code; | 1969 Handle<Code> code; |
| 1973 | 1970 |
| 1974 switch (type) { | 1971 switch (type) { |
| 1975 case FIELD: | 1972 case FIELD: |
| 1976 code = isolate()->stub_cache()->ComputeKeyedStoreField( | 1973 code = isolate()->stub_cache()->ComputeKeyedStoreField( |
| 1977 name, receiver, lookup->GetFieldIndex(), | 1974 name, receiver, lookup->GetFieldIndex(), |
| 1978 Handle<Map>::null(), strict_mode); | 1975 Handle<Map>::null(), strict_mode); |
| 1979 break; | 1976 break; |
| 1980 case TRANSITION: { | 1977 case TRANSITION: { |
| 1981 Object* value = lookup->GetTransitionValue(); | 1978 Handle<Map> transition(lookup->GetTransitionTarget()); |
| 1982 // Callbacks transition. | |
| 1983 if (value->IsAccessorPair()) { | |
| 1984 code = (strict_mode == kStrictMode) | |
| 1985 ? generic_stub_strict() | |
| 1986 : generic_stub(); | |
| 1987 break; | |
| 1988 } | |
| 1989 | 1979 |
| 1990 Handle<Map> transition(Map::cast(value)); | |
| 1991 DescriptorArray* target_descriptors = transition->instance_descriptors(); | 1980 DescriptorArray* target_descriptors = transition->instance_descriptors(); |
| 1992 int descriptor = target_descriptors->LastAdded(); | 1981 int descriptor = target_descriptors->LastAdded(); |
| 1993 PropertyDetails details = target_descriptors->GetDetails(descriptor); | 1982 PropertyDetails details = target_descriptors->GetDetails(descriptor); |
| 1994 | 1983 |
| 1995 if (details.type() == FIELD && details.attributes() == NONE) { | 1984 if (details.type() == FIELD && details.attributes() == NONE) { |
| 1996 int field_index = target_descriptors->GetFieldIndex(descriptor); | 1985 int field_index = target_descriptors->GetFieldIndex(descriptor); |
| 1997 code = isolate()->stub_cache()->ComputeKeyedStoreField( | 1986 code = isolate()->stub_cache()->ComputeKeyedStoreField( |
| 1998 name, receiver, field_index, transition, strict_mode); | 1987 name, receiver, field_index, transition, strict_mode); |
| 1999 break; | 1988 break; |
| 2000 } | 1989 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 JSArray* receiver = JSArray::cast(args[0]); | 2128 JSArray* receiver = JSArray::cast(args[0]); |
| 2140 Object* len = args[1]; | 2129 Object* len = args[1]; |
| 2141 | 2130 |
| 2142 // The generated code should filter out non-Smis before we get here. | 2131 // The generated code should filter out non-Smis before we get here. |
| 2143 ASSERT(len->IsSmi()); | 2132 ASSERT(len->IsSmi()); |
| 2144 | 2133 |
| 2145 #ifdef DEBUG | 2134 #ifdef DEBUG |
| 2146 // The length property has to be a writable callback property. | 2135 // The length property has to be a writable callback property. |
| 2147 LookupResult debug_lookup(isolate); | 2136 LookupResult debug_lookup(isolate); |
| 2148 receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup); | 2137 receiver->LocalLookup(isolate->heap()->length_symbol(), &debug_lookup); |
| 2149 ASSERT(debug_lookup.IsCallbacks() && !debug_lookup.IsReadOnly()); | 2138 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); |
| 2150 #endif | 2139 #endif |
| 2151 | 2140 |
| 2152 Object* result; | 2141 Object* result; |
| 2153 { MaybeObject* maybe_result = receiver->SetElementsLength(len); | 2142 { MaybeObject* maybe_result = receiver->SetElementsLength(len); |
| 2154 if (!maybe_result->ToObject(&result)) return maybe_result; | 2143 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2155 } | 2144 } |
| 2156 return len; | 2145 return len; |
| 2157 } | 2146 } |
| 2158 | 2147 |
| 2159 | 2148 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 #undef ADDR | 2692 #undef ADDR |
| 2704 }; | 2693 }; |
| 2705 | 2694 |
| 2706 | 2695 |
| 2707 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2696 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2708 return IC_utilities[id]; | 2697 return IC_utilities[id]; |
| 2709 } | 2698 } |
| 2710 | 2699 |
| 2711 | 2700 |
| 2712 } } // namespace v8::internal | 2701 } } // namespace v8::internal |
| OLD | NEW |