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 14 matching lines...) Expand all Loading... |
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 "gdb-jit.h" | 33 #include "gdb-jit.h" |
34 #include "macro-assembler.h" | 34 #include "macro-assembler.h" |
35 #include "oprofile-agent.h" | |
36 | 35 |
37 namespace v8 { | 36 namespace v8 { |
38 namespace internal { | 37 namespace internal { |
39 | 38 |
40 bool CodeStub::FindCodeInCache(Code** code_out) { | 39 bool CodeStub::FindCodeInCache(Code** code_out) { |
41 int index = Heap::code_stubs()->FindEntry(GetKey()); | 40 int index = Heap::code_stubs()->FindEntry(GetKey()); |
42 if (index != NumberDictionary::kNotFound) { | 41 if (index != NumberDictionary::kNotFound) { |
43 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index)); | 42 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index)); |
44 return true; | 43 return true; |
45 } | 44 } |
(...skipping 10 matching lines...) Expand all Loading... |
56 | 55 |
57 // Generate the code for the stub. | 56 // Generate the code for the stub. |
58 masm->set_generating_stub(true); | 57 masm->set_generating_stub(true); |
59 Generate(masm); | 58 Generate(masm); |
60 } | 59 } |
61 | 60 |
62 | 61 |
63 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { | 62 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { |
64 code->set_major_key(MajorKey()); | 63 code->set_major_key(MajorKey()); |
65 | 64 |
66 OPROFILE(CreateNativeCodeRegion(GetName(), | |
67 code->instruction_start(), | |
68 code->instruction_size())); | |
69 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); | 65 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); |
70 GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code)); | 66 GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code)); |
71 Counters::total_stubs_code_size.Increment(code->instruction_size()); | 67 Counters::total_stubs_code_size.Increment(code->instruction_size()); |
72 | 68 |
73 #ifdef ENABLE_DISASSEMBLER | 69 #ifdef ENABLE_DISASSEMBLER |
74 if (FLAG_print_code_stubs) { | 70 if (FLAG_print_code_stubs) { |
75 #ifdef DEBUG | 71 #ifdef DEBUG |
76 Print(); | 72 Print(); |
77 #endif | 73 #endif |
78 code->Disassemble(GetName()); | 74 code->Disassemble(GetName()); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), | 221 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
226 "InstanceofStub%s%s%s", | 222 "InstanceofStub%s%s%s", |
227 args, | 223 args, |
228 inline_check, | 224 inline_check, |
229 return_true_false_object); | 225 return_true_false_object); |
230 return name_; | 226 return name_; |
231 } | 227 } |
232 | 228 |
233 | 229 |
234 } } // namespace v8::internal | 230 } } // namespace v8::internal |
OLD | NEW |