| Index: src/objects.cc
 | 
| ===================================================================
 | 
| --- src/objects.cc	(revision 7276)
 | 
| +++ src/objects.cc	(working copy)
 | 
| @@ -1438,13 +1438,19 @@
 | 
|  
 | 
|  MaybeObject* JSObject::AddProperty(String* name,
 | 
|                                     Object* value,
 | 
| -                                   PropertyAttributes attributes) {
 | 
| +                                   PropertyAttributes attributes,
 | 
| +                                   StrictModeFlag strict_mode) {
 | 
|    ASSERT(!IsJSGlobalProxy());
 | 
|    Heap* heap = GetHeap();
 | 
|    if (!map()->is_extensible()) {
 | 
| -    Handle<Object> args[1] = {Handle<String>(name)};
 | 
| -    return heap->isolate()->Throw(
 | 
| -        *FACTORY->NewTypeError("object_not_extensible", HandleVector(args, 1)));
 | 
| +    if (strict_mode == kNonStrictMode) {
 | 
| +      return heap->undefined_value();
 | 
| +    } else {
 | 
| +      Handle<Object> args[1] = {Handle<String>(name)};
 | 
| +      return heap->isolate()->Throw(
 | 
| +          *FACTORY->NewTypeError("object_not_extensible",
 | 
| +                                 HandleVector(args, 1)));
 | 
| +    }
 | 
|    }
 | 
|    if (HasFastProperties()) {
 | 
|      // Ensure the descriptor array does not get too big.
 | 
| @@ -1485,7 +1491,7 @@
 | 
|      return SetProperty(&result, name, value, attributes, strict_mode);
 | 
|    }
 | 
|    // Add a new real property.
 | 
| -  return AddProperty(name, value, attributes);
 | 
| +  return AddProperty(name, value, attributes, strict_mode);
 | 
|  }
 | 
|  
 | 
|  
 | 
| @@ -1989,7 +1995,7 @@
 | 
|    }
 | 
|    if (!result->IsFound()) {
 | 
|      // Neither properties nor transitions found.
 | 
| -    return AddProperty(name, value, attributes);
 | 
| +    return AddProperty(name, value, attributes, strict_mode);
 | 
|    }
 | 
|    if (result->IsReadOnly() && result->IsProperty()) {
 | 
|      if (strict_mode == kStrictMode) {
 | 
| @@ -2096,7 +2102,7 @@
 | 
|    // Check for accessor in prototype chain removed here in clone.
 | 
|    if (!result.IsFound()) {
 | 
|      // Neither properties nor transitions found.
 | 
| -    return AddProperty(name, value, attributes);
 | 
| +    return AddProperty(name, value, attributes, kNonStrictMode);
 | 
|    }
 | 
|  
 | 
|    PropertyDetails details = PropertyDetails(attributes, NORMAL);
 | 
| @@ -7347,13 +7353,17 @@
 | 
|          // When we set the is_extensible flag to false we always force
 | 
|          // the element into dictionary mode (and force them to stay there).
 | 
|          if (!map()->is_extensible()) {
 | 
| -          Handle<Object> number(isolate->factory()->NewNumberFromUint(index));
 | 
| -          Handle<String> index_string(
 | 
| -              isolate->factory()->NumberToString(number));
 | 
| -          Handle<Object> args[1] = { index_string };
 | 
| -          return isolate->Throw(
 | 
| -              *isolate->factory()->NewTypeError("object_not_extensible",
 | 
| -                                                HandleVector(args, 1)));
 | 
| +          if (strict_mode == kNonStrictMode) {
 | 
| +            return isolate->heap()->undefined_value();
 | 
| +          } else {
 | 
| +            Handle<Object> number(isolate->factory()->NewNumberFromUint(index));
 | 
| +            Handle<String> index_string(
 | 
| +                isolate->factory()->NumberToString(number));
 | 
| +            Handle<Object> args[1] = { index_string };
 | 
| +            return isolate->Throw(
 | 
| +                *isolate->factory()->NewTypeError("object_not_extensible",
 | 
| +                                                  HandleVector(args, 1)));
 | 
| +          }
 | 
|          }
 | 
|          Object* result;
 | 
|          { MaybeObject* maybe_result = dictionary->AtNumberPut(index, value);
 | 
| 
 |