diff options
Diffstat (limited to 'deps/v8/src/ic-inl.h')
-rw-r--r-- | deps/v8/src/ic-inl.h | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/deps/v8/src/ic-inl.h b/deps/v8/src/ic-inl.h index 06cbf2e112..e0f807ce4b 100644 --- a/deps/v8/src/ic-inl.h +++ b/deps/v8/src/ic-inl.h @@ -86,8 +86,8 @@ void IC::SetTargetAtAddress(Address address, Code* target) { // ICs as strict mode. The strict-ness of the IC must be preserved. if (old_target->kind() == Code::STORE_IC || old_target->kind() == Code::KEYED_STORE_IC) { - ASSERT(Code::GetStrictMode(old_target->extra_ic_state()) == - Code::GetStrictMode(target->extra_ic_state())); + ASSERT(StoreIC::GetStrictMode(old_target->extra_ic_state()) == + StoreIC::GetStrictMode(target->extra_ic_state())); } #endif Assembler::set_target_address_at(address, target->instruction_start()); @@ -100,8 +100,7 @@ void IC::SetTargetAtAddress(Address address, Code* target) { } -InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object, - JSObject* holder) { +InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object) { if (object->IsJSObject()) return OWN_MAP; // If the object is a value, we use the prototype map for the cache. @@ -111,13 +110,46 @@ InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object, } -JSObject* IC::GetCodeCacheHolder(Isolate* isolate, - Object* object, - InlineCacheHolderFlag holder) { - Object* map_owner = - holder == OWN_MAP ? object : object->GetPrototype(isolate); - ASSERT(map_owner->IsJSObject()); - return JSObject::cast(map_owner); +HeapObject* IC::GetCodeCacheHolder(Isolate* isolate, + Object* object, + InlineCacheHolderFlag holder) { + if (object->IsSmi()) holder = PROTOTYPE_MAP; + Object* map_owner = holder == OWN_MAP + ? object : object->GetPrototype(isolate); + return HeapObject::cast(map_owner); +} + + +InlineCacheHolderFlag IC::GetCodeCacheFlag(HeapType* type) { + if (type->Is(HeapType::Boolean()) || + type->Is(HeapType::Number()) || + type->Is(HeapType::String()) || + type->Is(HeapType::Symbol())) { + return PROTOTYPE_MAP; + } + return OWN_MAP; +} + + +Handle<Map> IC::GetCodeCacheHolder(InlineCacheHolderFlag flag, + HeapType* type, + Isolate* isolate) { + if (flag == PROTOTYPE_MAP) { + Context* context = isolate->context()->native_context(); + JSFunction* constructor; + if (type->Is(HeapType::Boolean())) { + constructor = context->boolean_function(); + } else if (type->Is(HeapType::Number())) { + constructor = context->number_function(); + } else if (type->Is(HeapType::String())) { + constructor = context->string_function(); + } else { + ASSERT(type->Is(HeapType::Symbol())); + constructor = context->symbol_function(); + } + return handle(JSObject::cast(constructor->instance_prototype())->map()); + } + return TypeToMap(type, isolate); } |