Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: src/ic-inl.h

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include/v8-platform.h ('K') | « src/ic.cc ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic-inl.h
diff --git a/src/ic-inl.h b/src/ic-inl.h
index 06cbf2e1128ff111b8affb358195568cb665425c..bd45c3e99d8a19a7778a6ef7439f4e4b18944ad9 100644
--- a/src/ic-inl.h
+++ b/src/ic-inl.h
@@ -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,
+HeapObject* 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);
+ if (object->IsSmi()) holder = PROTOTYPE_MAP;
+ Object* map_owner = holder == OWN_MAP
+ ? object : object->GetPrototype(isolate);
+ return HeapObject::cast(map_owner);
+}
+
+
+InlineCacheHolderFlag IC::GetCodeCacheFlag(Type* type) {
+ if (type->Is(Type::Boolean()) ||
+ type->Is(Type::Number()) ||
+ type->Is(Type::String()) ||
+ 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();
}
« include/v8-platform.h ('K') | « src/ic.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698