Handle retry-after-gc failures within KeyedLoadIC::Load and KeyedStoreIC::Store.
authorulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Apr 2013 08:14:59 +0000 (08:14 +0000)
committerulan@chromium.org <ulan@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Apr 2013 08:14:59 +0000 (08:14 +0000)
Returning retry-after-gc failure from these functions causes them to be
re-executed after ic state change, which breaks stub computation assumptions.

R=verwaest@chromium.org
BUG=222301
TEST=mjsunit/array-bounds-check-removal.js --gc_interval=10 in x64.debug

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14321 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap-inl.h
src/ic.cc
src/runtime.cc
src/runtime.h

index 28e50aa..43d4a99 100644 (file)
@@ -623,6 +623,13 @@ Isolate* Heap::isolate() {
   CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, return, return)
 
 
+#define CALL_HEAP_FUNCTION_PASS_EXCEPTION(ISOLATE, FUNCTION_CALL) \
+  CALL_AND_RETRY(ISOLATE,                                         \
+                 FUNCTION_CALL,                                   \
+                 return __object__,                               \
+                 return __maybe_object__)
+
+
 #ifdef DEBUG
 
 inline bool Heap::allow_allocation(bool new_state) {
index 3c33e4f..78fb297 100644 (file)
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1384,7 +1384,7 @@ MaybeObject* KeyedLoadIC::Load(State state,
   }
 
 
-  return Runtime::GetObjectProperty(isolate(), object, key);
+  return Runtime::GetObjectPropertyOrFail(isolate(), object, key);
 }
 
 
@@ -1972,7 +1972,7 @@ MaybeObject* KeyedStoreIC::Store(State state,
     TRACE_IC("KeyedStoreIC", key, state, target());
   }
 
-  return Runtime::SetObjectProperty(
+  return Runtime::SetObjectPropertyOrFail(
       isolate(), object , key, value, NONE, strict_mode);
 }
 
index 3fd5f6d..6261c12 100644 (file)
@@ -4094,6 +4094,13 @@ MaybeObject* Runtime::HasObjectProperty(Isolate* isolate,
   return isolate->heap()->ToBoolean(object->HasProperty(*name));
 }
 
+MaybeObject* Runtime::GetObjectPropertyOrFail(
+    Isolate* isolate,
+    Handle<Object> object,
+    Handle<Object> key) {
+  CALL_HEAP_FUNCTION_PASS_EXCEPTION(isolate,
+      GetObjectProperty(isolate, object, key));
+}
 
 MaybeObject* Runtime::GetObjectProperty(Isolate* isolate,
                                         Handle<Object> object,
@@ -4378,6 +4385,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) {
 }
 
 
+MaybeObject* Runtime::SetObjectPropertyOrFail(
+    Isolate* isolate,
+    Handle<Object> object,
+    Handle<Object> key,
+    Handle<Object> value,
+    PropertyAttributes attr,
+    StrictModeFlag strict_mode) {
+  CALL_HEAP_FUNCTION_PASS_EXCEPTION(isolate,
+      SetObjectProperty(isolate, object, key, value, attr, strict_mode));
+}
+
+
 MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
                                         Handle<Object> object,
                                         Handle<Object> key,
index cbf70e9..1413351 100644 (file)
@@ -702,6 +702,14 @@ class Runtime : public AllStatic {
       PropertyAttributes attr,
       StrictModeFlag strict_mode);
 
+  MUST_USE_RESULT static MaybeObject* SetObjectPropertyOrFail(
+      Isolate* isolate,
+      Handle<Object> object,
+      Handle<Object> key,
+      Handle<Object> value,
+      PropertyAttributes attr,
+      StrictModeFlag strict_mode);
+
   MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty(
       Isolate* isolate,
       Handle<JSObject> object,
@@ -725,6 +733,11 @@ class Runtime : public AllStatic {
       Handle<Object> object,
       Handle<Object> key);
 
+  MUST_USE_RESULT static MaybeObject* GetObjectPropertyOrFail(
+      Isolate* isolate,
+      Handle<Object> object,
+      Handle<Object> key);
+
   // Helper functions used stubs.
   static void PerformGC(Object* result);