diff options
| author | Ben Murdoch <benm@google.com> | 2012-03-05 14:35:55 +0000 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2012-04-11 15:40:15 +0100 |
| commit | c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9 (patch) | |
| tree | 6f84ef396408af3c9f08eaac783ecf1a957b0fee /src/code-stubs.cc | |
| parent | 592a9fc1d8ea420377a2e7efd0600e20b058be2b (diff) | |
| download | android_external_v8-c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9.tar.gz android_external_v8-c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9.tar.bz2 android_external_v8-c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9.zip | |
Merge V8 at 3.8.9.11
Bug: 5688872
Change-Id: Ie3b1dd67a730ec5e82686b7b37dba26f6a9bb24f
Diffstat (limited to 'src/code-stubs.cc')
| -rw-r--r-- | src/code-stubs.cc | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/src/code-stubs.cc b/src/code-stubs.cc index ba7df802..5fa9a2b5 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -40,7 +40,7 @@ namespace internal { bool CodeStub::FindCodeInCache(Code** code_out) { Heap* heap = Isolate::Current()->heap(); int index = heap->code_stubs()->FindEntry(GetKey()); - if (index != NumberDictionary::kNotFound) { + if (index != UnseededNumberDictionary::kNotFound) { *code_out = Code::cast(heap->code_stubs()->ValueAt(index)); return true; } @@ -101,7 +101,14 @@ Handle<Code> CodeStub::GetCode() { Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); Code* code; - if (!FindCodeInCache(&code)) { + if (UseSpecialCache() + ? FindCodeInSpecialCache(&code) + : FindCodeInCache(&code)) { + ASSERT(IsPregenerated() == code->is_pregenerated()); + return Handle<Code>(code); + } + + { HandleScope scope(isolate); // Generate the new code. @@ -121,19 +128,21 @@ Handle<Code> CodeStub::GetCode() { RecordCodeGeneration(*new_object, &masm); FinishCode(new_object); - // Update the dictionary and the root in Heap. - Handle<NumberDictionary> dict = - factory->DictionaryAtNumberPut( - Handle<NumberDictionary>(heap->code_stubs()), - GetKey(), - new_object); - heap->public_set_code_stubs(*dict); + if (UseSpecialCache()) { + AddToSpecialCache(new_object); + } else { + // Update the dictionary and the root in Heap. + Handle<UnseededNumberDictionary> dict = + factory->DictionaryAtNumberPut( + Handle<UnseededNumberDictionary>(heap->code_stubs()), + GetKey(), + new_object); + heap->public_set_code_stubs(*dict); + } code = *new_object; - Activate(code); - } else { - CHECK(IsPregenerated() == code->is_pregenerated()); } + Activate(code); ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code)); return Handle<Code>(code, isolate); } @@ -159,6 +168,32 @@ void CodeStub::PrintName(StringStream* stream) { } +void ICCompareStub::AddToSpecialCache(Handle<Code> new_object) { + ASSERT(*known_map_ != NULL); + Isolate* isolate = new_object->GetIsolate(); + Factory* factory = isolate->factory(); + return Map::UpdateCodeCache(known_map_, + factory->compare_ic_symbol(), + new_object); +} + + +bool ICCompareStub::FindCodeInSpecialCache(Code** code_out) { + Isolate* isolate = known_map_->GetIsolate(); + Factory* factory = isolate->factory(); + Code::Flags flags = Code::ComputeFlags( + static_cast<Code::Kind>(GetCodeKind()), + UNINITIALIZED); + Handle<Object> probe( + known_map_->FindInCodeCache(*factory->compare_ic_symbol(), flags)); + if (probe->IsCode()) { + *code_out = Code::cast(*probe); + return true; + } + return false; +} + + int ICCompareStub::MinorKey() { return OpField::encode(op_ - Token::EQ) | StateField::encode(state_); } @@ -184,6 +219,10 @@ void ICCompareStub::Generate(MacroAssembler* masm) { case CompareIC::OBJECTS: GenerateObjects(masm); break; + case CompareIC::KNOWN_OBJECTS: + ASSERT(*known_map_ != NULL); + GenerateKnownObjects(masm); + break; default: UNREACHABLE(); } |
