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