OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 #include "src/ic/ic-inl.h" | 8 #include "src/ic/ic-inl.h" |
9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 isolate->factory()->non_monomorphic_cache(); | 171 isolate->factory()->non_monomorphic_cache(); |
172 int entry = cache->FindEntry(isolate, flags); | 172 int entry = cache->FindEntry(isolate, flags); |
173 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 173 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
174 | 174 |
175 PropertyICCompiler compiler(isolate, Code::LOAD_IC); | 175 PropertyICCompiler compiler(isolate, Code::LOAD_IC); |
176 Handle<Code> code; | 176 Handle<Code> code; |
177 if (ic_state == UNINITIALIZED) { | 177 if (ic_state == UNINITIALIZED) { |
178 code = compiler.CompileLoadInitialize(flags); | 178 code = compiler.CompileLoadInitialize(flags); |
179 } else if (ic_state == PREMONOMORPHIC) { | 179 } else if (ic_state == PREMONOMORPHIC) { |
180 code = compiler.CompileLoadPreMonomorphic(flags); | 180 code = compiler.CompileLoadPreMonomorphic(flags); |
181 } else if (ic_state == MEGAMORPHIC) { | |
182 code = compiler.CompileLoadMegamorphic(flags); | |
183 } else { | 181 } else { |
184 UNREACHABLE(); | 182 UNREACHABLE(); |
185 } | 183 } |
186 FillCache(isolate, code); | 184 FillCache(isolate, code); |
187 return code; | 185 return code; |
188 } | 186 } |
189 | 187 |
190 | 188 |
191 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, | 189 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, |
192 InlineCacheState ic_state, | 190 InlineCacheState ic_state, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 311 |
314 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 312 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
315 LoadIC::GeneratePreMonomorphic(masm()); | 313 LoadIC::GeneratePreMonomorphic(masm()); |
316 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 314 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
317 PROFILE(isolate(), | 315 PROFILE(isolate(), |
318 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 316 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
319 return code; | 317 return code; |
320 } | 318 } |
321 | 319 |
322 | 320 |
323 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { | |
324 LoadIC::GenerateMegamorphic(masm()); | |
325 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); | |
326 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); | |
327 return code; | |
328 } | |
329 | |
330 | |
331 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { | 321 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { |
332 StoreIC::GenerateInitialize(masm()); | 322 StoreIC::GenerateInitialize(masm()); |
333 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 323 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
334 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 324 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
335 return code; | 325 return code; |
336 } | 326 } |
337 | 327 |
338 | 328 |
339 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 329 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
340 StoreIC::GeneratePreMonomorphic(masm()); | 330 StoreIC::GeneratePreMonomorphic(masm()); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 434 |
445 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 435 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
446 | 436 |
447 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 437 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
448 } | 438 } |
449 | 439 |
450 | 440 |
451 #undef __ | 441 #undef __ |
452 } | 442 } |
453 } // namespace v8::internal | 443 } // namespace v8::internal |
OLD | NEW |