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/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 return; | 270 return; |
271 case LookupIterator::ACCESSOR: | 271 case LookupIterator::ACCESSOR: |
272 case LookupIterator::INTEGER_INDEXED_EXOTIC: | 272 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
273 case LookupIterator::DATA: | 273 case LookupIterator::DATA: |
274 return; | 274 return; |
275 } | 275 } |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 bool IC::ShouldRecomputeHandler(Handle<Object> receiver, Handle<String> name) { | 279 bool IC::ShouldRecomputeHandler(Handle<String> name) { |
280 if (!RecomputeHandlerForName(name)) return false; | 280 if (!RecomputeHandlerForName(name)) return false; |
281 | 281 |
282 DCHECK(UseVector()); | 282 DCHECK(UseVector()); |
283 maybe_handler_ = nexus()->FindHandlerForMap(receiver_map()); | 283 maybe_handler_ = nexus()->FindHandlerForMap(receiver_map()); |
284 | 284 |
285 // This is a contextual access, always just update the handler and stay | 285 // This is a contextual access, always just update the handler and stay |
286 // monomorphic. | 286 // monomorphic. |
287 if (kind() == Code::LOAD_GLOBAL_IC) return true; | 287 if (kind() == Code::LOAD_GLOBAL_IC) return true; |
288 | 288 |
289 // The current map wasn't handled yet. There's no reason to stay monomorphic, | 289 // The current map wasn't handled yet. There's no reason to stay monomorphic, |
(...skipping 29 matching lines...) Expand all Loading... |
319 | 319 |
320 void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { | 320 void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { |
321 update_receiver_map(receiver); | 321 update_receiver_map(receiver); |
322 if (!name->IsString()) return; | 322 if (!name->IsString()) return; |
323 if (state() != MONOMORPHIC && state() != POLYMORPHIC) return; | 323 if (state() != MONOMORPHIC && state() != POLYMORPHIC) return; |
324 if (receiver->IsUndefined(isolate()) || receiver->IsNull(isolate())) return; | 324 if (receiver->IsUndefined(isolate()) || receiver->IsNull(isolate())) return; |
325 | 325 |
326 // Remove the target from the code cache if it became invalid | 326 // Remove the target from the code cache if it became invalid |
327 // because of changes in the prototype chain to avoid hitting it | 327 // because of changes in the prototype chain to avoid hitting it |
328 // again. | 328 // again. |
329 if (ShouldRecomputeHandler(receiver, Handle<String>::cast(name))) { | 329 if (ShouldRecomputeHandler(Handle<String>::cast(name))) { |
330 MarkRecomputeHandler(name); | 330 MarkRecomputeHandler(name); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 MaybeHandle<Object> IC::TypeError(MessageTemplate::Template index, | 335 MaybeHandle<Object> IC::TypeError(MessageTemplate::Template index, |
336 Handle<Object> object, Handle<Object> key) { | 336 Handle<Object> object, Handle<Object> key) { |
337 HandleScope scope(isolate()); | 337 HandleScope scope(isolate()); |
338 THROW_NEW_ERROR(isolate(), NewTypeError(index, key, object), Object); | 338 THROW_NEW_ERROR(isolate(), NewTypeError(index, key, object), Object); |
339 } | 339 } |
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2914 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 2914 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
2915 it.Next(); | 2915 it.Next(); |
2916 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2916 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2917 Object::GetProperty(&it)); | 2917 Object::GetProperty(&it)); |
2918 } | 2918 } |
2919 | 2919 |
2920 return *result; | 2920 return *result; |
2921 } | 2921 } |
2922 } // namespace internal | 2922 } // namespace internal |
2923 } // namespace v8 | 2923 } // namespace v8 |
OLD | NEW |