Try to work around http://crbug.com/16276 until we can

find the cause of the problem.
Review URL: http://codereview.chromium.org/149521

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2431 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2009-07-13 08:31:30 +00:00
parent 55050383e1
commit e0c01db960

View File

@ -38,6 +38,17 @@
namespace v8 {
namespace internal {
// Temporary helper for working around http://crbug.com/16276. If we
// allow 'the hole value' to leak into the IC code, it may lead to
// crashes, but this should not happen and we should track down the
// cause of it.
static inline Handle<Object> UnholeForBug16276(Handle<Object> object) {
if (!object->IsTheHole()) return object;
ASSERT(false); // This should not happen.
return Factory::undefined_value();
}
#ifdef DEBUG
static char TransitionMarkFromState(IC::State state) {
switch (state) {
@ -321,19 +332,19 @@ Object* CallIC::TryCallAsFunction(Object* object) {
Object* CallIC::LoadFunction(State state,
Handle<Object> object,
Handle<String> name) {
object = UnholeForBug16276(object);
// If the object is undefined or null it's illegal to try to get any
// of its properties; throw a TypeError in that case.
if (object->IsUndefined() || object->IsNull()) {
return TypeError("non_object_property_call", object, name);
}
Object* result = Heap::the_hole_value();
// Check if the name is trivially convertible to an index and get
// the element if so.
uint32_t index;
if (name->AsArrayIndex(&index)) {
result = object->GetElement(index);
Object* result = object->GetElement(index);
if (result->IsJSFunction()) return result;
// Try to find a suitable function delegate for the object at hand.
@ -363,7 +374,7 @@ Object* CallIC::LoadFunction(State state,
// Get the property.
PropertyAttributes attr;
result = object->GetProperty(*object, &lookup, *name, &attr);
Object* result = object->GetProperty(*object, &lookup, *name, &attr);
if (result->IsFailure()) return result;
if (lookup.type() == INTERCEPTOR) {
// If the object does not have the requested property, check which
@ -376,7 +387,7 @@ Object* CallIC::LoadFunction(State state,
}
}
ASSERT(result != Heap::the_hole_value());
ASSERT(!result->IsTheHole());
if (result->IsJSFunction()) {
// Check if there is an optimized (builtin) version of the function.
@ -507,6 +518,8 @@ void CallIC::UpdateCaches(LookupResult* lookup,
Object* LoadIC::Load(State state, Handle<Object> object, Handle<String> name) {
object = UnholeForBug16276(object);
// If the object is undefined or null it's illegal to try to get any
// of its properties; throw a TypeError in that case.
if (object->IsUndefined() || object->IsNull()) {
@ -719,6 +732,8 @@ void LoadIC::UpdateCaches(LookupResult* lookup,
Object* KeyedLoadIC::Load(State state,
Handle<Object> object,
Handle<Object> key) {
object = UnholeForBug16276(object);
if (key->IsSymbol()) {
Handle<String> name = Handle<String>::cast(key);
@ -944,6 +959,8 @@ Object* StoreIC::Store(State state,
Handle<Object> object,
Handle<String> name,
Handle<Object> value) {
object = UnholeForBug16276(object);
// If the object is undefined or null it's illegal to try to set any
// properties on it; throw a TypeError in that case.
if (object->IsUndefined() || object->IsNull()) {
@ -1062,11 +1079,13 @@ Object* KeyedStoreIC::Store(State state,
Handle<Object> object,
Handle<Object> key,
Handle<Object> value) {
object = UnholeForBug16276(object);
if (key->IsSymbol()) {
Handle<String> name = Handle<String>::cast(key);
// If the object is undefined or null it's illegal to try to set any
// properties on it; throw a TypeError in that case.
// If the object is undefined or null it's illegal to try to set
// any properties on it; throw a TypeError in that case.
if (object->IsUndefined() || object->IsNull()) {
return TypeError("non_object_property_store", object, name);
}