| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/code-stubs.h" | |
| 8 #include "src/ic/ic.h" | 7 #include "src/ic/ic.h" |
| 9 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
| 10 #include "src/objects.h" | 9 #include "src/objects.h" |
| 11 #include "src/type-feedback-vector-inl.h" | 10 #include "src/type-feedback-vector-inl.h" |
| 12 | 11 |
| 13 namespace v8 { | 12 namespace v8 { |
| 14 namespace internal { | 13 namespace internal { |
| 15 | 14 |
| 16 // static | 15 // static |
| 17 TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind( | 16 TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind( |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 305 } |
| 307 | 306 |
| 308 return UNINITIALIZED; | 307 return UNINITIALIZED; |
| 309 } | 308 } |
| 310 | 309 |
| 311 | 310 |
| 312 InlineCacheState CallICNexus::StateFromFeedback() const { | 311 InlineCacheState CallICNexus::StateFromFeedback() const { |
| 313 Isolate* isolate = GetIsolate(); | 312 Isolate* isolate = GetIsolate(); |
| 314 Object* feedback = GetFeedback(); | 313 Object* feedback = GetFeedback(); |
| 315 DCHECK(!FLAG_vector_ics || | 314 DCHECK(!FLAG_vector_ics || |
| 316 GetFeedbackExtra() == *vector()->UninitializedSentinel(isolate) || | 315 GetFeedbackExtra() == *vector()->UninitializedSentinel(isolate)); |
| 317 GetFeedbackExtra() == | |
| 318 Smi::FromInt(CallICStub::kHasReturnedMinusZeroSentinel)); | |
| 319 | 316 |
| 320 if (feedback == *vector()->MegamorphicSentinel(isolate)) { | 317 if (feedback == *vector()->MegamorphicSentinel(isolate)) { |
| 321 return GENERIC; | 318 return GENERIC; |
| 322 } else if (feedback->IsAllocationSite() || feedback->IsWeakCell()) { | 319 } else if (feedback->IsAllocationSite() || feedback->IsWeakCell()) { |
| 323 return MONOMORPHIC; | 320 return MONOMORPHIC; |
| 324 } | 321 } |
| 325 | 322 |
| 326 CHECK(feedback == *vector()->UninitializedSentinel(isolate)); | 323 CHECK(feedback == *vector()->UninitializedSentinel(isolate)); |
| 327 return UNINITIALIZED; | 324 return UNINITIALIZED; |
| 328 } | 325 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 339 void CallICNexus::ConfigureMonomorphicArray() { | 336 void CallICNexus::ConfigureMonomorphicArray() { |
| 340 Object* feedback = GetFeedback(); | 337 Object* feedback = GetFeedback(); |
| 341 if (!feedback->IsAllocationSite()) { | 338 if (!feedback->IsAllocationSite()) { |
| 342 Handle<AllocationSite> new_site = | 339 Handle<AllocationSite> new_site = |
| 343 GetIsolate()->factory()->NewAllocationSite(); | 340 GetIsolate()->factory()->NewAllocationSite(); |
| 344 SetFeedback(*new_site); | 341 SetFeedback(*new_site); |
| 345 } | 342 } |
| 346 } | 343 } |
| 347 | 344 |
| 348 | 345 |
| 349 void CallICNexus::ConfigureMonomorphicMathFunction( | |
| 350 Handle<JSFunction> function) { | |
| 351 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); | |
| 352 SetFeedback(*new_cell); | |
| 353 SetFeedbackExtra(*vector()->UninitializedSentinel(GetIsolate())); | |
| 354 } | |
| 355 | |
| 356 | |
| 357 void CallICNexus::ConfigureUninitialized() { | 346 void CallICNexus::ConfigureUninitialized() { |
| 358 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), | 347 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), |
| 359 SKIP_WRITE_BARRIER); | 348 SKIP_WRITE_BARRIER); |
| 360 } | 349 } |
| 361 | 350 |
| 362 | 351 |
| 363 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { | 352 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { |
| 364 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); | 353 Handle<WeakCell> new_cell = GetIsolate()->factory()->NewWeakCell(function); |
| 365 SetFeedback(*new_cell); | 354 SetFeedback(*new_cell); |
| 366 } | 355 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 554 |
| 566 Name* KeyedLoadICNexus::FindFirstName() const { | 555 Name* KeyedLoadICNexus::FindFirstName() const { |
| 567 Object* feedback = GetFeedback(); | 556 Object* feedback = GetFeedback(); |
| 568 if (feedback->IsString()) { | 557 if (feedback->IsString()) { |
| 569 return Name::cast(feedback); | 558 return Name::cast(feedback); |
| 570 } | 559 } |
| 571 return NULL; | 560 return NULL; |
| 572 } | 561 } |
| 573 } | 562 } |
| 574 } // namespace v8::internal | 563 } // namespace v8::internal |
| OLD | NEW |