| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 isolate->factory()->non_monomorphic_cache(); | 173 isolate->factory()->non_monomorphic_cache(); |
| 174 int entry = cache->FindEntry(isolate, flags); | 174 int entry = cache->FindEntry(isolate, flags); |
| 175 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 175 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 176 | 176 |
| 177 PropertyICCompiler compiler(isolate, Code::LOAD_IC); | 177 PropertyICCompiler compiler(isolate, Code::LOAD_IC); |
| 178 Handle<Code> code; | 178 Handle<Code> code; |
| 179 if (ic_state == UNINITIALIZED) { | 179 if (ic_state == UNINITIALIZED) { |
| 180 code = compiler.CompileLoadInitialize(flags); | 180 code = compiler.CompileLoadInitialize(flags); |
| 181 } else if (ic_state == PREMONOMORPHIC) { | 181 } else if (ic_state == PREMONOMORPHIC) { |
| 182 code = compiler.CompileLoadPreMonomorphic(flags); | 182 code = compiler.CompileLoadPreMonomorphic(flags); |
| 183 } else if (ic_state == MEGAMORPHIC) { | |
| 184 code = compiler.CompileLoadMegamorphic(flags); | |
| 185 } else { | 183 } else { |
| 186 UNREACHABLE(); | 184 UNREACHABLE(); |
| 187 } | 185 } |
| 188 FillCache(isolate, code); | 186 FillCache(isolate, code); |
| 189 return code; | 187 return code; |
| 190 } | 188 } |
| 191 | 189 |
| 192 | 190 |
| 193 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, | 191 Handle<Code> PropertyICCompiler::ComputeStore(Isolate* isolate, |
| 194 InlineCacheState ic_state, | 192 InlineCacheState ic_state, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 313 |
| 316 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { | 314 Handle<Code> PropertyICCompiler::CompileLoadPreMonomorphic(Code::Flags flags) { |
| 317 LoadIC::GeneratePreMonomorphic(masm()); | 315 LoadIC::GeneratePreMonomorphic(masm()); |
| 318 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); | 316 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic"); |
| 319 PROFILE(isolate(), | 317 PROFILE(isolate(), |
| 320 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); | 318 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0)); |
| 321 return code; | 319 return code; |
| 322 } | 320 } |
| 323 | 321 |
| 324 | 322 |
| 325 Handle<Code> PropertyICCompiler::CompileLoadMegamorphic(Code::Flags flags) { | |
| 326 LoadIC::GenerateMegamorphic(masm()); | |
| 327 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic"); | |
| 328 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0)); | |
| 329 return code; | |
| 330 } | |
| 331 | |
| 332 | |
| 333 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { | 323 Handle<Code> PropertyICCompiler::CompileStoreInitialize(Code::Flags flags) { |
| 334 StoreIC::GenerateInitialize(masm()); | 324 StoreIC::GenerateInitialize(masm()); |
| 335 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); | 325 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize"); |
| 336 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); | 326 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0)); |
| 337 return code; | 327 return code; |
| 338 } | 328 } |
| 339 | 329 |
| 340 | 330 |
| 341 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { | 331 Handle<Code> PropertyICCompiler::CompileStorePreMonomorphic(Code::Flags flags) { |
| 342 StoreIC::GeneratePreMonomorphic(masm()); | 332 StoreIC::GeneratePreMonomorphic(masm()); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 436 |
| 447 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 437 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
| 448 | 438 |
| 449 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 439 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
| 450 } | 440 } |
| 451 | 441 |
| 452 | 442 |
| 453 #undef __ | 443 #undef __ |
| 454 } | 444 } |
| 455 } // namespace v8::internal | 445 } // namespace v8::internal |
| OLD | NEW |