| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 Object* StubCache::ComputeCallMiss(int argc) { | 587 Object* StubCache::ComputeCallMiss(int argc) { |
| 588 Code::Flags flags = | 588 Code::Flags flags = |
| 589 Code::ComputeFlags(Code::STUB, MEGAMORPHIC, NORMAL, argc); | 589 Code::ComputeFlags(Code::STUB, MEGAMORPHIC, NORMAL, argc); |
| 590 Object* probe = ProbeCache(flags); | 590 Object* probe = ProbeCache(flags); |
| 591 if (!probe->IsUndefined()) return probe; | 591 if (!probe->IsUndefined()) return probe; |
| 592 StubCompiler compiler; | 592 StubCompiler compiler; |
| 593 return FillCache(compiler.CompileCallMiss(flags)); | 593 return FillCache(compiler.CompileCallMiss(flags)); |
| 594 } | 594 } |
| 595 | 595 |
| 596 | 596 |
| 597 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 597 Object* StubCache::ComputeCallDebugBreak(int argc) { | 598 Object* StubCache::ComputeCallDebugBreak(int argc) { |
| 598 Code::Flags flags = | 599 Code::Flags flags = |
| 599 Code::ComputeFlags(Code::CALL_IC, DEBUG_BREAK, NORMAL, argc); | 600 Code::ComputeFlags(Code::CALL_IC, DEBUG_BREAK, NORMAL, argc); |
| 600 Object* probe = ProbeCache(flags); | 601 Object* probe = ProbeCache(flags); |
| 601 if (!probe->IsUndefined()) return probe; | 602 if (!probe->IsUndefined()) return probe; |
| 602 StubCompiler compiler; | 603 StubCompiler compiler; |
| 603 return FillCache(compiler.CompileCallDebugBreak(flags)); | 604 return FillCache(compiler.CompileCallDebugBreak(flags)); |
| 604 } | 605 } |
| 605 | 606 |
| 606 | 607 |
| 607 Object* StubCache::ComputeCallDebugPrepareStepIn(int argc) { | 608 Object* StubCache::ComputeCallDebugPrepareStepIn(int argc) { |
| 608 Code::Flags flags = | 609 Code::Flags flags = |
| 609 Code::ComputeFlags(Code::CALL_IC, DEBUG_PREPARE_STEP_IN, NORMAL, argc); | 610 Code::ComputeFlags(Code::CALL_IC, DEBUG_PREPARE_STEP_IN, NORMAL, argc); |
| 610 Object* probe = ProbeCache(flags); | 611 Object* probe = ProbeCache(flags); |
| 611 if (!probe->IsUndefined()) return probe; | 612 if (!probe->IsUndefined()) return probe; |
| 612 StubCompiler compiler; | 613 StubCompiler compiler; |
| 613 return FillCache(compiler.CompileCallDebugPrepareStepIn(flags)); | 614 return FillCache(compiler.CompileCallDebugPrepareStepIn(flags)); |
| 614 } | 615 } |
| 616 #endif |
| 615 | 617 |
| 616 | 618 |
| 617 Object* StubCache::ComputeLazyCompile(int argc) { | 619 Object* StubCache::ComputeLazyCompile(int argc) { |
| 618 Code::Flags flags = | 620 Code::Flags flags = |
| 619 Code::ComputeFlags(Code::STUB, UNINITIALIZED, NORMAL, argc); | 621 Code::ComputeFlags(Code::STUB, UNINITIALIZED, NORMAL, argc); |
| 620 Object* probe = ProbeCache(flags); | 622 Object* probe = ProbeCache(flags); |
| 621 if (!probe->IsUndefined()) return probe; | 623 if (!probe->IsUndefined()) return probe; |
| 622 StubCompiler compiler; | 624 StubCompiler compiler; |
| 623 Object* result = FillCache(compiler.CompileLazyCompile(flags)); | 625 Object* result = FillCache(compiler.CompileLazyCompile(flags)); |
| 624 if (result->IsCode()) { | 626 if (result->IsCode()) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 if (!result->IsFailure()) { | 831 if (!result->IsFailure()) { |
| 830 Counters::call_megamorphic_stubs.Increment(); | 832 Counters::call_megamorphic_stubs.Increment(); |
| 831 Code* code = Code::cast(result); | 833 Code* code = Code::cast(result); |
| 832 USE(code); | 834 USE(code); |
| 833 LOG(CodeCreateEvent("CallMiss", code, code->arguments_count())); | 835 LOG(CodeCreateEvent("CallMiss", code, code->arguments_count())); |
| 834 } | 836 } |
| 835 return result; | 837 return result; |
| 836 } | 838 } |
| 837 | 839 |
| 838 | 840 |
| 841 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 839 Object* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { | 842 Object* StubCompiler::CompileCallDebugBreak(Code::Flags flags) { |
| 840 HandleScope scope; | 843 HandleScope scope; |
| 841 Debug::GenerateCallICDebugBreak(masm()); | 844 Debug::GenerateCallICDebugBreak(masm()); |
| 842 Object* result = GetCodeWithFlags(flags, "CompileCallDebugBreak"); | 845 Object* result = GetCodeWithFlags(flags, "CompileCallDebugBreak"); |
| 843 if (!result->IsFailure()) { | 846 if (!result->IsFailure()) { |
| 844 Code* code = Code::cast(result); | 847 Code* code = Code::cast(result); |
| 845 USE(code); | 848 USE(code); |
| 846 LOG(CodeCreateEvent("CallDebugBreak", code, code->arguments_count())); | 849 LOG(CodeCreateEvent("CallDebugBreak", code, code->arguments_count())); |
| 847 } | 850 } |
| 848 return result; | 851 return result; |
| 849 } | 852 } |
| 850 | 853 |
| 851 | 854 |
| 852 Object* StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { | 855 Object* StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { |
| 853 HandleScope scope; | 856 HandleScope scope; |
| 854 // Use the same code for the the step in preparations as we do for | 857 // Use the same code for the the step in preparations as we do for |
| 855 // the miss case. | 858 // the miss case. |
| 856 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 859 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 857 CallIC::GenerateMiss(masm(), argc); | 860 CallIC::GenerateMiss(masm(), argc); |
| 858 Object* result = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); | 861 Object* result = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); |
| 859 if (!result->IsFailure()) { | 862 if (!result->IsFailure()) { |
| 860 Code* code = Code::cast(result); | 863 Code* code = Code::cast(result); |
| 861 USE(code); | 864 USE(code); |
| 862 LOG(CodeCreateEvent("CallDebugPrepareStepIn", code, | 865 LOG(CodeCreateEvent("CallDebugPrepareStepIn", code, |
| 863 code->arguments_count())); | 866 code->arguments_count())); |
| 864 } | 867 } |
| 865 return result; | 868 return result; |
| 866 } | 869 } |
| 870 #endif |
| 867 | 871 |
| 868 | 872 |
| 869 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { | 873 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { |
| 870 CodeDesc desc; | 874 CodeDesc desc; |
| 871 masm_.GetCode(&desc); | 875 masm_.GetCode(&desc); |
| 872 Object* result = Heap::CreateCode(desc, NULL, flags, masm_.CodeObject()); | 876 Object* result = Heap::CreateCode(desc, NULL, flags, masm_.CodeObject()); |
| 873 #ifdef ENABLE_DISASSEMBLER | 877 #ifdef ENABLE_DISASSEMBLER |
| 874 if (FLAG_print_code_stubs && !result->IsFailure()) { | 878 if (FLAG_print_code_stubs && !result->IsFailure()) { |
| 875 Code::cast(result)->Disassemble(name); | 879 Code::cast(result)->Disassemble(name); |
| 876 } | 880 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 916 |
| 913 | 917 |
| 914 Object* CallStubCompiler::GetCode(PropertyType type, String* name) { | 918 Object* CallStubCompiler::GetCode(PropertyType type, String* name) { |
| 915 int argc = arguments_.immediate(); | 919 int argc = arguments_.immediate(); |
| 916 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, type, argc); | 920 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, type, argc); |
| 917 return GetCodeWithFlags(flags, name); | 921 return GetCodeWithFlags(flags, name); |
| 918 } | 922 } |
| 919 | 923 |
| 920 | 924 |
| 921 } } // namespace v8::internal | 925 } } // namespace v8::internal |
| OLD | NEW |