| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 TEST(VectorLoadICSlotSharing) { | 304 TEST(VectorLoadICSlotSharing) { |
| 305 if (i::FLAG_always_opt) return; | 305 if (i::FLAG_always_opt) return; |
| 306 CcTest::InitializeVM(); | 306 CcTest::InitializeVM(); |
| 307 LocalContext context; | 307 LocalContext context; |
| 308 v8::HandleScope scope(context->GetIsolate()); | 308 v8::HandleScope scope(context->GetIsolate()); |
| 309 Isolate* isolate = CcTest::i_isolate(); | 309 Isolate* isolate = CcTest::i_isolate(); |
| 310 | 310 |
| 311 // Function f has 3 LoadICs, one for each o, but the ICs share the same | 311 // Function f has 3 LoadICs, one for each o, but the ICs share the same |
| 312 // feedback vector IC slot. | 312 // feedback vector IC slot. |
| 313 CompileRun( | 313 CompileRun( |
| 314 "var o = 10;" | 314 "o = 10;" |
| 315 "function f() {" | 315 "function f() {" |
| 316 " var x = o + 10;" | 316 " var x = o + 10;" |
| 317 " return o + x + o;" | 317 " return o + x + o;" |
| 318 "}" | 318 "}" |
| 319 "f();"); | 319 "f();"); |
| 320 Handle<JSFunction> f = v8::Utils::OpenHandle( | 320 Handle<JSFunction> f = v8::Utils::OpenHandle( |
| 321 *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))); | 321 *v8::Handle<v8::Function>::Cast(CcTest::global()->Get(v8_str("f")))); |
| 322 // There should be one IC slot. | 322 // There should be one IC slot. |
| 323 Handle<TypeFeedbackVector> feedback_vector = | 323 Handle<TypeFeedbackVector> feedback_vector = |
| 324 Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); | 324 Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 CHECK(number_map_found && o_map_found); | 379 CHECK(number_map_found && o_map_found); |
| 380 | 380 |
| 381 // The degree of polymorphism doesn't change. | 381 // The degree of polymorphism doesn't change. |
| 382 CompileRun("f(100)"); | 382 CompileRun("f(100)"); |
| 383 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); | 383 CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback()); |
| 384 MapHandleList maps2; | 384 MapHandleList maps2; |
| 385 nexus.FindAllMaps(&maps2); | 385 nexus.FindAllMaps(&maps2); |
| 386 CHECK_EQ(2, maps2.length()); | 386 CHECK_EQ(2, maps2.length()); |
| 387 } | 387 } |
| 388 } | 388 } |
| OLD | NEW |