Commit 016113d9 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use Type in CheckPrototypes.

R=ishell@chromium.org

Review URL: https://chromiumcodereview.appspot.com/78023002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18024 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 24814616
This diff is collapsed.
This diff is collapsed.
......@@ -149,7 +149,7 @@ Handle<Map> IC::GetCodeCacheHolder(InlineCacheHolderFlag flag,
}
return handle(JSObject::cast(constructor->instance_prototype())->map());
}
return type->AsClass();
return TypeToMap(type, isolate);
}
......
......@@ -783,7 +783,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
: Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate())),
isolate());
PatchCache(handle(Type::OfCurrently(cache_object), isolate()), name, code);
PatchCache(CurrentTypeOf(cache_object, isolate()), name, code);
TRACE_IC("CallIC", name);
}
......@@ -989,7 +989,7 @@ bool IC::UpdatePolymorphicIC(Handle<Type> type,
// If the receiver type is already in the polymorphic IC, this indicates
// there was a prototoype chain failure. In that case, just overwrite the
// handler.
} else if (type->Is(current_type)) {
} else if (type->IsCurrently(current_type)) {
ASSERT(handler_to_overwrite == -1);
number_of_valid_types--;
handler_to_overwrite = i;
......@@ -1015,9 +1015,20 @@ bool IC::UpdatePolymorphicIC(Handle<Type> type,
}
Handle<Type> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
Type* type = object->IsJSGlobalObject()
? Type::Constant(Handle<JSGlobalObject>::cast(object))
: Type::OfCurrently(object);
return handle(type, isolate);
}
Handle<Map> IC::TypeToMap(Type* type, Isolate* isolate) {
if (type->Is(Type::Number())) return isolate->factory()->heap_number_map();
if (type->Is(Type::Boolean())) return isolate->factory()->oddball_map();
if (type->IsConstant()) {
return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map());
}
ASSERT(type->IsClass());
return type->AsClass();
}
......@@ -1148,7 +1159,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
code = ComputeHandler(lookup, object, name);
}
PatchCache(handle(Type::OfCurrently(object), isolate()), name, code);
PatchCache(CurrentTypeOf(object, isolate()), name, code);
TRACE_IC("LoadIC", name);
}
......@@ -1609,7 +1620,7 @@ void StoreIC::UpdateCaches(LookupResult* lookup,
Handle<Code> code = ComputeHandler(lookup, receiver, name, value);
PatchCache(handle(Type::OfCurrently(receiver), isolate()), name, code);
PatchCache(CurrentTypeOf(receiver, isolate()), name, code);
TRACE_IC("StoreIC", name);
}
......
......@@ -165,6 +165,7 @@ class IC {
// - The oddball map is only used for booleans.
static Handle<Map> TypeToMap(Type* type, Isolate* isolate);
static Type* MapToType(Handle<Map> type);
static Handle<Type> CurrentTypeOf(Handle<Object> object, Isolate* isolate);
protected:
// Get the call-site target; used for determining the state.
......
......@@ -6198,6 +6198,16 @@ class Map: public HeapObject {
bool IsJSObjectMap() {
return instance_type() >= FIRST_JS_OBJECT_TYPE;
}
bool IsJSGlobalProxyMap() {
return instance_type() == JS_GLOBAL_PROXY_TYPE;
}
bool IsJSGlobalObjectMap() {
return instance_type() == JS_GLOBAL_OBJECT_TYPE;
}
bool IsGlobalObjectMap() {
const InstanceType type = instance_type();
return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE;
}
// Fires when the layout of an object with a leaf map changes.
// This includes adding transitions to the leaf map or changing
......
......@@ -1168,9 +1168,9 @@ Register LoadStubCompiler::HandlerFrontendHeader(
}
// Check that the maps starting from the prototype haven't changed.
return CheckPrototypes(receiver, object_reg, holder,
scratch1(), scratch2(), scratch3(),
name, miss, check_type);
return CheckPrototypes(
IC::CurrentTypeOf(receiver, isolate()), object_reg, holder,
scratch1(), scratch2(), scratch3(), name, miss, check_type);
}
......@@ -1182,9 +1182,9 @@ Register StoreStubCompiler::HandlerFrontendHeader(
Handle<JSObject> holder,
Handle<Name> name,
Label* miss) {
return CheckPrototypes(Handle<JSObject>::cast(object), object_reg, holder,
this->name(), scratch1(), scratch2(),
name, miss, SKIP_RECEIVER);
return CheckPrototypes(
IC::CurrentTypeOf(object, isolate()), object_reg, holder, this->name(),
scratch1(), scratch2(), name, miss, SKIP_RECEIVER);
}
......
......@@ -443,15 +443,6 @@ class StubCompiler BASE_EMBEDDED {
Register scratch,
Label* miss);
// Calls GenerateCheckPropertyCell for each global object in the prototype
// chain from object to (but not including) holder.
static void GenerateCheckPropertyCells(MacroAssembler* masm,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<Name> name,
Register scratch,
Label* miss);
static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name);
// Generates code that verifies that the property holder has not changed
......@@ -469,7 +460,7 @@ class StubCompiler BASE_EMBEDDED {
// The function can optionally (when save_at_depth !=
// kInvalidProtoDepth) save the object at the given depth by moving
// it to [esp + kPointerSize].
Register CheckPrototypes(Handle<JSObject> object,
Register CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
......@@ -478,11 +469,11 @@ class StubCompiler BASE_EMBEDDED {
Handle<Name> name,
Label* miss,
PrototypeCheckType check = CHECK_ALL_MAPS) {
return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1,
return CheckPrototypes(type, object_reg, holder, holder_reg, scratch1,
scratch2, name, kInvalidProtoDepth, miss, check);
}
Register CheckPrototypes(Handle<JSObject> object,
Register CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment