Chromium Code Reviews| Index: src/code-stubs.cc |
| =================================================================== |
| --- src/code-stubs.cc (revision 9957) |
| +++ src/code-stubs.cc (working copy) |
| @@ -101,7 +101,14 @@ |
| 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. |
| @@ -122,18 +129,21 @@ |
| FinishCode(*new_object); |
| // Update the dictionary and the root in Heap. |
|
Kevin Millikin (Chromium)
2011/12/08 13:38:15
Move this comment into the else branch.
Rico
2011/12/08 15:54:56
Done.
|
| - 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 { |
| + Handle<NumberDictionary> dict = |
| + factory->DictionaryAtNumberPut( |
| + Handle<NumberDictionary>(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 +169,21 @@ |
| } |
| +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) { |
| + return false; |
|
Kevin Millikin (Chromium)
2011/12/08 13:38:15
Why don't we look it up in the map?
Rico
2011/12/08 15:54:56
Done.
|
| +} |
| + |
| + |
| int ICCompareStub::MinorKey() { |
| return OpField::encode(op_ - Token::EQ) | StateField::encode(state_); |
| } |
| @@ -184,6 +209,10 @@ |
| case CompareIC::OBJECTS: |
| GenerateObjects(masm); |
| break; |
| + case CompareIC::KNOWN_OBJECTS: |
| + ASSERT(*known_map_ != NULL); |
| + GenerateKnownObjects(masm); |
| + break; |
| default: |
| UNREACHABLE(); |
| } |