| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 NoAllocationStringAllocator allocator(buffer, | 73 NoAllocationStringAllocator allocator(buffer, |
| 74 static_cast<unsigned>(sizeof(buffer))); | 74 static_cast<unsigned>(sizeof(buffer))); |
| 75 StringStream stream(&allocator); | 75 StringStream stream(&allocator); |
| 76 PrintName(&stream); | 76 PrintName(&stream); |
| 77 return stream.ToCString(); | 77 return stream.ToCString(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { | 81 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { |
| 82 SmartArrayPointer<const char> name = GetName(); | 82 SmartArrayPointer<const char> name = GetName(); |
| 83 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); | 83 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, name.get())); |
| 84 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); | 84 GDBJIT(AddCode(GDBJITInterface::STUB, name.get(), code)); |
| 85 Counters* counters = isolate->counters(); | 85 Counters* counters = isolate->counters(); |
| 86 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 86 counters->total_stubs_code_size()->Increment(code->instruction_size()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 Code::Kind CodeStub::GetCodeKind() const { | 90 Code::Kind CodeStub::GetCodeKind() const { |
| 91 return Code::STUB; | 91 return Code::STUB; |
| 92 } | 92 } |
| 93 | 93 |
| 94 | 94 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 HandleScope scope(isolate); | 157 HandleScope scope(isolate); |
| 158 | 158 |
| 159 Handle<Code> new_object = GenerateCode(isolate); | 159 Handle<Code> new_object = GenerateCode(isolate); |
| 160 new_object->set_major_key(MajorKey()); | 160 new_object->set_major_key(MajorKey()); |
| 161 FinishCode(new_object); | 161 FinishCode(new_object); |
| 162 RecordCodeGeneration(*new_object, isolate); | 162 RecordCodeGeneration(*new_object, isolate); |
| 163 | 163 |
| 164 #ifdef ENABLE_DISASSEMBLER | 164 #ifdef ENABLE_DISASSEMBLER |
| 165 if (FLAG_print_code_stubs) { | 165 if (FLAG_print_code_stubs) { |
| 166 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); | 166 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); |
| 167 new_object->Disassemble(*GetName(), trace_scope.file()); | 167 new_object->Disassemble(GetName().get(), trace_scope.file()); |
| 168 PrintF(trace_scope.file(), "\n"); | 168 PrintF(trace_scope.file(), "\n"); |
| 169 } | 169 } |
| 170 #endif | 170 #endif |
| 171 | 171 |
| 172 if (UseSpecialCache()) { | 172 if (UseSpecialCache()) { |
| 173 AddToSpecialCache(new_object); | 173 AddToSpecialCache(new_object); |
| 174 } else { | 174 } else { |
| 175 // Update the dictionary and the root in Heap. | 175 // Update the dictionary and the root in Heap. |
| 176 Handle<UnseededNumberDictionary> dict = | 176 Handle<UnseededNumberDictionary> dict = |
| 177 factory->DictionaryAtNumberPut( | 177 factory->DictionaryAtNumberPut( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 190 return Handle<Code>(code, isolate); | 190 return Handle<Code>(code, isolate); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 const char* CodeStub::MajorName(CodeStub::Major major_key, | 194 const char* CodeStub::MajorName(CodeStub::Major major_key, |
| 195 bool allow_unknown_keys) { | 195 bool allow_unknown_keys) { |
| 196 switch (major_key) { | 196 switch (major_key) { |
| 197 #define DEF_CASE(name) case name: return #name "Stub"; | 197 #define DEF_CASE(name) case name: return #name "Stub"; |
| 198 CODE_STUB_LIST(DEF_CASE) | 198 CODE_STUB_LIST(DEF_CASE) |
| 199 #undef DEF_CASE | 199 #undef DEF_CASE |
| 200 case UninitializedMajorKey: return "<UninitializedMajorKey>Stub"; |
| 200 default: | 201 default: |
| 201 if (!allow_unknown_keys) { | 202 if (!allow_unknown_keys) { |
| 202 UNREACHABLE(); | 203 UNREACHABLE(); |
| 203 } | 204 } |
| 204 return NULL; | 205 return NULL; |
| 205 } | 206 } |
| 206 } | 207 } |
| 207 | 208 |
| 208 | 209 |
| 209 void CodeStub::PrintBaseName(StringStream* stream) { | 210 void CodeStub::PrintBaseName(StringStream* stream) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 239 | 240 |
| 240 | 241 |
| 241 // static | 242 // static |
| 242 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate, | 243 void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate, |
| 243 const BinaryOpIC::State& state) { | 244 const BinaryOpIC::State& state) { |
| 244 BinaryOpICStub stub(state); | 245 BinaryOpICStub stub(state); |
| 245 stub.GetCode(isolate); | 246 stub.GetCode(isolate); |
| 246 } | 247 } |
| 247 | 248 |
| 248 | 249 |
| 250 // static |
| 251 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 252 // Generate special versions of the stub. |
| 253 BinaryOpIC::State::GenerateAheadOfTime(isolate, &GenerateAheadOfTime); |
| 254 } |
| 255 |
| 256 |
| 257 void BinaryOpICWithAllocationSiteStub::PrintState(StringStream* stream) { |
| 258 state_.Print(stream); |
| 259 } |
| 260 |
| 261 |
| 262 // static |
| 263 void BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime( |
| 264 Isolate* isolate, const BinaryOpIC::State& state) { |
| 265 if (state.CouldCreateAllocationMementos()) { |
| 266 BinaryOpICWithAllocationSiteStub stub(state); |
| 267 stub.GetCode(isolate); |
| 268 } |
| 269 } |
| 270 |
| 271 |
| 249 void NewStringAddStub::PrintBaseName(StringStream* stream) { | 272 void NewStringAddStub::PrintBaseName(StringStream* stream) { |
| 250 stream->Add("NewStringAddStub"); | 273 stream->Add("NewStringAddStub"); |
| 251 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { | 274 if ((flags() & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { |
| 252 stream->Add("_CheckBoth"); | 275 stream->Add("_CheckBoth"); |
| 253 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | 276 } else if ((flags() & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
| 254 stream->Add("_CheckLeft"); | 277 stream->Add("_CheckLeft"); |
| 255 } else if ((flags() & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { | 278 } else if ((flags() & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { |
| 256 stream->Add("_CheckRight"); | 279 stream->Add("_CheckRight"); |
| 257 } | 280 } |
| 258 if (pretenure_flag() == TENURED) { | 281 if (pretenure_flag() == TENURED) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (RecordCallTarget()) stream->Add("_Recording"); | 600 if (RecordCallTarget()) stream->Add("_Recording"); |
| 578 } | 601 } |
| 579 | 602 |
| 580 | 603 |
| 581 void CallConstructStub::PrintName(StringStream* stream) { | 604 void CallConstructStub::PrintName(StringStream* stream) { |
| 582 stream->Add("CallConstructStub"); | 605 stream->Add("CallConstructStub"); |
| 583 if (RecordCallTarget()) stream->Add("_Recording"); | 606 if (RecordCallTarget()) stream->Add("_Recording"); |
| 584 } | 607 } |
| 585 | 608 |
| 586 | 609 |
| 610 void ArrayConstructorStub::PrintName(StringStream* stream) { |
| 611 stream->Add("ArrayConstructorStub"); |
| 612 switch (argument_count_) { |
| 613 case ANY: stream->Add("_Any"); break; |
| 614 case NONE: stream->Add("_None"); break; |
| 615 case ONE: stream->Add("_One"); break; |
| 616 case MORE_THAN_ONE: stream->Add("_More_Than_One"); break; |
| 617 } |
| 618 } |
| 619 |
| 620 |
| 621 void ArrayConstructorStubBase::BasePrintName(const char* name, |
| 622 StringStream* stream) { |
| 623 stream->Add(name); |
| 624 stream->Add("_"); |
| 625 stream->Add(ElementsKindToString(elements_kind())); |
| 626 if (override_mode() == DISABLE_ALLOCATION_SITES) { |
| 627 stream->Add("_DISABLE_ALLOCATION_SITES"); |
| 628 } |
| 629 } |
| 630 |
| 631 |
| 587 bool ToBooleanStub::UpdateStatus(Handle<Object> object) { | 632 bool ToBooleanStub::UpdateStatus(Handle<Object> object) { |
| 588 Types old_types(types_); | 633 Types old_types(types_); |
| 589 bool to_boolean_value = types_.UpdateStatus(object); | 634 bool to_boolean_value = types_.UpdateStatus(object); |
| 590 TraceTransition(old_types, types_); | 635 TraceTransition(old_types, types_); |
| 591 return to_boolean_value; | 636 return to_boolean_value; |
| 592 } | 637 } |
| 593 | 638 |
| 594 | 639 |
| 595 void ToBooleanStub::PrintState(StringStream* stream) { | 640 void ToBooleanStub::PrintState(StringStream* stream) { |
| 596 types_.Print(stream); | 641 types_.Print(stream); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 InstallDescriptor(isolate, &stub3); | 807 InstallDescriptor(isolate, &stub3); |
| 763 } | 808 } |
| 764 | 809 |
| 765 InternalArrayConstructorStub::InternalArrayConstructorStub( | 810 InternalArrayConstructorStub::InternalArrayConstructorStub( |
| 766 Isolate* isolate) { | 811 Isolate* isolate) { |
| 767 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 812 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 768 } | 813 } |
| 769 | 814 |
| 770 | 815 |
| 771 } } // namespace v8::internal | 816 } } // namespace v8::internal |
| OLD | NEW |