Handle retry-after-gc failures within KeyedLoadIC::Load and KeyedStoreIC::Store.

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
This commit is contained in:
ulan@chromium.org 2013-04-18 08:14:59 +00:00
parent 3e31a67bf8
commit 5a21512936
4 changed files with 41 additions and 2 deletions

View File

@ -623,6 +623,13 @@ Isolate* Heap::isolate() {
CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, return, return) 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 #ifdef DEBUG
inline bool Heap::allow_allocation(bool new_state) { inline bool Heap::allow_allocation(bool new_state) {

View File

@ -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()); TRACE_IC("KeyedStoreIC", key, state, target());
} }
return Runtime::SetObjectProperty( return Runtime::SetObjectPropertyOrFail(
isolate(), object , key, value, NONE, strict_mode); isolate(), object , key, value, NONE, strict_mode);
} }

View File

@ -4094,6 +4094,13 @@ MaybeObject* Runtime::HasObjectProperty(Isolate* isolate,
return isolate->heap()->ToBoolean(object->HasProperty(*name)); 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, MaybeObject* Runtime::GetObjectProperty(Isolate* isolate,
Handle<Object> object, 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, MaybeObject* Runtime::SetObjectProperty(Isolate* isolate,
Handle<Object> object, Handle<Object> object,
Handle<Object> key, Handle<Object> key,

View File

@ -702,6 +702,14 @@ class Runtime : public AllStatic {
PropertyAttributes attr, PropertyAttributes attr,
StrictModeFlag strict_mode); 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( MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty(
Isolate* isolate, Isolate* isolate,
Handle<JSObject> object, Handle<JSObject> object,
@ -725,6 +733,11 @@ class Runtime : public AllStatic {
Handle<Object> object, Handle<Object> object,
Handle<Object> key); Handle<Object> key);
MUST_USE_RESULT static MaybeObject* GetObjectPropertyOrFail(
Isolate* isolate,
Handle<Object> object,
Handle<Object> key);
// Helper functions used stubs. // Helper functions used stubs.
static void PerformGC(Object* result); static void PerformGC(Object* result);