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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 SmartArrayPointer<const char> CodeStub::GetName() { | 65 SmartArrayPointer<const char> CodeStub::GetName() { |
66 char buffer[100]; | 66 char buffer[100]; |
67 NoAllocationStringAllocator allocator(buffer, | 67 NoAllocationStringAllocator allocator(buffer, |
68 static_cast<unsigned>(sizeof(buffer))); | 68 static_cast<unsigned>(sizeof(buffer))); |
69 StringStream stream(&allocator); | 69 StringStream stream(&allocator); |
70 PrintName(&stream); | 70 PrintName(&stream); |
71 return stream.ToCString(); | 71 return stream.ToCString(); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { | 75 void CodeStub::RecordCodeGeneration(Handle<Code> code, Isolate* isolate) { |
| 76 IC::RegisterWeakMapDependency(code); |
76 SmartArrayPointer<const char> name = GetName(); | 77 SmartArrayPointer<const char> name = GetName(); |
77 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, name.get())); | 78 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, *code, name.get())); |
78 GDBJIT(AddCode(GDBJITInterface::STUB, name.get(), code)); | 79 GDBJIT(AddCode(GDBJITInterface::STUB, name.get(), *code)); |
79 Counters* counters = isolate->counters(); | 80 Counters* counters = isolate->counters(); |
80 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 81 counters->total_stubs_code_size()->Increment(code->instruction_size()); |
81 } | 82 } |
82 | 83 |
83 | 84 |
84 Code::Kind CodeStub::GetCodeKind() const { | 85 Code::Kind CodeStub::GetCodeKind() const { |
85 return Code::STUB; | 86 return Code::STUB; |
86 } | 87 } |
87 | 88 |
88 | 89 |
89 Handle<Code> CodeStub::GetCodeCopy(Isolate* isolate, | 90 Handle<Code> CodeStub::GetCodeCopy(Isolate* isolate, |
90 const Code::FindAndReplacePattern& pattern) { | 91 const Code::FindAndReplacePattern& pattern) { |
91 Handle<Code> ic = GetCode(isolate); | 92 Handle<Code> ic = GetCode(isolate); |
92 ic = isolate->factory()->CopyCode(ic); | 93 ic = isolate->factory()->CopyCode(ic); |
93 ic->FindAndReplace(pattern); | 94 ic->FindAndReplace(pattern); |
94 RecordCodeGeneration(*ic, isolate); | 95 RecordCodeGeneration(ic, isolate); |
95 return ic; | 96 return ic; |
96 } | 97 } |
97 | 98 |
98 | 99 |
99 Handle<Code> PlatformCodeStub::GenerateCode(Isolate* isolate) { | 100 Handle<Code> PlatformCodeStub::GenerateCode(Isolate* isolate) { |
100 Factory* factory = isolate->factory(); | 101 Factory* factory = isolate->factory(); |
101 | 102 |
102 // Generate the new code. | 103 // Generate the new code. |
103 MacroAssembler masm(isolate, NULL, 256); | 104 MacroAssembler masm(isolate, NULL, 256); |
104 | 105 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 #ifdef DEBUG | 148 #ifdef DEBUG |
148 VerifyPlatformFeatures(isolate); | 149 VerifyPlatformFeatures(isolate); |
149 #endif | 150 #endif |
150 | 151 |
151 { | 152 { |
152 HandleScope scope(isolate); | 153 HandleScope scope(isolate); |
153 | 154 |
154 Handle<Code> new_object = GenerateCode(isolate); | 155 Handle<Code> new_object = GenerateCode(isolate); |
155 new_object->set_major_key(MajorKey()); | 156 new_object->set_major_key(MajorKey()); |
156 FinishCode(new_object); | 157 FinishCode(new_object); |
157 RecordCodeGeneration(*new_object, isolate); | 158 RecordCodeGeneration(new_object, isolate); |
158 | 159 |
159 #ifdef ENABLE_DISASSEMBLER | 160 #ifdef ENABLE_DISASSEMBLER |
160 if (FLAG_print_code_stubs) { | 161 if (FLAG_print_code_stubs) { |
161 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); | 162 CodeTracer::Scope trace_scope(isolate->GetCodeTracer()); |
162 new_object->Disassemble(GetName().get(), trace_scope.file()); | 163 new_object->Disassemble(GetName().get(), trace_scope.file()); |
163 PrintF(trace_scope.file(), "\n"); | 164 PrintF(trace_scope.file(), "\n"); |
164 } | 165 } |
165 #endif | 166 #endif |
166 | 167 |
167 if (UseSpecialCache()) { | 168 if (UseSpecialCache()) { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 InstallDescriptor(isolate, &stub3); | 816 InstallDescriptor(isolate, &stub3); |
816 } | 817 } |
817 | 818 |
818 InternalArrayConstructorStub::InternalArrayConstructorStub( | 819 InternalArrayConstructorStub::InternalArrayConstructorStub( |
819 Isolate* isolate) { | 820 Isolate* isolate) { |
820 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 821 InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
821 } | 822 } |
822 | 823 |
823 | 824 |
824 } } // namespace v8::internal | 825 } } // namespace v8::internal |
OLD | NEW |