| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 Handle<Code> PropertyICCompiler::ComputeLoad(Isolate* isolate, | 295 Handle<Code> PropertyICCompiler::ComputeLoad(Isolate* isolate, |
| 296 InlineCacheState ic_state, | 296 InlineCacheState ic_state, |
| 297 ExtraICState extra_state) { | 297 ExtraICState extra_state) { |
| 298 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, ic_state, extra_state); | 298 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, ic_state, extra_state); |
| 299 Handle<UnseededNumberDictionary> cache = | 299 Handle<UnseededNumberDictionary> cache = |
| 300 isolate->factory()->non_monomorphic_cache(); | 300 isolate->factory()->non_monomorphic_cache(); |
| 301 int entry = cache->FindEntry(isolate, flags); | 301 int entry = cache->FindEntry(isolate, flags); |
| 302 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 302 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 303 | 303 |
| 304 PropertyICCompiler compiler(isolate, Code::LOAD_IC); | 304 PropertyICCompiler compiler(isolate, Code::LOAD_IC, extra_state); |
| 305 Handle<Code> code; | 305 Handle<Code> code; |
| 306 if (ic_state == UNINITIALIZED) { | 306 if (ic_state == UNINITIALIZED) { |
| 307 code = compiler.CompileLoadInitialize(flags); | 307 code = compiler.CompileLoadInitialize(flags); |
| 308 } else if (ic_state == PREMONOMORPHIC) { | 308 } else if (ic_state == PREMONOMORPHIC) { |
| 309 code = compiler.CompileLoadPreMonomorphic(flags); | 309 code = compiler.CompileLoadPreMonomorphic(flags); |
| 310 } else if (ic_state == MEGAMORPHIC) { | 310 } else if (ic_state == MEGAMORPHIC) { |
| 311 code = compiler.CompileLoadMegamorphic(flags); | 311 code = compiler.CompileLoadMegamorphic(flags); |
| 312 } else { | 312 } else { |
| 313 UNREACHABLE(); | 313 UNREACHABLE(); |
| 314 } | 314 } |
| 315 FillCache(isolate, code); | 315 FillCache(isolate, code); |
| 316 return code; | 316 return code; |
| 317 } | 317 } |
| 318 | 318 |
| 319 | 319 |
| 320 Handle<Code> PropertyICCompiler::ComputeKeyedLoad(Isolate* isolate, |
| 321 InlineCacheState ic_state, |
| 322 ExtraICState extra_state) { |
| 323 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, ic_state, extra_st
ate); |
| 324 Handle<UnseededNumberDictionary> cache = |
| 325 isolate->factory()->non_monomorphic_cache(); |
| 326 int entry = cache->FindEntry(isolate, flags); |
| 327 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 328 |
| 329 PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC, extra_state); |
| 330 Handle<Code> code; |
| 331 if (ic_state == UNINITIALIZED) { |
| 332 code = compiler.CompileKeyedLoadInitialize(flags); |
| 333 } else if (ic_state == PREMONOMORPHIC) { |
| 334 code = compiler.CompileKeyedLoadPreMonomorphic(flags); |
| 335 } else if (ic_state == GENERIC) { |
| 336 code = compiler.CompileKeyedLoadGeneric(flags); |
| 337 } else { |
| 338 UNREACHABLE(); |
| 339 } |
| 340 FillCache(isolate, code); |
| 341 return code; |
| 342 } |
| 343 |
| 344 |
| 320 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, | 345 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, |
| 321 InlineCacheState ic_state, | 346 InlineCacheState ic_state, |
| 322 ExtraICState extra_state) { | 347 ExtraICState extra_state) { |
| 323 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state); | 348 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state); |
| 324 Handle<UnseededNumberDictionary> cache = | 349 Handle<UnseededNumberDictionary> cache = |
| 325 isolate->factory()->non_monomorphic_cache(); | 350 isolate->factory()->non_monomorphic_cache(); |
| 326 int entry = cache->FindEntry(isolate, flags); | 351 int entry = cache->FindEntry(isolate, flags); |
| 327 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 352 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 328 | 353 |
| 329 PropertyICCompiler compiler(isolate, Code::STORE_IC); | 354 PropertyICCompiler compiler(isolate, Code::STORE_IC); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 | 683 |
| 659 | 684 |
| 660 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 685 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
| 661 LoadIC::GeneratePreMonomorphic(masm()); | 686 LoadIC::GeneratePreMonomorphic(masm()); |
| 662 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 687 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
| 663 PROFILE(isolate(), | 688 PROFILE(isolate(), |
| 664 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 689 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
| 665 return code; | 690 return code; |
| 666 } | 691 } |
| 667 | 692 |
| 668 | |
| 669 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { | 693 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { |
| 670 LoadIC::GenerateMegamorphic(masm()); | 694 LoadIC::GenerateMegamorphic(masm(), extra_ic_state_); |
| 671 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); | 695 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); |
| 672 PROFILE(isolate(), | 696 PROFILE(isolate(), |
| 673 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); | 697 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); |
| 674 return code; | 698 return code; |
| 675 } | 699 } |
| 676 | 700 |
| 677 | 701 |
| 702 Handle<Code> PropertyICCompiler::CompileKeyedLoadInitialize(Code::Flags flags) { |
| 703 KeyedLoadIC::GenerateInitialize(masm()); |
| 704 Handle<Code> code = GetCodeWithFlags(flags, "CompileKeyedLoadInitialize"); |
| 705 PROFILE(isolate(), |
| 706 CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0)); // todo |
| 707 return code; |
| 708 } |
| 709 |
| 710 |
| 711 Handle<Code> PropertyICCompiler::CompileKeyedLoadPreMonomorphic(Code::Flags flag
s) { |
| 712 KeyedLoadIC::GeneratePreMonomorphic(masm()); |
| 713 Handle<Code> code = GetCodeWithFlags(flags, "CompileKeyedLoadPreMonomorphic"); |
| 714 PROFILE(isolate(), |
| 715 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); // todo |
| 716 return code; |
| 717 } |
| 718 |
| 719 |
| 720 Handle<Code> PropertyICCompiler::CompileKeyedLoadGeneric(Code::Flags flags) { |
| 721 KeyedLoadIC::GenerateGeneric(masm(), extra_ic_state_); |
| 722 Handle<Code> code = GetCodeWithFlags(flags, "CompileKeyedGeneric"); |
| 723 PROFILE(isolate(), |
| 724 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); // todo |
| 725 return code; |
| 726 } |
| 727 |
| 728 |
| 678 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { | 729 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { |
| 679 StoreIC::GenerateInitialize(masm()); | 730 StoreIC::GenerateInitialize(masm()); |
| 680 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 731 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
| 681 PROFILE(isolate(), | 732 PROFILE(isolate(), |
| 682 CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 733 CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
| 683 return code; | 734 return code; |
| 684 } | 735 } |
| 685 | 736 |
| 686 | 737 |
| 687 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 738 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 Handle<FunctionTemplateInfo>( | 1335 Handle<FunctionTemplateInfo>( |
| 1285 FunctionTemplateInfo::cast(signature->receiver())); | 1336 FunctionTemplateInfo::cast(signature->receiver())); |
| 1286 } | 1337 } |
| 1287 } | 1338 } |
| 1288 | 1339 |
| 1289 is_simple_api_call_ = true; | 1340 is_simple_api_call_ = true; |
| 1290 } | 1341 } |
| 1291 | 1342 |
| 1292 | 1343 |
| 1293 } } // namespace v8::internal | 1344 } } // namespace v8::internal |
| OLD | NEW |