From 5a215129365196e58d795b614becdc039a5637e9 Mon Sep 17 00:00:00 2001 From: "ulan@chromium.org" Date: Thu, 18 Apr 2013 08:14:59 +0000 Subject: [PATCH] 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 --- src/heap-inl.h | 7 +++++++ src/ic.cc | 4 ++-- src/runtime.cc | 19 +++++++++++++++++++ src/runtime.h | 13 +++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/heap-inl.h b/src/heap-inl.h index 28e50aa..43d4a99 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -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) { diff --git a/src/ic.cc b/src/ic.cc index 3c33e4f..78fb297 100644 --- 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); } diff --git a/src/runtime.cc b/src/runtime.cc index 3fd5f6d..6261c12 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -4094,6 +4094,13 @@ MaybeObject* Runtime::HasObjectProperty(Isolate* isolate, return isolate->heap()->ToBoolean(object->HasProperty(*name)); } +MaybeObject* Runtime::GetObjectPropertyOrFail( + Isolate* isolate, + Handle object, + Handle key) { + CALL_HEAP_FUNCTION_PASS_EXCEPTION(isolate, + GetObjectProperty(isolate, object, key)); +} MaybeObject* Runtime::GetObjectProperty(Isolate* isolate, Handle object, @@ -4378,6 +4385,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) { } +MaybeObject* Runtime::SetObjectPropertyOrFail( + Isolate* isolate, + Handle object, + Handle key, + Handle 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, Handle key, diff --git a/src/runtime.h b/src/runtime.h index cbf70e9..1413351 100644 --- a/src/runtime.h +++ b/src/runtime.h @@ -702,6 +702,14 @@ class Runtime : public AllStatic { PropertyAttributes attr, StrictModeFlag strict_mode); + MUST_USE_RESULT static MaybeObject* SetObjectPropertyOrFail( + Isolate* isolate, + Handle object, + Handle key, + Handle value, + PropertyAttributes attr, + StrictModeFlag strict_mode); + MUST_USE_RESULT static MaybeObject* ForceSetObjectProperty( Isolate* isolate, Handle object, @@ -725,6 +733,11 @@ class Runtime : public AllStatic { Handle object, Handle key); + MUST_USE_RESULT static MaybeObject* GetObjectPropertyOrFail( + Isolate* isolate, + Handle object, + Handle key); + // Helper functions used stubs. static void PerformGC(Object* result); -- 2.7.4