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

Unified Diff: src/ic.cc

Issue 25263002: Encapsulate extra_ic_state in CallICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/ic.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index e7a8eaa8491f2a17cdcbced3a294e7a2def2d956..f74a9a8ea6b4f16129696f95b536a49f1d531d71 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -539,8 +539,7 @@ void CallICBase::ReceiverToObjectIfRequired(Handle<Object> callee,
}
-MaybeObject* CallICBase::LoadFunction(Code::ExtraICState extra_ic_state,
- Handle<Object> object,
+MaybeObject* CallICBase::LoadFunction(Handle<Object> object,
Handle<String> name) {
bool use_ic = FLAG_use_ic;
if (object->IsJSObject()) {
@@ -585,7 +584,7 @@ MaybeObject* CallICBase::LoadFunction(Code::ExtraICState extra_ic_state,
}
// Lookup is valid: Update inline cache and stub cache.
- if (use_ic) UpdateCaches(&lookup, extra_ic_state, object, name);
+ if (use_ic) UpdateCaches(&lookup, object, name);
// Get the property.
PropertyAttributes attr;
@@ -630,10 +629,8 @@ MaybeObject* CallICBase::LoadFunction(Code::ExtraICState extra_ic_state,
}
-bool CallICBase::TryUpdateExtraICState(LookupResult* lookup,
- Handle<Object> object,
- Code::ExtraICState* extra_ic_state) {
- ASSERT(kind_ == Code::CALL_IC);
+bool CallIC::TryUpdateExtraICState(LookupResult* lookup,
+ Handle<Object> object) {
if (!lookup->IsConstantFunction()) return false;
JSFunction* function = lookup->GetConstantFunction();
if (!function->shared()->HasBuiltinFunctionId()) return false;
@@ -655,12 +652,12 @@ bool CallICBase::TryUpdateExtraICState(LookupResult* lookup,
ASSERT(string == args[0] || string == JSValue::cast(args[0])->value());
// If we're in the default (fastest) state and the index is
// out of bounds, update the state to record this fact.
- if (StringStubState::decode(*extra_ic_state) == DEFAULT_STRING_STUB &&
+ if (StringStubState::decode(extra_ic_state()) == DEFAULT_STRING_STUB &&
argc >= 1 && args[1]->IsNumber()) {
double index = DoubleToInteger(args.number_at(1));
if (index < 0 || index >= string->length()) {
- *extra_ic_state =
- StringStubState::update(*extra_ic_state,
+ extra_ic_state_ =
+ StringStubState::update(extra_ic_state(),
STRING_INDEX_OUT_OF_BOUNDS);
return true;
}
@@ -730,7 +727,6 @@ Handle<Code> CallICBase::ComputeMonomorphicStub(LookupResult* lookup,
void CallICBase::UpdateCaches(LookupResult* lookup,
- Code::ExtraICState extra_ic_state,
Handle<Object> object,
Handle<String> name) {
// Bail out if we didn't find a result.
@@ -744,20 +740,20 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
// Set the target to the pre monomorphic stub to delay
// setting the monomorphic state.
code = isolate()->stub_cache()->ComputeCallPreMonomorphic(
- argc, kind_, extra_ic_state);
+ argc, kind_, extra_ic_state());
} else if (state() == MONOMORPHIC) {
if (kind_ == Code::CALL_IC &&
- TryUpdateExtraICState(lookup, object, &extra_ic_state)) {
- code = ComputeMonomorphicStub(lookup, extra_ic_state, object, name);
+ static_cast<CallIC*>(this)->TryUpdateExtraICState(lookup, object)) {
+ code = ComputeMonomorphicStub(lookup, extra_ic_state(), object, name);
} else if (TryRemoveInvalidPrototypeDependentStub(*object, *name)) {
MarkMonomorphicPrototypeFailure();
- code = ComputeMonomorphicStub(lookup, extra_ic_state, object, name);
+ code = ComputeMonomorphicStub(lookup, extra_ic_state(), object, name);
} else {
code = isolate()->stub_cache()->ComputeCallMegamorphic(
- argc, kind_, extra_ic_state);
+ argc, kind_, extra_ic_state());
}
} else {
- code = ComputeMonomorphicStub(lookup, extra_ic_state, object, name);
+ code = ComputeMonomorphicStub(lookup, extra_ic_state(), object, name);
}
// If there's no appropriate stub we simply avoid updating the caches.
@@ -797,9 +793,7 @@ void CallICBase::UpdateCaches(LookupResult* lookup,
MaybeObject* KeyedCallIC::LoadFunction(Handle<Object> object,
Handle<Object> key) {
if (key->IsInternalizedString()) {
- return CallICBase::LoadFunction(Code::kNoExtraICState,
- object,
- Handle<String>::cast(key));
+ return CallICBase::LoadFunction(object, Handle<String>::cast(key));
}
bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
@@ -2114,9 +2108,7 @@ RUNTIME_FUNCTION(MaybeObject*, CallIC_Miss) {
ASSERT(args.length() == 2);
CallIC ic(isolate);
ic.UpdateState(args[0], args[1]);
- Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
- MaybeObject* maybe_result = ic.LoadFunction(extra_ic_state,
- args.at<Object>(0),
+ MaybeObject* maybe_result = ic.LoadFunction(args.at<Object>(0),
args.at<String>(1));
JSFunction* raw_function;
if (!maybe_result->To(&raw_function)) return maybe_result;
@@ -2320,11 +2312,10 @@ RUNTIME_FUNCTION(MaybeObject*, StoreIC_Slow) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
StoreIC ic(IC::NO_EXTRA_FRAME, isolate);
- Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
Handle<Object> object = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
- StrictModeFlag strict_mode = Code::GetStrictMode(extra_ic_state);
+ StrictModeFlag strict_mode = ic.strict_mode();
return Runtime::SetObjectProperty(isolate,
object,
key,
@@ -2338,11 +2329,10 @@ RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_Slow) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate);
- Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
Handle<Object> object = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
- StrictModeFlag strict_mode = Code::GetStrictMode(extra_ic_state);
+ StrictModeFlag strict_mode = ic.strict_mode();
return Runtime::SetObjectProperty(isolate,
object,
key,
@@ -2368,11 +2358,10 @@ RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss) {
HandleScope scope(isolate);
ASSERT(args.length() == 4);
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate);
- Code::ExtraICState extra_ic_state = ic.target()->extra_ic_state();
Handle<Object> value = args.at<Object>(0);
Handle<Object> key = args.at<Object>(2);
Handle<Object> object = args.at<Object>(3);
- StrictModeFlag strict_mode = Code::GetStrictMode(extra_ic_state);
+ StrictModeFlag strict_mode = ic.strict_mode();
return Runtime::SetObjectProperty(isolate,
object,
key,
« no previous file with comments | « src/ic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698