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 "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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // be able to IC it anyway and regular lookup should work fine. | 200 // be able to IC it anyway and regular lookup should work fine. |
201 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) { | 201 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) { |
202 return; | 202 return; |
203 } | 203 } |
204 | 204 |
205 Handle<JSObject> holder(lookup->holder(), lookup->isolate()); | 205 Handle<JSObject> holder(lookup->holder(), lookup->isolate()); |
206 if (HasInterceptorGetter(*holder)) { | 206 if (HasInterceptorGetter(*holder)) { |
207 return; | 207 return; |
208 } | 208 } |
209 | 209 |
210 holder->LocalLookupRealNamedProperty(name, lookup); | 210 holder->LookupOwnRealNamedProperty(name, lookup); |
211 if (lookup->IsFound()) { | 211 if (lookup->IsFound()) { |
212 ASSERT(!lookup->IsInterceptor()); | 212 ASSERT(!lookup->IsInterceptor()); |
213 return; | 213 return; |
214 } | 214 } |
215 | 215 |
216 Handle<Object> proto(holder->GetPrototype(), lookup->isolate()); | 216 Handle<Object> proto(holder->GetPrototype(), lookup->isolate()); |
217 if (proto->IsNull()) { | 217 if (proto->IsNull()) { |
218 ASSERT(!lookup->IsFound()); | 218 ASSERT(!lookup->IsFound()); |
219 return; | 219 return; |
220 } | 220 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (IsMoreGeneralElementsKindTransition(old_map->elements_kind(), | 278 if (IsMoreGeneralElementsKindTransition(old_map->elements_kind(), |
279 map->elements_kind())) { | 279 map->elements_kind())) { |
280 return true; | 280 return true; |
281 } | 281 } |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 if (receiver->IsGlobalObject()) { | 285 if (receiver->IsGlobalObject()) { |
286 LookupResult lookup(isolate()); | 286 LookupResult lookup(isolate()); |
287 GlobalObject* global = GlobalObject::cast(*receiver); | 287 GlobalObject* global = GlobalObject::cast(*receiver); |
288 global->LocalLookupRealNamedProperty(name, &lookup); | 288 global->LookupOwnRealNamedProperty(name, &lookup); |
289 if (!lookup.IsFound()) return false; | 289 if (!lookup.IsFound()) return false; |
290 PropertyCell* cell = global->GetPropertyCell(&lookup); | 290 PropertyCell* cell = global->GetPropertyCell(&lookup); |
291 return cell->type()->IsConstant(); | 291 return cell->type()->IsConstant(); |
292 } | 292 } |
293 | 293 |
294 return false; | 294 return false; |
295 } | 295 } |
296 | 296 |
297 | 297 |
298 void IC::TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name) { | 298 void IC::TryRemoveInvalidHandlers(Handle<Map> map, Handle<String> name) { |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1179 |
1180 static bool LookupForWrite(Handle<JSObject> receiver, | 1180 static bool LookupForWrite(Handle<JSObject> receiver, |
1181 Handle<String> name, | 1181 Handle<String> name, |
1182 Handle<Object> value, | 1182 Handle<Object> value, |
1183 LookupResult* lookup, | 1183 LookupResult* lookup, |
1184 IC* ic) { | 1184 IC* ic) { |
1185 Handle<JSObject> holder = receiver; | 1185 Handle<JSObject> holder = receiver; |
1186 receiver->Lookup(name, lookup); | 1186 receiver->Lookup(name, lookup); |
1187 if (lookup->IsFound()) { | 1187 if (lookup->IsFound()) { |
1188 if (lookup->IsInterceptor() && !HasInterceptorSetter(lookup->holder())) { | 1188 if (lookup->IsInterceptor() && !HasInterceptorSetter(lookup->holder())) { |
1189 receiver->LocalLookupRealNamedProperty(name, lookup); | 1189 receiver->LookupOwnRealNamedProperty(name, lookup); |
1190 if (!lookup->IsFound()) return false; | 1190 if (!lookup->IsFound()) return false; |
1191 } | 1191 } |
1192 | 1192 |
1193 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false; | 1193 if (lookup->IsReadOnly() || !lookup->IsCacheable()) return false; |
1194 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value); | 1194 if (lookup->holder() == *receiver) return lookup->CanHoldValue(value); |
1195 if (lookup->IsPropertyCallbacks()) return true; | 1195 if (lookup->IsPropertyCallbacks()) return true; |
1196 // JSGlobalProxy either stores on the global object in the prototype, or | 1196 // JSGlobalProxy either stores on the global object in the prototype, or |
1197 // goes into the runtime if access checks are needed, so this is always | 1197 // goes into the runtime if access checks are needed, so this is always |
1198 // safe. | 1198 // safe. |
1199 if (receiver->IsJSGlobalProxy()) { | 1199 if (receiver->IsJSGlobalProxy()) { |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 ASSERT(args.length() == 2); | 1957 ASSERT(args.length() == 2); |
1958 Handle<JSArray> receiver = args.at<JSArray>(0); | 1958 Handle<JSArray> receiver = args.at<JSArray>(0); |
1959 Handle<Object> len = args.at<Object>(1); | 1959 Handle<Object> len = args.at<Object>(1); |
1960 | 1960 |
1961 // The generated code should filter out non-Smis before we get here. | 1961 // The generated code should filter out non-Smis before we get here. |
1962 ASSERT(len->IsSmi()); | 1962 ASSERT(len->IsSmi()); |
1963 | 1963 |
1964 #ifdef DEBUG | 1964 #ifdef DEBUG |
1965 // The length property has to be a writable callback property. | 1965 // The length property has to be a writable callback property. |
1966 LookupResult debug_lookup(isolate); | 1966 LookupResult debug_lookup(isolate); |
1967 receiver->LocalLookup(isolate->factory()->length_string(), &debug_lookup); | 1967 receiver->LookupOwn(isolate->factory()->length_string(), &debug_lookup); |
1968 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); | 1968 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); |
1969 #endif | 1969 #endif |
1970 | 1970 |
1971 RETURN_FAILURE_ON_EXCEPTION( | 1971 RETURN_FAILURE_ON_EXCEPTION( |
1972 isolate, JSArray::SetElementsLength(receiver, len)); | 1972 isolate, JSArray::SetElementsLength(receiver, len)); |
1973 return *len; | 1973 return *len; |
1974 } | 1974 } |
1975 | 1975 |
1976 | 1976 |
1977 // Extend storage is called in a store inline cache when | 1977 // Extend storage is called in a store inline cache when |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 #undef ADDR | 2985 #undef ADDR |
2986 }; | 2986 }; |
2987 | 2987 |
2988 | 2988 |
2989 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2989 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2990 return IC_utilities[id]; | 2990 return IC_utilities[id]; |
2991 } | 2991 } |
2992 | 2992 |
2993 | 2993 |
2994 } } // namespace v8::internal | 2994 } } // namespace v8::internal |
OLD | NEW |