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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(), | 65 OPROFILE(CreateNativeCodeRegion(GetName(), |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 break; | 192 break; |
191 case CompareIC::OBJECTS: | 193 case CompareIC::OBJECTS: |
192 GenerateObjects(masm); | 194 GenerateObjects(masm); |
193 break; | 195 break; |
194 default: | 196 default: |
195 UNREACHABLE(); | 197 UNREACHABLE(); |
196 } | 198 } |
197 } | 199 } |
198 | 200 |
199 | 201 |
| 202 const char* InstanceofStub::GetName() { |
| 203 if (name_ != NULL) return name_; |
| 204 const int kMaxNameLength = 100; |
| 205 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength); |
| 206 if (name_ == NULL) return "OOM"; |
| 207 |
| 208 const char* args = ""; |
| 209 if (HasArgsInRegisters()) { |
| 210 args = "_REGS"; |
| 211 } |
| 212 |
| 213 const char* inline_check = ""; |
| 214 if (HasCallSiteInlineCheck()) { |
| 215 inline_check = "_INLINE"; |
| 216 } |
| 217 |
| 218 const char* return_true_false_object = ""; |
| 219 if (ReturnTrueFalseObject()) { |
| 220 return_true_false_object = "_TRUEFALSE"; |
| 221 } |
| 222 |
| 223 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
| 224 "InstanceofStub%s%s%s", |
| 225 args, |
| 226 inline_check, |
| 227 return_true_false_object); |
| 228 return name_; |
| 229 } |
| 230 |
| 231 |
200 } } // namespace v8::internal | 232 } } // namespace v8::internal |
OLD | NEW |