| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 isolate->factory()->non_monomorphic_cache(); | 190 isolate->factory()->non_monomorphic_cache(); |
| 191 int entry = cache->FindEntry(isolate, flags); | 191 int entry = cache->FindEntry(isolate, flags); |
| 192 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 192 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 193 | 193 |
| 194 PropertyICCompiler compiler(isolate, Code::LOAD_IC); | 194 PropertyICCompiler compiler(isolate, Code::LOAD_IC); |
| 195 Handle<Code> code; | 195 Handle<Code> code; |
| 196 if (ic_state == UNINITIALIZED) { | 196 if (ic_state == UNINITIALIZED) { |
| 197 code = compiler.CompileLoadInitialize(flags); | 197 code = compiler.CompileLoadInitialize(flags); |
| 198 } else if (ic_state == PREMONOMORPHIC) { | 198 } else if (ic_state == PREMONOMORPHIC) { |
| 199 code = compiler.CompileLoadPreMonomorphic(flags); | 199 code = compiler.CompileLoadPreMonomorphic(flags); |
| 200 } else if (ic_state == MEGAMORPHIC) { |
| 201 code = compiler.CompileLoadMegamorphic(flags); |
| 200 } else { | 202 } else { |
| 201 UNREACHABLE(); | 203 UNREACHABLE(); |
| 202 } | 204 } |
| 203 FillCache(isolate, code); | 205 FillCache(isolate, code); |
| 204 return code; | 206 return code; |
| 205 } | 207 } |
| 206 | 208 |
| 207 | 209 |
| 208 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, | 210 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, |
| 209 InlineCacheState ic_state, | 211 InlineCacheState ic_state, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 334 |
| 333 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 335 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
| 334 LoadIC::GeneratePreMonomorphic(masm()); | 336 LoadIC::GeneratePreMonomorphic(masm()); |
| 335 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 337 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
| 336 PROFILE(isolate(), | 338 PROFILE(isolate(), |
| 337 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 339 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
| 338 return code; | 340 return code; |
| 339 } | 341 } |
| 340 | 342 |
| 341 | 343 |
| 344 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { |
| 345 MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state_)); |
| 346 auto code = stub.GetCode(); |
| 347 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); |
| 348 return code; |
| 349 } |
| 350 |
| 351 |
| 342 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { | 352 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { |
| 343 StoreIC::GenerateInitialize(masm()); | 353 StoreIC::GenerateInitialize(masm()); |
| 344 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 354 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
| 345 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 355 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
| 346 return code; | 356 return code; |
| 347 } | 357 } |
| 348 | 358 |
| 349 | 359 |
| 350 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 360 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
| 351 StoreIC::GeneratePreMonomorphic(masm()); | 361 StoreIC::GeneratePreMonomorphic(masm()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 470 |
| 461 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 471 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 462 | 472 |
| 463 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 473 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 464 } | 474 } |
| 465 | 475 |
| 466 | 476 |
| 467 #undef __ | 477 #undef __ |
| 468 } | 478 } |
| 469 } // namespace v8::internal | 479 } // namespace v8::internal |
| OLD | NEW |