Chromium Code Reviews| Index: src/ic-inl.h |
| diff --git a/src/ic-inl.h b/src/ic-inl.h |
| index d1c31c0c8f3227e4afab1771daeed4ed7a803033..8f779b2c7b15ba4eee552c080b4278f7fc5e034d 100644 |
| --- a/src/ic-inl.h |
| +++ b/src/ic-inl.h |
| @@ -120,6 +120,37 @@ HeapObject* IC::GetCodeCacheHolder(Isolate* isolate, |
| } |
| +InlineCacheHolderFlag IC::GetCodeCacheFlag(Type* type) { |
| + if (type->Is(Type::Boolean())) return PROTOTYPE_MAP; |
|
rossberg
2013/11/18 17:02:06
Nit: why not use a disjunction?
|
| + if (type->Is(Type::Number())) return PROTOTYPE_MAP; |
| + if (type->Is(Type::String())) return PROTOTYPE_MAP; |
| + if (type->Is(Type::Symbol())) return PROTOTYPE_MAP; |
| + return OWN_MAP; |
| +} |
| + |
| + |
| +Handle<Map> IC::GetCodeCacheHolder(InlineCacheHolderFlag flag, |
| + Type* type, |
| + Isolate* isolate) { |
| + if (flag == PROTOTYPE_MAP) { |
| + Context* context = isolate->context()->native_context(); |
| + JSFunction* constructor; |
| + if (type->Is(Type::Boolean())) { |
| + constructor = context->boolean_function(); |
| + } else if (type->Is(Type::Number())) { |
| + constructor = context->number_function(); |
| + } else if (type->Is(Type::String())) { |
| + constructor = context->string_function(); |
| + } else { |
| + ASSERT(type->Is(Type::Symbol())); |
| + constructor = context->symbol_function(); |
| + } |
| + return handle(JSObject::cast(constructor->instance_prototype())->map()); |
| + } |
| + return type->AsClass(); |
| +} |
| + |
| + |
| } } // namespace v8::internal |
| #endif // V8_IC_INL_H_ |