| 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/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
| 8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
| 9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
| 10 #include "src/ic/ic-compiler.h" | 10 #include "src/ic/ic-compiler.h" |
| (...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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 329 |
| 328 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 330 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
| 329 LoadIC::GeneratePreMonomorphic(masm()); | 331 LoadIC::GeneratePreMonomorphic(masm()); |
| 330 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 332 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
| 331 PROFILE(isolate(), | 333 PROFILE(isolate(), |
| 332 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 334 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
| 333 return code; | 335 return code; |
| 334 } | 336 } |
| 335 | 337 |
| 336 | 338 |
| 339 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { |
| 340 MegamorphicLoadStub stub(isolate(), LoadICState(extra_ic_state_)); |
| 341 auto code = stub.GetCode(); |
| 342 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); |
| 343 return code; |
| 344 } |
| 345 |
| 346 |
| 337 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { | 347 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { |
| 338 StoreIC::GenerateInitialize(masm()); | 348 StoreIC::GenerateInitialize(masm()); |
| 339 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 349 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
| 340 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 350 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
| 341 return code; | 351 return code; |
| 342 } | 352 } |
| 343 | 353 |
| 344 | 354 |
| 345 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 355 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
| 346 StoreIC::GeneratePreMonomorphic(masm()); | 356 StoreIC::GeneratePreMonomorphic(masm()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 465 |
| 456 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 466 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 457 | 467 |
| 458 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 468 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 459 } | 469 } |
| 460 | 470 |
| 461 | 471 |
| 462 #undef __ | 472 #undef __ |
| 463 } | 473 } |
| 464 } // namespace v8::internal | 474 } // namespace v8::internal |
| OLD | NEW |