| Index: src/ic.cc
|
| diff --git a/src/ic.cc b/src/ic.cc
|
| index d1d390e617152aa224380d2a6611dfd77f388a50..7033759b1b5b2f5f37198dd74abea871f50ce53c 100644
|
| --- a/src/ic.cc
|
| +++ b/src/ic.cc
|
| @@ -960,7 +960,7 @@ static bool AddOneReceiverMapIfMissing(MapHandleList* receiver_maps,
|
| }
|
|
|
|
|
| -bool IC::UpdatePolymorphicIC(Handle<Type> type,
|
| +bool IC::UpdatePolymorphicIC(Handle<HeapType> type,
|
| Handle<String> name,
|
| Handle<Code> code) {
|
| if (!code->is_handler()) return false;
|
| @@ -975,7 +975,7 @@ bool IC::UpdatePolymorphicIC(Handle<Type> type,
|
| number_of_valid_types = number_of_types;
|
|
|
| for (int i = 0; i < number_of_types; i++) {
|
| - Handle<Type> current_type = types.at(i);
|
| + Handle<HeapType> current_type = types.at(i);
|
| // Filter out deprecated maps to ensure their instances get migrated.
|
| if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) {
|
| number_of_valid_types--;
|
| @@ -1008,16 +1008,17 @@ bool IC::UpdatePolymorphicIC(Handle<Type> type,
|
| }
|
|
|
|
|
| -Handle<Type> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
|
| +Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
|
| return object->IsJSGlobalObject()
|
| - ? Type::Constant(Handle<JSGlobalObject>::cast(object), isolate)
|
| - : Type::OfCurrently(object, isolate);
|
| + ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate)
|
| + : HeapType::OfCurrently(object, 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();
|
| +Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) {
|
| + if (type->Is(HeapType::Number()))
|
| + return isolate->factory()->heap_number_map();
|
| + if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map();
|
| if (type->IsConstant()) {
|
| return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map());
|
| }
|
| @@ -1026,16 +1027,20 @@ Handle<Map> IC::TypeToMap(Type* type, Isolate* isolate) {
|
| }
|
|
|
|
|
| -Handle<Type> IC::MapToType(Handle<Map> map) {
|
| +Handle<HeapType> IC::MapToType(Handle<Map> map) {
|
| Isolate* isolate = map->GetIsolate();
|
| - if (map->instance_type() == HEAP_NUMBER_TYPE) return Type::Number(isolate);
|
| - // The only oddballs that can be recorded in ICs are booleans.
|
| - if (map->instance_type() == ODDBALL_TYPE) return Type::Boolean(isolate);
|
| - return Type::Class(map, isolate);
|
| + if (map->instance_type() == HEAP_NUMBER_TYPE) {
|
| + return HeapType::Number(isolate);
|
| + } else if (map->instance_type() == ODDBALL_TYPE) {
|
| + // The only oddballs that can be recorded in ICs are booleans.
|
| + return HeapType::Boolean(isolate);
|
| + } else {
|
| + return HeapType::Class(map, isolate);
|
| + }
|
| }
|
|
|
|
|
| -void IC::UpdateMonomorphicIC(Handle<Type> type,
|
| +void IC::UpdateMonomorphicIC(Handle<HeapType> type,
|
| Handle<Code> handler,
|
| Handle<String> name) {
|
| if (!handler->is_handler()) return set_target(*handler);
|
| @@ -1056,7 +1061,7 @@ void IC::CopyICToMegamorphicCache(Handle<String> name) {
|
| }
|
|
|
|
|
| -bool IC::IsTransitionOfMonomorphicTarget(Handle<Type> type) {
|
| +bool IC::IsTransitionOfMonomorphicTarget(Handle<HeapType> type) {
|
| if (!type->IsClass()) return false;
|
| Map* receiver_map = *type->AsClass();
|
| Map* current_map = target()->FindFirstMap();
|
| @@ -1072,7 +1077,7 @@ bool IC::IsTransitionOfMonomorphicTarget(Handle<Type> type) {
|
| }
|
|
|
|
|
| -void IC::PatchCache(Handle<Type> type,
|
| +void IC::PatchCache(Handle<HeapType> type,
|
| Handle<String> name,
|
| Handle<Code> code) {
|
| switch (state()) {
|
| @@ -1138,7 +1143,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
|
| return;
|
| }
|
|
|
| - Handle<Type> type = CurrentTypeOf(object, isolate());
|
| + Handle<HeapType> type = CurrentTypeOf(object, isolate());
|
| Handle<Code> code;
|
| if (!lookup->IsCacheable()) {
|
| // Bail out if the result is not cacheable.
|
| @@ -1158,7 +1163,7 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
|
| }
|
|
|
|
|
| -void IC::UpdateMegamorphicCache(Type* type, Name* name, Code* code) {
|
| +void IC::UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {
|
| // Cache code holding map should be consistent with
|
| // GenerateMonomorphicCacheProbe.
|
| Map* map = *TypeToMap(type, isolate());
|
| @@ -1199,7 +1204,7 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
|
| return SimpleFieldLoad(length_index);
|
| }
|
|
|
| - Handle<Type> type = CurrentTypeOf(object, isolate());
|
| + Handle<HeapType> type = CurrentTypeOf(object, isolate());
|
| Handle<JSObject> holder(lookup->holder());
|
| LoadStubCompiler compiler(isolate(), kNoExtraICState, cache_holder, kind());
|
|
|
| @@ -1645,7 +1650,7 @@ Handle<Code> StoreIC::CompileHandler(LookupResult* lookup,
|
| // global object.
|
| Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
|
| Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate());
|
| - Handle<Type> union_type = PropertyCell::UpdatedType(cell, value);
|
| + Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value);
|
| StoreGlobalStub stub(union_type->IsConstant());
|
|
|
| Handle<Code> code = stub.GetCodeCopyFromTemplate(
|
| @@ -2578,17 +2583,17 @@ void BinaryOpIC::State::GenerateAheadOfTime(
|
| }
|
|
|
|
|
| -Handle<Type> BinaryOpIC::State::GetResultType(Isolate* isolate) const {
|
| +Type* BinaryOpIC::State::GetResultType(Zone* zone) const {
|
| Kind result_kind = result_kind_;
|
| if (HasSideEffects()) {
|
| result_kind = NONE;
|
| } else if (result_kind == GENERIC && op_ == Token::ADD) {
|
| - return Type::Union(Type::Number(isolate), Type::String(isolate), isolate);
|
| + return Type::Union(Type::Number(zone), Type::String(zone), zone);
|
| } else if (result_kind == NUMBER && op_ == Token::SHR) {
|
| - return Type::Unsigned32(isolate);
|
| + return Type::Unsigned32(zone);
|
| }
|
| ASSERT_NE(GENERIC, result_kind);
|
| - return KindToType(result_kind, isolate);
|
| + return KindToType(result_kind, zone);
|
| }
|
|
|
|
|
| @@ -2706,17 +2711,17 @@ const char* BinaryOpIC::State::KindToString(Kind kind) {
|
|
|
|
|
| // static
|
| -Handle<Type> BinaryOpIC::State::KindToType(Kind kind, Isolate* isolate) {
|
| +Type* BinaryOpIC::State::KindToType(Kind kind, Zone* zone) {
|
| switch (kind) {
|
| - case NONE: return Type::None(isolate);
|
| - case SMI: return Type::Smi(isolate);
|
| - case INT32: return Type::Signed32(isolate);
|
| - case NUMBER: return Type::Number(isolate);
|
| - case STRING: return Type::String(isolate);
|
| - case GENERIC: return Type::Any(isolate);
|
| + case NONE: return Type::None(zone);
|
| + case SMI: return Type::Smi(zone);
|
| + case INT32: return Type::Signed32(zone);
|
| + case NUMBER: return Type::Number(zone);
|
| + case STRING: return Type::String(zone);
|
| + case GENERIC: return Type::Any(zone);
|
| }
|
| UNREACHABLE();
|
| - return Handle<Type>();
|
| + return NULL;
|
| }
|
|
|
|
|
| @@ -2806,41 +2811,39 @@ const char* CompareIC::GetStateName(State state) {
|
| }
|
|
|
|
|
| -Handle<Type> CompareIC::StateToType(
|
| - Isolate* isolate,
|
| +Type* CompareIC::StateToType(
|
| + Zone* zone,
|
| CompareIC::State state,
|
| Handle<Map> map) {
|
| switch (state) {
|
| - case CompareIC::UNINITIALIZED: return Type::None(isolate);
|
| - case CompareIC::SMI: return Type::Smi(isolate);
|
| - case CompareIC::NUMBER: return Type::Number(isolate);
|
| - case CompareIC::STRING: return Type::String(isolate);
|
| - case CompareIC::INTERNALIZED_STRING:
|
| - return Type::InternalizedString(isolate);
|
| - case CompareIC::UNIQUE_NAME: return Type::UniqueName(isolate);
|
| - case CompareIC::OBJECT: return Type::Receiver(isolate);
|
| + case CompareIC::UNINITIALIZED: return Type::None(zone);
|
| + case CompareIC::SMI: return Type::Smi(zone);
|
| + case CompareIC::NUMBER: return Type::Number(zone);
|
| + case CompareIC::STRING: return Type::String(zone);
|
| + case CompareIC::INTERNALIZED_STRING: return Type::InternalizedString(zone);
|
| + case CompareIC::UNIQUE_NAME: return Type::UniqueName(zone);
|
| + case CompareIC::OBJECT: return Type::Receiver(zone);
|
| case CompareIC::KNOWN_OBJECT:
|
| - return map.is_null()
|
| - ? Type::Receiver(isolate) : Type::Class(map, isolate);
|
| - case CompareIC::GENERIC: return Type::Any(isolate);
|
| + return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
|
| + case CompareIC::GENERIC: return Type::Any(zone);
|
| }
|
| UNREACHABLE();
|
| - return Handle<Type>();
|
| + return NULL;
|
| }
|
|
|
|
|
| void CompareIC::StubInfoToType(int stub_minor_key,
|
| - Handle<Type>* left_type,
|
| - Handle<Type>* right_type,
|
| - Handle<Type>* overall_type,
|
| + Type** left_type,
|
| + Type** right_type,
|
| + Type** overall_type,
|
| Handle<Map> map,
|
| - Isolate* isolate) {
|
| + Zone* zone) {
|
| State left_state, right_state, handler_state;
|
| ICCompareStub::DecodeMinorKey(stub_minor_key, &left_state, &right_state,
|
| &handler_state, NULL);
|
| - *left_type = StateToType(isolate, left_state);
|
| - *right_type = StateToType(isolate, right_state);
|
| - *overall_type = StateToType(isolate, handler_state, map);
|
| + *left_type = StateToType(zone, left_state);
|
| + *right_type = StateToType(zone, right_state);
|
| + *overall_type = StateToType(zone, handler_state, map);
|
| }
|
|
|
|
|
|
|