| Index: src/ic.cc
|
| ===================================================================
|
| --- src/ic.cc (revision 5559)
|
| +++ src/ic.cc (working copy)
|
| @@ -519,9 +519,11 @@
|
| }
|
|
|
| // Get the property.
|
| + Object* result;
|
| + { TryAllocation t = object->GetProperty(*object, &lookup, *name, &attr);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
| PropertyAttributes 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
|
| // exception we need to throw.
|
| @@ -867,9 +869,11 @@
|
|
|
| PropertyAttributes attr;
|
| if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
|
| + Object* result;
|
| + { TryAllocation t = object->GetProperty(*object, &lookup, *name, &attr);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
| // Get the property.
|
| - Object* result = object->GetProperty(*object, &lookup, *name, &attr);
|
| - if (result->IsFailure()) return result;
|
| // If the property is not present, check if we need to throw an
|
| // exception.
|
| if (attr == ABSENT && IsContextual(object)) {
|
| @@ -1003,9 +1007,11 @@
|
| // Use specialized code for getting the length of strings.
|
| if (object->IsString() && name->Equals(Heap::length_symbol())) {
|
| Handle<String> string = Handle<String>::cast(object);
|
| + { TryAllocation t =
|
| + StubCache::ComputeKeyedLoadStringLength(*name, *string);
|
| + if (!t->ToObject(&code)) return t;
|
| + }
|
| Object* code = NULL;
|
| - code = StubCache::ComputeKeyedLoadStringLength(*name, *string);
|
| - if (code->IsFailure()) return code;
|
| set_target(Code::cast(code));
|
| #ifdef DEBUG
|
| TraceIC("KeyedLoadIC", name, state, target());
|
| @@ -1015,9 +1021,12 @@
|
|
|
| // Use specialized code for getting the length of arrays.
|
| if (object->IsJSArray() && name->Equals(Heap::length_symbol())) {
|
| + Object* code;
|
| + { TryAllocation t =
|
| + StubCache::ComputeKeyedLoadArrayLength(*name, *array);
|
| + if (!t->ToObject(&code)) return t;
|
| + }
|
| Handle<JSArray> array = Handle<JSArray>::cast(object);
|
| - Object* code = StubCache::ComputeKeyedLoadArrayLength(*name, *array);
|
| - if (code->IsFailure()) return code;
|
| set_target(Code::cast(code));
|
| #ifdef DEBUG
|
| TraceIC("KeyedLoadIC", name, state, target());
|
| @@ -1029,9 +1038,11 @@
|
| if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol()) &&
|
| JSFunction::cast(*object)->should_have_prototype()) {
|
| Handle<JSFunction> function = Handle<JSFunction>::cast(object);
|
| - Object* code =
|
| - StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function);
|
| - if (code->IsFailure()) return code;
|
| + Object* code;
|
| + { TryAllocation t =
|
| + StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function);
|
| + if (!t->ToObject(&code)) return t;
|
| + }
|
| set_target(Code::cast(code));
|
| #ifdef DEBUG
|
| TraceIC("KeyedLoadIC", name, state, target());
|
| @@ -1067,9 +1078,11 @@
|
|
|
| PropertyAttributes attr;
|
| if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) {
|
| + Object* result;
|
| + { TryAllocation t = object->GetProperty(*object, &lookup, *name, &attr);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
| // Get the property.
|
| - Object* result = object->GetProperty(*object, &lookup, *name, &attr);
|
| - if (result->IsFailure()) return result;
|
| // If the property is not present, check if we need to throw an
|
| // exception.
|
| if (attr == ABSENT && IsContextual(object)) {
|
| @@ -1631,9 +1644,11 @@
|
| ASSERT(args.length() == 2);
|
| JSObject* receiver = JSObject::cast(args[0]);
|
| Object* len = args[1];
|
| + Object* result;
|
| + { TryAllocation t = receiver->SetElementsLength(len);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
|
|
| - Object* result = receiver->SetElementsLength(len);
|
| - if (result->IsFailure()) return result;
|
| return len;
|
| }
|
|
|
| @@ -1657,9 +1672,11 @@
|
| // Expand the properties array.
|
| FixedArray* old_storage = object->properties();
|
| int new_unused = transition->unused_property_fields();
|
| + Object* result;
|
| + { TryAllocation t = old_storage->CopySize(new_size);
|
| + if (!t->ToObject(&result)) return t;
|
| + }
|
| int new_size = old_storage->length() + new_unused + 1;
|
| - Object* result = old_storage->CopySize(new_size);
|
| - if (result->IsFailure()) return result;
|
| FixedArray* new_storage = FixedArray::cast(result);
|
| new_storage->set(old_storage->length(), value);
|
|
|
|
|