| 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 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3116 CcTest::global()->Set(v8_str("fun2"), fun2); | 3116 CcTest::global()->Set(v8_str("fun2"), fun2); |
| 3117 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); | 3117 CompileRun("function f(a, b) { a(); b(); } f(fun1, fun2);"); |
| 3118 | 3118 |
| 3119 Handle<JSFunction> f = | 3119 Handle<JSFunction> f = |
| 3120 v8::Utils::OpenHandle( | 3120 v8::Utils::OpenHandle( |
| 3121 *v8::Handle<v8::Function>::Cast( | 3121 *v8::Handle<v8::Function>::Cast( |
| 3122 CcTest::global()->Get(v8_str("f")))); | 3122 CcTest::global()->Get(v8_str("f")))); |
| 3123 | 3123 |
| 3124 Handle<FixedArray> feedback_vector(f->shared()->feedback_vector()); | 3124 Handle<FixedArray> feedback_vector(f->shared()->feedback_vector()); |
| 3125 | 3125 |
| 3126 CHECK_EQ(2, feedback_vector->length()); | 3126 int expected_length = FLAG_vector_ics ? 4 : 2; |
| 3127 CHECK(feedback_vector->get(0)->IsJSFunction()); | 3127 CHECK_EQ(expected_length, feedback_vector->length()); |
| 3128 CHECK(feedback_vector->get(1)->IsJSFunction()); | 3128 for (int i = 0; i < expected_length; i++) { |
| 3129 if ((i % 2) == 1) { |
| 3130 CHECK(feedback_vector->get(i)->IsJSFunction()); |
| 3131 } |
| 3132 } |
| 3129 | 3133 |
| 3130 SimulateIncrementalMarking(); | 3134 SimulateIncrementalMarking(); |
| 3131 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); | 3135 CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags); |
| 3132 | 3136 |
| 3133 CHECK_EQ(2, feedback_vector->length()); | 3137 CHECK_EQ(expected_length, feedback_vector->length()); |
| 3134 CHECK_EQ(feedback_vector->get(0), | 3138 for (int i = 0; i < expected_length; i++) { |
| 3135 *TypeFeedbackInfo::UninitializedSentinel(CcTest::i_isolate())); | 3139 CHECK_EQ(feedback_vector->get(i), |
| 3136 CHECK_EQ(feedback_vector->get(1), | 3140 *TypeFeedbackInfo::UninitializedSentinel(CcTest::i_isolate())); |
| 3137 *TypeFeedbackInfo::UninitializedSentinel(CcTest::i_isolate())); | 3141 } |
| 3138 } | 3142 } |
| 3139 | 3143 |
| 3140 | 3144 |
| 3141 static Code* FindFirstIC(Code* code, Code::Kind kind) { | 3145 static Code* FindFirstIC(Code* code, Code::Kind kind) { |
| 3142 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | | 3146 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
| 3143 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | | 3147 RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | |
| 3144 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); | 3148 RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); |
| 3145 for (RelocIterator it(code, mask); !it.done(); it.next()) { | 3149 for (RelocIterator it(code, mask); !it.done(); it.next()) { |
| 3146 RelocInfo* info = it.rinfo(); | 3150 RelocInfo* info = it.rinfo(); |
| 3147 Code* target = Code::GetCodeFromTargetAddress(info->target_address()); | 3151 Code* target = Code::GetCodeFromTargetAddress(info->target_address()); |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4404 #ifdef DEBUG | 4408 #ifdef DEBUG |
| 4405 TEST(PathTracer) { | 4409 TEST(PathTracer) { |
| 4406 CcTest::InitializeVM(); | 4410 CcTest::InitializeVM(); |
| 4407 v8::HandleScope scope(CcTest::isolate()); | 4411 v8::HandleScope scope(CcTest::isolate()); |
| 4408 | 4412 |
| 4409 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4413 v8::Local<v8::Value> result = CompileRun("'abc'"); |
| 4410 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4414 Handle<Object> o = v8::Utils::OpenHandle(*result); |
| 4411 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4415 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
| 4412 } | 4416 } |
| 4413 #endif // DEBUG | 4417 #endif // DEBUG |
| OLD | NEW |