OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3171 matching lines...) Loading... |
3182 CcTest::global()->Set(v8_str("fun2"), fun2); | 3182 CcTest::global()->Set(v8_str("fun2"), fun2); |
3183 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); | 3183 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); |
3184 | 3184 |
3185 Handle<JSFunction> f = | 3185 Handle<JSFunction> f = |
3186 v8::Utils::OpenHandle( | 3186 v8::Utils::OpenHandle( |
3187 *v8::Handle<v8::Function>::Cast( | 3187 *v8::Handle<v8::Function>::Cast( |
3188 CcTest::global()->Get(v8_str("f")))); | 3188 CcTest::global()->Get(v8_str("f")))); |
3189 | 3189 |
3190 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); | 3190 Handle<TypeFeedbackVector> feedback_vector(f->shared()->feedback_vector()); |
3191 | 3191 |
3192 int expected_length = FLAG_vector_ics ? 4 : 2; | 3192 int expected_slots = 2; |
3193 CHECK_EQ(expected_length, feedback_vector->length()); | 3193 CHECK_EQ(expected_slots, feedback_vector->ICSlots()); |
3194 for (int i = 0; i < expected_length; i++) { | 3194 for (int i = 0; i < expected_slots; i++) { |
3195 if ((i % 2) == 1) { | 3195 CHECK(feedback_vector->Get(FeedbackVectorICSlot(i))->IsJSFunction()); |
3196 CHECK(feedback_vector->get(i)->IsJSFunction()); | |
3197 } | |
3198 } | 3196 } |
3199 | 3197 |
3200 SimulateIncrementalMarking(CcTest::heap()); | 3198 SimulateIncrementalMarking(CcTest::heap()); |
3201 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); | 3199 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); |
3202 | 3200 |
3203 CHECK_EQ(expected_length, feedback_vector->length()); | 3201 CHECK_EQ(expected_slots, feedback_vector->ICSlots()); |
3204 for (int i = 0; i < expected_length; i++) { | 3202 for (int i = 0; i < expected_slots; i++) { |
3205 CHECK_EQ(feedback_vector->get(i), | 3203 CHECK_EQ(feedback_vector->Get(FeedbackVectorICSlot(i)), |
3206 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate())); | 3204 *TypeFeedbackVector::UninitializedSentinel(CcTest::i_isolate())); |
3207 } | 3205 } |
3208 } | 3206 } |
3209 | 3207 |
3210 | 3208 |
3211 static Code* FindFirstIC(Code* code, Code::Kind kind) { | 3209 static Code* FindFirstIC(Code* code, Code::Kind kind) { |
3212 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | | 3210 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
3213 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | | 3211 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | |
3214 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); | 3212 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); |
3215 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 3213 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
(...skipping 1397 matching lines...) Loading... |
4613 #ifdef DEBUG | 4611 #ifdef DEBUG |
4614 TEST(PathTracer) { | 4612 TEST(PathTracer) { |
4615 CcTest::InitializeVM(); | 4613 CcTest::InitializeVM(); |
4616 v8::HandleScope scope(CcTest::isolate()); | 4614 v8::HandleScope scope(CcTest::isolate()); |
4617 | 4615 |
4618 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4616 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4619 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4617 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4620 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4618 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4621 } | 4619 } |
4622 #endif // DEBUG | 4620 #endif // DEBUG |
OLD | NEW |