diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-12-14 15:02:32 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-12-14 15:02:32 -0800 |
commit | b3a7de15b7f06e11bd326b60b0e5ffd762ae71c5 (patch) | |
tree | 5bd6feac02a7c9eed1fbc03fc678e952ab3a852f /deps/v8/src/code-stubs.cc | |
parent | be23c51f6979ef5fd519069a62648d81f25b2ec0 (diff) | |
download | node-b3a7de15b7f06e11bd326b60b0e5ffd762ae71c5.tar.gz |
Upgrade V8 to 3.8.0
Diffstat (limited to 'deps/v8/src/code-stubs.cc')
-rw-r--r-- | deps/v8/src/code-stubs.cc | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/deps/v8/src/code-stubs.cc b/deps/v8/src/code-stubs.cc index ba7df802f..85410c3cc 100644 --- a/deps/v8/src/code-stubs.cc +++ b/deps/v8/src/code-stubs.cc @@ -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<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 +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(); } |