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

Unified Diff: src/ic.cc

Issue 61773004: Remove DisallowHeapAllocation requirement now that the target() is cached on the IC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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 193ec1603e4024ee5f0dce3b23411c952728e378..c15ccb1012f50dff9800781b909223dea675e40a 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -270,8 +270,6 @@ bool CallIC::TryUpdateExtraICState(LookupResult* lookup,
bool IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
Handle<String> name) {
- DisallowHeapAllocation no_gc;
-
if (target()->is_call_stub()) {
LookupResult lookup(isolate());
LookupForRead(receiver, name, &lookup);
@@ -961,32 +959,30 @@ bool IC::UpdatePolymorphicIC(Handle<HeapObject> receiver,
int number_of_valid_maps;
int handler_to_overwrite = -1;
Handle<Map> new_receiver_map(receiver->map());
- {
- DisallowHeapAllocation no_gc;
- target()->FindAllMaps(&receiver_maps);
- int number_of_maps = receiver_maps.length();
- number_of_valid_maps = number_of_maps;
-
- for (int i = 0; i < number_of_maps; i++) {
- Handle<Map> map = receiver_maps.at(i);
- // Filter out deprecated maps to ensure its instances get migrated.
- if (map->is_deprecated()) {
- number_of_valid_maps--;
- // If the receiver map is already in the polymorphic IC, this indicates
- // there was a prototoype chain failure. In that case, just overwrite the
- // handler.
- } else if (map.is_identical_to(new_receiver_map)) {
- number_of_valid_maps--;
- handler_to_overwrite = i;
- }
+
+ target()->FindAllMaps(&receiver_maps);
+ int number_of_maps = receiver_maps.length();
+ number_of_valid_maps = number_of_maps;
+
+ for (int i = 0; i < number_of_maps; i++) {
+ Handle<Map> map = receiver_maps.at(i);
+ // Filter out deprecated maps to ensure its instances get migrated.
+ if (map->is_deprecated()) {
+ number_of_valid_maps--;
+ // If the receiver map is already in the polymorphic IC, this indicates
+ // there was a prototoype chain failure. In that case, just overwrite the
+ // handler.
+ } else if (map.is_identical_to(new_receiver_map)) {
+ number_of_valid_maps--;
+ handler_to_overwrite = i;
}
+ }
- if (number_of_valid_maps >= 4) return false;
- if (number_of_maps == 0) return false;
+ if (number_of_valid_maps >= 4) return false;
+ if (number_of_maps == 0) return false;
- if (!target()->FindHandlers(&handlers, receiver_maps.length())) {
- return false;
- }
+ if (!target()->FindHandlers(&handlers, receiver_maps.length())) {
+ return false;
}
number_of_valid_maps++;
@@ -1017,11 +1013,8 @@ void IC::UpdateMonomorphicIC(Handle<HeapObject> receiver,
void IC::CopyICToMegamorphicCache(Handle<String> name) {
MapHandleList receiver_maps;
CodeHandleList handlers;
- {
- DisallowHeapAllocation no_gc;
- target()->FindAllMaps(&receiver_maps);
- if (!target()->FindHandlers(&handlers, receiver_maps.length())) return;
- }
+ target()->FindAllMaps(&receiver_maps);
+ if (!target()->FindHandlers(&handlers, receiver_maps.length())) return;
for (int i = 0; i < receiver_maps.length(); i++) {
UpdateMegamorphicCache(*receiver_maps.at(i), *name, *handlers.at(i));
}
@@ -1029,8 +1022,6 @@ void IC::CopyICToMegamorphicCache(Handle<String> name) {
bool IC::IsTransitionedMapOfMonomorphicTarget(Map* receiver_map) {
- DisallowHeapAllocation no_allocation;
-
Map* current_map = target()->FindFirstMap();
ElementsKind receiver_elements_kind = receiver_map->elements_kind();
bool more_general_transition =
@@ -1061,43 +1052,26 @@ void IC::PatchCache(Handle<HeapObject> receiver,
!target().is_identical_to(code));
if (!target()->is_keyed_stub()) {
bool is_same_handler = false;
- {
- DisallowHeapAllocation no_allocation;
- Code* old_handler = target()->FindFirstHandler();
- is_same_handler = old_handler == *code;
- }
- if (is_same_handler
- && IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
+ Code* old_handler = target()->FindFirstHandler();
+ is_same_handler = old_handler == *code;
+
+ if (is_same_handler &&
+ IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
UpdateMonomorphicIC(receiver, code, name);
break;
}
- if (UpdatePolymorphicIC(receiver, name, code)) {
- break;
- }
-
+ }
+ // Fall through.
+ case POLYMORPHIC:
+ if (!target()->is_keyed_stub()) {
+ if (UpdatePolymorphicIC(receiver, name, code)) break;
CopyICToMegamorphicCache(name);
}
-
- UpdateMegamorphicCache(receiver->map(), *name, *code);
set_target(*megamorphic_stub());
- break;
+ // Fall through.
case MEGAMORPHIC:
UpdateMegamorphicCache(receiver->map(), *name, *code);
break;
- case POLYMORPHIC:
- if (target()->is_keyed_stub()) {
- // When trying to patch a polymorphic keyed stub with anything other
- // than another polymorphic stub, go generic.
- set_target(*generic_stub());
- } else {
- if (UpdatePolymorphicIC(receiver, name, code)) {
- break;
- }
- CopyICToMegamorphicCache(name);
- UpdateMegamorphicCache(receiver->map(), *name, *code);
- set_target(*megamorphic_stub());
- }
- break;
case DEBUG_STUB:
break;
case GENERIC:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698