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

Unified Diff: src/type-info.cc

Issue 136643008: A64: Synchronize with r18256. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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
« no previous file with comments | « src/type-info.h ('k') | src/typing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index 79134cabe38ed10ff6824551606277f076a63391..6e3a4f6b7a483bda6ebb38f08a62e59703060592 100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -197,30 +197,29 @@ bool TypeFeedbackOracle::StoreIsKeyedPolymorphic(TypeFeedbackId ast_id) {
}
-bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
- Handle<Object> value = GetInfo(expr->CallFeedbackId());
+bool TypeFeedbackOracle::CallIsMonomorphic(TypeFeedbackId id) {
+ Handle<Object> value = GetInfo(id);
return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() ||
value->IsSmi() ||
(value->IsCode() && Handle<Code>::cast(value)->ic_state() == MONOMORPHIC);
}
-bool TypeFeedbackOracle::KeyedArrayCallIsHoley(Call* expr) {
- Handle<Object> value = GetInfo(expr->CallFeedbackId());
+bool TypeFeedbackOracle::KeyedArrayCallIsHoley(TypeFeedbackId id) {
+ Handle<Object> value = GetInfo(id);
Handle<Code> code = Handle<Code>::cast(value);
return KeyedArrayCallStub::IsHoley(code);
}
-bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) {
- Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
+bool TypeFeedbackOracle::CallNewIsMonomorphic(TypeFeedbackId id) {
+ Handle<Object> info = GetInfo(id);
return info->IsAllocationSite() || info->IsJSFunction();
}
-bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(
- ObjectLiteral::Property* prop) {
- Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId());
+bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(TypeFeedbackId id) {
+ Handle<Object> map_or_code = GetInfo(id);
return map_or_code->IsMap();
}
@@ -285,22 +284,21 @@ void TypeFeedbackOracle::LoadReceiverTypes(TypeFeedbackId id,
}
-void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr,
+void TypeFeedbackOracle::StoreReceiverTypes(TypeFeedbackId id,
Handle<String> name,
SmallMapList* types) {
Code::Flags flags = Code::ComputeFlags(
Code::HANDLER, MONOMORPHIC, kNoExtraICState,
Code::NORMAL, Code::STORE_IC);
- CollectReceiverTypes(expr->AssignmentFeedbackId(), name, flags, types);
+ CollectReceiverTypes(id, name, flags, types);
}
-void TypeFeedbackOracle::CallReceiverTypes(Call* expr,
+void TypeFeedbackOracle::CallReceiverTypes(TypeFeedbackId id,
Handle<String> name,
+ int arity,
CallKind call_kind,
SmallMapList* types) {
- int arity = expr->arguments()->length();
-
// Note: Currently we do not take string extra ic data into account
// here.
ContextualMode contextual_mode = call_kind == CALL_AS_FUNCTION
@@ -311,12 +309,12 @@ void TypeFeedbackOracle::CallReceiverTypes(Call* expr,
Code::Flags flags = Code::ComputeMonomorphicFlags(
Code::CALL_IC, extra_ic_state, OWN_MAP, Code::NORMAL, arity);
- CollectReceiverTypes(expr->CallFeedbackId(), name, flags, types);
+ CollectReceiverTypes(id, name, flags, types);
}
-CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
- Handle<Object> value = GetInfo(expr->CallFeedbackId());
+CheckType TypeFeedbackOracle::GetCallCheckType(TypeFeedbackId id) {
+ Handle<Object> value = GetInfo(id);
if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
ASSERT(check != RECEIVER_MAP_CHECK);
@@ -324,8 +322,8 @@ CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) {
}
-Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) {
- Handle<Object> info = GetInfo(expr->CallFeedbackId());
+Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(TypeFeedbackId id) {
+ Handle<Object> info = GetInfo(id);
if (info->IsAllocationSite()) {
return Handle<JSFunction>(isolate_->global_context()->array_function());
} else {
@@ -334,8 +332,8 @@ Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) {
}
-Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) {
- Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
+Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(TypeFeedbackId id) {
+ Handle<Object> info = GetInfo(id);
if (info->IsAllocationSite()) {
return Handle<JSFunction>(isolate_->global_context()->array_function());
} else {
@@ -344,15 +342,15 @@ Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) {
}
-Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(CallNew* expr) {
- return GetInfoCell(expr->CallNewFeedbackId());
+Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(
+ TypeFeedbackId id) {
+ return GetInfoCell(id);
}
-Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(
- ObjectLiteral::Property* prop) {
- ASSERT(ObjectLiteralStoreIsMonomorphic(prop));
- return Handle<Map>::cast(GetInfo(prop->key()->LiteralFeedbackId()));
+Handle<Map> TypeFeedbackOracle::GetObjectLiteralStoreMap(TypeFeedbackId id) {
+ ASSERT(ObjectLiteralStoreIsMonomorphic(id));
+ return Handle<Map>::cast(GetInfo(id));
}
@@ -410,28 +408,26 @@ void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
Handle<Type>* right,
Handle<Type>* result,
Maybe<int>* fixed_right_arg,
- Token::Value operation) {
+ Token::Value op) {
Handle<Object> object = GetInfo(id);
if (!object->IsCode()) {
// For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
- // operations covered by the BinaryOpStub we should always have them.
- ASSERT(!(operation >= BinaryOpStub::FIRST_TOKEN &&
- operation <= BinaryOpStub::LAST_TOKEN));
+ // operations covered by the BinaryOpIC we should always have them.
+ ASSERT(op < BinaryOpIC::State::FIRST_TOKEN ||
+ op > BinaryOpIC::State::LAST_TOKEN);
*left = *right = *result = handle(Type::None(), isolate_);
+ *fixed_right_arg = Maybe<int>();
return;
}
Handle<Code> code = Handle<Code>::cast(object);
- ASSERT(code->is_binary_op_stub());
-
- BinaryOpStub stub(code->extended_extra_ic_state());
+ ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
+ BinaryOpIC::State state(code->extended_extra_ic_state());
+ ASSERT_EQ(op, state.op());
- // Sanity check.
- ASSERT(stub.operation() == operation);
-
- *left = stub.GetLeftType(isolate());
- *right = stub.GetRightType(isolate());
- *result = stub.GetResultType(isolate());
- *fixed_right_arg = stub.fixed_right_arg();
+ *left = state.GetLeftType(isolate());
+ *right = state.GetRightType(isolate());
+ *result = state.GetResultType(isolate());
+ *fixed_right_arg = state.fixed_right_arg();
}
@@ -449,13 +445,11 @@ Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) {
Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) {
Handle<Object> object = GetInfo(id);
- Handle<Type> unknown(Type::None(), isolate_);
- if (!object->IsCode()) return unknown;
+ if (!object->IsCode()) return handle(Type::None(), isolate_);
Handle<Code> code = Handle<Code>::cast(object);
- if (!code->is_binary_op_stub()) return unknown;
-
- BinaryOpStub stub(code->extended_extra_ic_state());
- return stub.GetLeftType(isolate());
+ ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
+ BinaryOpIC::State state(code->extended_extra_ic_state());
+ return state.GetLeftType(isolate());
}
@@ -486,6 +480,28 @@ void TypeFeedbackOracle::KeyedPropertyReceiverTypes(
}
+void TypeFeedbackOracle::AssignmentReceiverTypes(
+ TypeFeedbackId id, Handle<String> name, SmallMapList* receiver_types) {
+ receiver_types->Clear();
+ StoreReceiverTypes(id, name, receiver_types);
+}
+
+
+void TypeFeedbackOracle::KeyedAssignmentReceiverTypes(
+ TypeFeedbackId id, SmallMapList* receiver_types,
+ KeyedAccessStoreMode* store_mode) {
+ receiver_types->Clear();
+ if (StoreIsMonomorphicNormal(id)) {
+ // Record receiver type for monomorphic keyed stores.
+ receiver_types->Add(StoreMonomorphicReceiverType(id), zone());
+ } else if (StoreIsKeyedPolymorphic(id)) {
+ receiver_types->Reserve(kMaxKeyedPolymorphism, zone());
+ CollectKeyedReceiverTypes(id, receiver_types);
+ }
+ *store_mode = GetStoreMode(id);
+}
+
+
void TypeFeedbackOracle::CountReceiverTypes(
TypeFeedbackId id, SmallMapList* receiver_types) {
receiver_types->Clear();
@@ -522,11 +538,7 @@ void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id,
Handle<Object> object = GetInfo(ast_id);
if (object->IsUndefined() || object->IsSmi()) return;
- if (object.is_identical_to(isolate_->builtins()->StoreIC_GlobalProxy())) {
- // TODO(fschneider): We could collect the maps and signal that
- // we need a generic store (or load) here.
- ASSERT(Handle<Code>::cast(object)->ic_state() == GENERIC);
- } else if (object->IsMap()) {
+ if (object->IsMap()) {
types->AddMapIfMissing(Handle<Map>::cast(object), zone());
} else if (Handle<Code>::cast(object)->ic_state() == POLYMORPHIC ||
Handle<Code>::cast(object)->ic_state() == MONOMORPHIC) {
« no previous file with comments | « src/type-info.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698