| 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 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
| 7 | 7 |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/debug.h" | 9 #include "src/debug.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 int index = vector->GetIndex(FeedbackVectorSlot(0)); | 65 int index = vector->GetIndex(FeedbackVectorSlot(0)); |
| 66 | 66 |
| 67 CHECK_EQ(TypeFeedbackVector::kReservedIndexCount + metadata_length, index); | 67 CHECK_EQ(TypeFeedbackVector::kReservedIndexCount + metadata_length, index); |
| 68 CHECK(FeedbackVectorSlot(0) == vector->ToSlot(index)); | 68 CHECK(FeedbackVectorSlot(0) == vector->ToSlot(index)); |
| 69 | 69 |
| 70 index = vector->GetIndex(FeedbackVectorICSlot(0)); | 70 index = vector->GetIndex(FeedbackVectorICSlot(0)); |
| 71 CHECK_EQ(index, | 71 CHECK_EQ(index, |
| 72 TypeFeedbackVector::kReservedIndexCount + metadata_length + 3); | 72 TypeFeedbackVector::kReservedIndexCount + metadata_length + 3); |
| 73 CHECK(FeedbackVectorICSlot(0) == vector->ToICSlot(index)); | 73 CHECK(FeedbackVectorICSlot(0) == vector->ToICSlot(index)); |
| 74 | 74 CHECK_EQ(TypeFeedbackVector::kReservedIndexCount + metadata_length + 3 + |
| 75 CHECK_EQ(TypeFeedbackVector::kReservedIndexCount + metadata_length + 3 + 5, | 75 5 * TypeFeedbackVector::elements_per_ic_slot(), |
| 76 vector->length()); | 76 vector->length()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 // IC slots need an encoding to recognize what is in there. | 80 // IC slots need an encoding to recognize what is in there. |
| 81 TEST(VectorICMetadata) { | 81 TEST(VectorICMetadata) { |
| 82 LocalContext context; | 82 LocalContext context; |
| 83 v8::HandleScope scope(context->GetIsolate()); | 83 v8::HandleScope scope(context->GetIsolate()); |
| 84 if (!FLAG_vector_ics) { | 84 if (!FLAG_vector_ics) { |
| 85 // If FLAG_vector_ics is false, we only store CALL_ICs in the vector, so | 85 // If FLAG_vector_ics is false, we only store CALL_ICs in the vector, so |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 CHECK(number_map_found && o_map_found); | 385 CHECK(number_map_found && o_map_found); |
| 386 | 386 |
| 387 // The degree of polymorphism doesn't change. | 387 // The degree of polymorphism doesn't change. |
| 388 CompileRun("f(100)"); | 388 CompileRun("f(100)"); |
| 389 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); | 389 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); |
| 390 MapHandleList maps2; | 390 MapHandleList maps2; |
| 391 nexus.FindAllMaps(&maps2); | 391 nexus.FindAllMaps(&maps2); |
| 392 CHECK_EQ(2, maps2.length()); | 392 CHECK_EQ(2, maps2.length()); |
| 393 } | 393 } |
| 394 } | 394 } |
| OLD | NEW |