| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "bootstrapper.h" | 30 #include "bootstrapper.h" |
| 31 #include "code-stubs.h" | 31 #include "code-stubs.h" |
| 32 #include "factory.h" | 32 #include "factory.h" |
| 33 #include "macro-assembler.h" | 33 #include "macro-assembler.h" |
| 34 #include "oprofile-agent.h" |
| 34 | 35 |
| 35 namespace v8 { | 36 namespace v8 { |
| 36 namespace internal { | 37 namespace internal { |
| 37 | 38 |
| 38 bool CodeStub::FindCodeInCache(Code** code_out) { | 39 bool CodeStub::FindCodeInCache(Code** code_out) { |
| 39 if (has_custom_cache()) return GetCustomCache(code_out); | 40 if (has_custom_cache()) return GetCustomCache(code_out); |
| 40 int index = Heap::code_stubs()->FindEntry(GetKey()); | 41 int index = Heap::code_stubs()->FindEntry(GetKey()); |
| 41 if (index != NumberDictionary::kNotFound) { | 42 if (index != NumberDictionary::kNotFound) { |
| 42 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index)); | 43 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index)); |
| 43 return true; | 44 return true; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 Generate(masm); | 57 Generate(masm); |
| 57 } | 58 } |
| 58 | 59 |
| 59 | 60 |
| 60 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { | 61 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { |
| 61 code->set_major_key(MajorKey()); | 62 code->set_major_key(MajorKey()); |
| 62 | 63 |
| 63 // Add unresolved entries in the code to the fixup list. | 64 // Add unresolved entries in the code to the fixup list. |
| 64 Bootstrapper::AddFixup(code, masm); | 65 Bootstrapper::AddFixup(code, masm); |
| 65 | 66 |
| 67 #ifdef ENABLE_OPROFILE_AGENT |
| 68 // Register the generated stub with the OPROFILE agent. |
| 69 OProfileAgent::CreateNativeCodeRegion(GetName(), |
| 70 code->instruction_start(), |
| 71 code->instruction_size()); |
| 72 #endif |
| 73 |
| 66 LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); | 74 LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); |
| 67 Counters::total_stubs_code_size.Increment(code->instruction_size()); | 75 Counters::total_stubs_code_size.Increment(code->instruction_size()); |
| 68 | 76 |
| 69 #ifdef ENABLE_DISASSEMBLER | 77 #ifdef ENABLE_DISASSEMBLER |
| 70 if (FLAG_print_code_stubs) { | 78 if (FLAG_print_code_stubs) { |
| 71 #ifdef DEBUG | 79 #ifdef DEBUG |
| 72 Print(); | 80 Print(); |
| 73 #endif | 81 #endif |
| 74 code->Disassemble(GetName()); | 82 code->Disassemble(GetName()); |
| 75 PrintF("\n"); | 83 PrintF("\n"); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 default: | 166 default: |
| 159 if (!allow_unknown_keys) { | 167 if (!allow_unknown_keys) { |
| 160 UNREACHABLE(); | 168 UNREACHABLE(); |
| 161 } | 169 } |
| 162 return NULL; | 170 return NULL; |
| 163 } | 171 } |
| 164 } | 172 } |
| 165 | 173 |
| 166 | 174 |
| 167 } } // namespace v8::internal | 175 } } // namespace v8::internal |
| OLD | NEW |