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

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

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 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.cc » ('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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "gdb-jit.h"
33 #include "macro-assembler.h" 34 #include "macro-assembler.h"
34 #include "oprofile-agent.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 bool CodeStub::FindCodeInCache(Code** code_out) { 39 bool CodeStub::FindCodeInCache(Code** code_out) {
40 int index = Heap::code_stubs()->FindEntry(GetKey()); 40 int index = Heap::code_stubs()->FindEntry(GetKey());
41 if (index != NumberDictionary::kNotFound) { 41 if (index != NumberDictionary::kNotFound) {
42 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index)); 42 *code_out = Code::cast(Heap::code_stubs()->ValueAt(index));
43 return true; 43 return true;
44 } 44 }
45 return false; 45 return false;
46 } 46 }
47 47
48 48
49 void CodeStub::GenerateCode(MacroAssembler* masm) { 49 void CodeStub::GenerateCode(MacroAssembler* masm) {
50 // Update the static counter each time a new code stub is generated. 50 // Update the static counter each time a new code stub is generated.
51 Counters::code_stubs.Increment(); 51 Counters::code_stubs.Increment();
52
52 // Nested stubs are not allowed for leafs. 53 // Nested stubs are not allowed for leafs.
53 masm->set_allow_stub_calls(AllowsStubCalls()); 54 AllowStubCallsScope allow_scope(masm, AllowsStubCalls());
55
54 // Generate the code for the stub. 56 // Generate the code for the stub.
55 masm->set_generating_stub(true); 57 masm->set_generating_stub(true);
56 Generate(masm); 58 Generate(masm);
57 } 59 }
58 60
59 61
60 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { 62 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
61 code->set_major_key(MajorKey()); 63 code->set_major_key(MajorKey());
62 64
63 OPROFILE(CreateNativeCodeRegion(GetName(),
64 code->instruction_start(),
65 code->instruction_size()));
66 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, GetName())); 65 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
66 GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code));
67 Counters::total_stubs_code_size.Increment(code->instruction_size()); 67 Counters::total_stubs_code_size.Increment(code->instruction_size());
68 68
69 #ifdef ENABLE_DISASSEMBLER 69 #ifdef ENABLE_DISASSEMBLER
70 if (FLAG_print_code_stubs) { 70 if (FLAG_print_code_stubs) {
71 #ifdef DEBUG 71 #ifdef DEBUG
72 Print(); 72 Print();
73 #endif 73 #endif
74 code->Disassemble(GetName()); 74 code->Disassemble(GetName());
75 PrintF("\n"); 75 PrintF("\n");
76 } 76 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 break; 190 break;
191 case CompareIC::OBJECTS: 191 case CompareIC::OBJECTS:
192 GenerateObjects(masm); 192 GenerateObjects(masm);
193 break; 193 break;
194 default: 194 default:
195 UNREACHABLE(); 195 UNREACHABLE();
196 } 196 }
197 } 197 }
198 198
199 199
200 const char* InstanceofStub::GetName() {
201 if (name_ != NULL) return name_;
202 const int kMaxNameLength = 100;
203 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength);
204 if (name_ == NULL) return "OOM";
205
206 const char* args = "";
207 if (HasArgsInRegisters()) {
208 args = "_REGS";
209 }
210
211 const char* inline_check = "";
212 if (HasCallSiteInlineCheck()) {
213 inline_check = "_INLINE";
214 }
215
216 const char* return_true_false_object = "";
217 if (ReturnTrueFalseObject()) {
218 return_true_false_object = "_TRUEFALSE";
219 }
220
221 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
222 "InstanceofStub%s%s%s",
223 args,
224 inline_check,
225 return_true_false_object);
226 return name_;
227 }
228
229
200 } } // namespace v8::internal 230 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698