Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/code-stubs.cc

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | src/codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
44 } 45 }
45 return false; 46 return false;
46 } 47 }
47 48
48 49
49 void CodeStub::GenerateCode(MacroAssembler* masm) { 50 void CodeStub::GenerateCode(MacroAssembler* masm) {
50 // Update the static counter each time a new code stub is generated. 51 // Update the static counter each time a new code stub is generated.
51 Counters::code_stubs.Increment(); 52 Counters::code_stubs.Increment();
52 // Nested stubs are not allowed for leafs. 53 // Nested stubs are not allowed for leafs.
53 masm->set_allow_stub_calls(AllowsStubCalls()); 54 masm->set_allow_stub_calls(AllowsStubCalls());
54 // Generate the code for the stub. 55 // Generate the code for the stub.
55 masm->set_generating_stub(true); 56 masm->set_generating_stub(true);
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 #ifdef ENABLE_OPROFILE_AGENT
64 Bootstrapper::AddFixup(code, masm); 65 // Register the generated stub with the OPROFILE agent.
66 OProfileAgent::CreateNativeCodeRegion(GetName(),
67 code->instruction_start(),
68 code->instruction_size());
69 #endif
65 70
66 LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); 71 LOG(CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
67 Counters::total_stubs_code_size.Increment(code->instruction_size()); 72 Counters::total_stubs_code_size.Increment(code->instruction_size());
68 73
69 #ifdef ENABLE_DISASSEMBLER 74 #ifdef ENABLE_DISASSEMBLER
70 if (FLAG_print_code_stubs) { 75 if (FLAG_print_code_stubs) {
71 #ifdef DEBUG 76 #ifdef DEBUG
72 Print(); 77 Print();
73 #endif 78 #endif
74 code->Disassemble(GetName()); 79 code->Disassemble(GetName());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 default: 163 default:
159 if (!allow_unknown_keys) { 164 if (!allow_unknown_keys) {
160 UNREACHABLE(); 165 UNREACHABLE();
161 } 166 }
162 return NULL; 167 return NULL;
163 } 168 }
164 } 169 }
165 170
166 171
167 } } // namespace v8::internal 172 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698