| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return this_handle->GetPropertyWithReceiver(*receiver_handle, | 281 return this_handle->GetPropertyWithReceiver(*receiver_handle, |
| 282 *name_handle, | 282 *name_handle, |
| 283 attributes); | 283 attributes); |
| 284 } | 284 } |
| 285 | 285 |
| 286 | 286 |
| 287 Object* JSObject::SetLazyProperty(LookupResult* result, | 287 Object* JSObject::SetLazyProperty(LookupResult* result, |
| 288 String* name, | 288 String* name, |
| 289 Object* value, | 289 Object* value, |
| 290 PropertyAttributes attributes) { | 290 PropertyAttributes attributes) { |
| 291 ASSERT(!IsJSGlobalProxy()); |
| 291 HandleScope scope; | 292 HandleScope scope; |
| 292 Handle<JSObject> this_handle(this); | 293 Handle<JSObject> this_handle(this); |
| 293 Handle<String> name_handle(name); | 294 Handle<String> name_handle(name); |
| 294 Handle<Object> value_handle(value); | 295 Handle<Object> value_handle(value); |
| 295 bool pending_exception; | 296 bool pending_exception; |
| 296 LoadLazy(Handle<JSFunction>(JSFunction::cast(result->GetValue())), | 297 LoadLazy(Handle<JSFunction>(JSFunction::cast(result->GetValue())), |
| 297 &pending_exception); | 298 &pending_exception); |
| 298 if (pending_exception) return Failure::Exception(); | 299 if (pending_exception) return Failure::Exception(); |
| 299 return this_handle->SetProperty(*name_handle, *value_handle, attributes); | 300 return this_handle->SetProperty(*name_handle, *value_handle, attributes); |
| 300 } | 301 } |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 accumulator->Put('>'); | 630 accumulator->Put('>'); |
| 630 printed = true; | 631 printed = true; |
| 631 } | 632 } |
| 632 } | 633 } |
| 633 if (!printed) { | 634 if (!printed) { |
| 634 accumulator->Add("<JS Function>"); | 635 accumulator->Add("<JS Function>"); |
| 635 } | 636 } |
| 636 break; | 637 break; |
| 637 } | 638 } |
| 638 // All other JSObjects are rather similar to each other (JSObject, | 639 // All other JSObjects are rather similar to each other (JSObject, |
| 639 // JSGlobalObject, JSUndetectableObject, JSValue). | 640 // JSGlobalProxy, JSGlobalObject, JSUndetectableObject, JSValue). |
| 640 default: { | 641 default: { |
| 641 Object* constructor = map()->constructor(); | 642 Object* constructor = map()->constructor(); |
| 642 bool printed = false; | 643 bool printed = false; |
| 643 if (constructor->IsHeapObject() && | 644 if (constructor->IsHeapObject() && |
| 644 !Heap::Contains(HeapObject::cast(constructor))) { | 645 !Heap::Contains(HeapObject::cast(constructor))) { |
| 645 accumulator->Add("!!!INVALID CONSTRUCTOR!!!"); | 646 accumulator->Add("!!!INVALID CONSTRUCTOR!!!"); |
| 646 } else { | 647 } else { |
| 647 bool global_object = IsJSGlobalObject(); | 648 bool global_object = IsJSGlobalProxy(); |
| 648 if (constructor->IsJSFunction()) { | 649 if (constructor->IsJSFunction()) { |
| 649 if (!Heap::Contains(JSFunction::cast(constructor)->shared())) { | 650 if (!Heap::Contains(JSFunction::cast(constructor)->shared())) { |
| 650 accumulator->Add("!!!INVALID SHARED ON CONSTRUCTOR!!!"); | 651 accumulator->Add("!!!INVALID SHARED ON CONSTRUCTOR!!!"); |
| 651 } else { | 652 } else { |
| 652 Object* constructor_name = | 653 Object* constructor_name = |
| 653 JSFunction::cast(constructor)->shared()->name(); | 654 JSFunction::cast(constructor)->shared()->name(); |
| 654 if (constructor_name->IsString()) { | 655 if (constructor_name->IsString()) { |
| 655 String* str = String::cast(constructor_name); | 656 String* str = String::cast(constructor_name); |
| 656 if (str->length() > 0) { | 657 if (str->length() > 0) { |
| 657 bool vowel = AnWord(str); | 658 bool vowel = AnWord(str); |
| 658 accumulator->Add("<%sa%s ", | 659 accumulator->Add("<%sa%s ", |
| 659 global_object ? "JS Global Object: " : "", | 660 global_object ? "Global Object: " : "", |
| 660 vowel ? "n" : ""); | 661 vowel ? "n" : ""); |
| 661 accumulator->Put(str); | 662 accumulator->Put(str); |
| 662 accumulator->Put('>'); | 663 accumulator->Put('>'); |
| 663 printed = true; | 664 printed = true; |
| 664 } | 665 } |
| 665 } | 666 } |
| 666 } | 667 } |
| 667 } | 668 } |
| 668 if (!printed) { | 669 if (!printed) { |
| 669 accumulator->Add("<JS %sObject", global_object ? "Global " : ""); | 670 accumulator->Add("<JS %sObject", global_object ? "Global " : ""); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 814 |
| 814 switch (type) { | 815 switch (type) { |
| 815 case FIXED_ARRAY_TYPE: | 816 case FIXED_ARRAY_TYPE: |
| 816 reinterpret_cast<FixedArray*>(this)->FixedArrayIterateBody(v); | 817 reinterpret_cast<FixedArray*>(this)->FixedArrayIterateBody(v); |
| 817 break; | 818 break; |
| 818 case JS_OBJECT_TYPE: | 819 case JS_OBJECT_TYPE: |
| 819 case JS_VALUE_TYPE: | 820 case JS_VALUE_TYPE: |
| 820 case JS_ARRAY_TYPE: | 821 case JS_ARRAY_TYPE: |
| 821 case JS_REGEXP_TYPE: | 822 case JS_REGEXP_TYPE: |
| 822 case JS_FUNCTION_TYPE: | 823 case JS_FUNCTION_TYPE: |
| 824 case JS_GLOBAL_PROXY_TYPE: |
| 823 case JS_GLOBAL_OBJECT_TYPE: | 825 case JS_GLOBAL_OBJECT_TYPE: |
| 824 reinterpret_cast<JSObject*>(this)->JSObjectIterateBody(object_size, v); | |
| 825 break; | |
| 826 case JS_BUILTINS_OBJECT_TYPE: | 826 case JS_BUILTINS_OBJECT_TYPE: |
| 827 reinterpret_cast<JSObject*>(this)->JSObjectIterateBody(object_size, v); | 827 reinterpret_cast<JSObject*>(this)->JSObjectIterateBody(object_size, v); |
| 828 break; | 828 break; |
| 829 case ODDBALL_TYPE: | 829 case ODDBALL_TYPE: |
| 830 reinterpret_cast<Oddball*>(this)->OddballIterateBody(v); | 830 reinterpret_cast<Oddball*>(this)->OddballIterateBody(v); |
| 831 break; | 831 break; |
| 832 case PROXY_TYPE: | 832 case PROXY_TYPE: |
| 833 reinterpret_cast<Proxy*>(this)->ProxyIterateBody(v); | 833 reinterpret_cast<Proxy*>(this)->ProxyIterateBody(v); |
| 834 break; | 834 break; |
| 835 case MAP_TYPE: | 835 case MAP_TYPE: |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 if (property_dictionary() != result) { | 1078 if (property_dictionary() != result) { |
| 1079 set_properties(Dictionary::cast(result)); | 1079 set_properties(Dictionary::cast(result)); |
| 1080 } | 1080 } |
| 1081 return value; | 1081 return value; |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 | 1084 |
| 1085 Object* JSObject::AddProperty(String* name, | 1085 Object* JSObject::AddProperty(String* name, |
| 1086 Object* value, | 1086 Object* value, |
| 1087 PropertyAttributes attributes) { | 1087 PropertyAttributes attributes) { |
| 1088 ASSERT(!IsJSGlobalProxy()); |
| 1088 if (HasFastProperties()) { | 1089 if (HasFastProperties()) { |
| 1089 // Ensure the descriptor array does not get too big. | 1090 // Ensure the descriptor array does not get too big. |
| 1090 if (map()->instance_descriptors()->number_of_descriptors() < | 1091 if (map()->instance_descriptors()->number_of_descriptors() < |
| 1091 DescriptorArray::kMaxNumberOfDescriptors) { | 1092 DescriptorArray::kMaxNumberOfDescriptors) { |
| 1092 if (value->IsJSFunction()) { | 1093 if (value->IsJSFunction()) { |
| 1093 return AddConstantFunctionProperty(name, | 1094 return AddConstantFunctionProperty(name, |
| 1094 JSFunction::cast(value), | 1095 JSFunction::cast(value), |
| 1095 attributes); | 1096 attributes); |
| 1096 } else { | 1097 } else { |
| 1097 return AddFastProperty(name, value, attributes); | 1098 return AddFastProperty(name, value, attributes); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 if (number != DescriptorArray::kNotFound) { | 1362 if (number != DescriptorArray::kNotFound) { |
| 1362 result->DescriptorResult(this, descriptors->GetDetails(number), number); | 1363 result->DescriptorResult(this, descriptors->GetDetails(number), number); |
| 1363 } else { | 1364 } else { |
| 1364 result->NotFound(); | 1365 result->NotFound(); |
| 1365 } | 1366 } |
| 1366 } | 1367 } |
| 1367 | 1368 |
| 1368 | 1369 |
| 1369 void JSObject::LocalLookupRealNamedProperty(String* name, | 1370 void JSObject::LocalLookupRealNamedProperty(String* name, |
| 1370 LookupResult* result) { | 1371 LookupResult* result) { |
| 1372 if (IsJSGlobalProxy()) { |
| 1373 Object* proto = GetPrototype(); |
| 1374 if (proto->IsNull()) return result->NotFound(); |
| 1375 ASSERT(proto->IsJSGlobalObject()); |
| 1376 return JSObject::cast(proto)->LocalLookupRealNamedProperty(name, result); |
| 1377 } |
| 1378 |
| 1371 if (HasFastProperties()) { | 1379 if (HasFastProperties()) { |
| 1372 LookupInDescriptor(name, result); | 1380 LookupInDescriptor(name, result); |
| 1373 if (result->IsValid()) { | 1381 if (result->IsValid()) { |
| 1374 ASSERT(result->holder() == this && result->type() != NORMAL); | 1382 ASSERT(result->holder() == this && result->type() != NORMAL); |
| 1375 // Disallow caching for uninitialized constants. These can only | 1383 // Disallow caching for uninitialized constants. These can only |
| 1376 // occur as fields. | 1384 // occur as fields. |
| 1377 if (result->IsReadOnly() && result->type() == FIELD && | 1385 if (result->IsReadOnly() && result->type() == FIELD && |
| 1378 FastPropertyAt(result->GetFieldIndex())->IsTheHole()) { | 1386 FastPropertyAt(result->GetFieldIndex())->IsTheHole()) { |
| 1379 result->DisallowCaching(); | 1387 result->DisallowCaching(); |
| 1380 } | 1388 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 PropertyAttributes attributes) { | 1487 PropertyAttributes attributes) { |
| 1480 // Make sure that the top context does not change when doing callbacks or | 1488 // Make sure that the top context does not change when doing callbacks or |
| 1481 // interceptor calls. | 1489 // interceptor calls. |
| 1482 AssertNoContextChange ncc; | 1490 AssertNoContextChange ncc; |
| 1483 | 1491 |
| 1484 // Check access rights if needed. | 1492 // Check access rights if needed. |
| 1485 if (IsAccessCheckNeeded() | 1493 if (IsAccessCheckNeeded() |
| 1486 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { | 1494 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { |
| 1487 return SetPropertyWithFailedAccessCheck(result, name, value); | 1495 return SetPropertyWithFailedAccessCheck(result, name, value); |
| 1488 } | 1496 } |
| 1497 |
| 1498 if (IsJSGlobalProxy()) { |
| 1499 Object* proto = GetPrototype(); |
| 1500 if (proto->IsNull()) return value; |
| 1501 ASSERT(proto->IsJSGlobalObject()); |
| 1502 return JSObject::cast(proto)->SetProperty(result, name, value, attributes);
|
| 1503 } |
| 1504 |
| 1489 if (result->IsNotFound() || !result->IsProperty()) { | 1505 if (result->IsNotFound() || !result->IsProperty()) { |
| 1490 // We could not find a local property so let's check whether there is an | 1506 // We could not find a local property so let's check whether there is an |
| 1491 // accessor that wants to handle the property. | 1507 // accessor that wants to handle the property. |
| 1492 LookupResult accessor_result; | 1508 LookupResult accessor_result; |
| 1493 LookupCallbackSetterInPrototypes(name, &accessor_result); | 1509 LookupCallbackSetterInPrototypes(name, &accessor_result); |
| 1494 if (accessor_result.IsValid()) { | 1510 if (accessor_result.IsValid()) { |
| 1495 return SetPropertyWithCallback(accessor_result.GetCallbackObject(), | 1511 return SetPropertyWithCallback(accessor_result.GetCallbackObject(), |
| 1496 name, | 1512 name, |
| 1497 value, | 1513 value, |
| 1498 accessor_result.holder()); | 1514 accessor_result.holder()); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 ASSERT(result->IsBoolean()); | 1987 ASSERT(result->IsBoolean()); |
| 1972 return *v8::Utils::OpenHandle(*result); | 1988 return *v8::Utils::OpenHandle(*result); |
| 1973 } | 1989 } |
| 1974 Object* raw_result = this_handle->DeleteElementPostInterceptor(index); | 1990 Object* raw_result = this_handle->DeleteElementPostInterceptor(index); |
| 1975 RETURN_IF_SCHEDULED_EXCEPTION(); | 1991 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 1976 return raw_result; | 1992 return raw_result; |
| 1977 } | 1993 } |
| 1978 | 1994 |
| 1979 | 1995 |
| 1980 Object* JSObject::DeleteElement(uint32_t index) { | 1996 Object* JSObject::DeleteElement(uint32_t index) { |
| 1997 // Check access rights if needed. |
| 1998 if (IsAccessCheckNeeded() && |
| 1999 !Top::MayIndexedAccess(this, index, v8::ACCESS_DELETE)) { |
| 2000 Top::ReportFailedAccessCheck(this, v8::ACCESS_DELETE); |
| 2001 return Heap::false_value(); |
| 2002 } |
| 2003 |
| 2004 if (IsJSGlobalProxy()) { |
| 2005 Object* proto = GetPrototype(); |
| 2006 if (proto->IsNull()) return Heap::false_value(); |
| 2007 ASSERT(proto->IsJSGlobalObject()); |
| 2008 return JSGlobalObject::cast(proto)->DeleteElement(index); |
| 2009 } |
| 2010 |
| 1981 if (HasIndexedInterceptor()) { | 2011 if (HasIndexedInterceptor()) { |
| 1982 return DeleteElementWithInterceptor(index); | 2012 return DeleteElementWithInterceptor(index); |
| 1983 } | 2013 } |
| 1984 | 2014 |
| 1985 if (HasFastElements()) { | 2015 if (HasFastElements()) { |
| 1986 uint32_t length = IsJSArray() ? | 2016 uint32_t length = IsJSArray() ? |
| 1987 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : | 2017 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : |
| 1988 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 2018 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 1989 if (index < length) { | 2019 if (index < length) { |
| 1990 FixedArray::cast(elements())->set_the_hole(index); | 2020 FixedArray::cast(elements())->set_the_hole(index); |
| 1991 } | 2021 } |
| 1992 return Heap::true_value(); | 2022 return Heap::true_value(); |
| 1993 } else { | 2023 } else { |
| 1994 Dictionary* dictionary = element_dictionary(); | 2024 Dictionary* dictionary = element_dictionary(); |
| 1995 int entry = dictionary->FindNumberEntry(index); | 2025 int entry = dictionary->FindNumberEntry(index); |
| 1996 if (entry != -1) return dictionary->DeleteProperty(entry); | 2026 if (entry != -1) return dictionary->DeleteProperty(entry); |
| 1997 } | 2027 } |
| 1998 return Heap::true_value(); | 2028 return Heap::true_value(); |
| 1999 } | 2029 } |
| 2000 | 2030 |
| 2001 | 2031 |
| 2002 Object* JSObject::DeleteProperty(String* name) { | 2032 Object* JSObject::DeleteProperty(String* name) { |
| 2033 // ECMA-262, 3rd, 8.6.2.5 |
| 2034 ASSERT(name->IsString()); |
| 2035 |
| 2003 // Check access rights if needed. | 2036 // Check access rights if needed. |
| 2004 if (IsAccessCheckNeeded() && | 2037 if (IsAccessCheckNeeded() && |
| 2005 !Top::MayNamedAccess(this, name, v8::ACCESS_DELETE)) { | 2038 !Top::MayNamedAccess(this, name, v8::ACCESS_DELETE)) { |
| 2006 Top::ReportFailedAccessCheck(this, v8::ACCESS_DELETE); | 2039 Top::ReportFailedAccessCheck(this, v8::ACCESS_DELETE); |
| 2007 return Heap::false_value(); | 2040 return Heap::false_value(); |
| 2008 } | 2041 } |
| 2009 | 2042 |
| 2010 // ECMA-262, 3rd, 8.6.2.5 | 2043 if (IsJSGlobalProxy()) { |
| 2011 ASSERT(name->IsString()); | 2044 Object* proto = GetPrototype(); |
| 2045 if (proto->IsNull()) return Heap::false_value(); |
| 2046 ASSERT(proto->IsJSGlobalObject()); |
| 2047 return JSGlobalObject::cast(proto)->DeleteProperty(name); |
| 2048 } |
| 2012 | 2049 |
| 2013 uint32_t index = 0; | 2050 uint32_t index = 0; |
| 2014 if (name->AsArrayIndex(&index)) { | 2051 if (name->AsArrayIndex(&index)) { |
| 2015 return DeleteElement(index); | 2052 return DeleteElement(index); |
| 2016 } else { | 2053 } else { |
| 2017 LookupResult result; | 2054 LookupResult result; |
| 2018 LocalLookup(name, &result); | 2055 LocalLookup(name, &result); |
| 2019 if (!result.IsValid()) return Heap::true_value(); | 2056 if (!result.IsValid()) return Heap::true_value(); |
| 2020 if (result.IsDontDelete()) return Heap::false_value(); | 2057 if (result.IsDontDelete()) return Heap::false_value(); |
| 2021 // Check for interceptor. | 2058 // Check for interceptor. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 for (DescriptorReader r(instance_descriptors()); !r.eos(); r.advance()) { | 2221 for (DescriptorReader r(instance_descriptors()); !r.eos(); r.advance()) { |
| 2185 if (r.Equals(name) && r.type() == CALLBACKS) return r.GetCallbacks(); | 2222 if (r.Equals(name) && r.type() == CALLBACKS) return r.GetCallbacks(); |
| 2186 } | 2223 } |
| 2187 return NULL; | 2224 return NULL; |
| 2188 } | 2225 } |
| 2189 | 2226 |
| 2190 | 2227 |
| 2191 void JSObject::LocalLookup(String* name, LookupResult* result) { | 2228 void JSObject::LocalLookup(String* name, LookupResult* result) { |
| 2192 ASSERT(name->IsString()); | 2229 ASSERT(name->IsString()); |
| 2193 | 2230 |
| 2231 if (IsJSGlobalProxy()) { |
| 2232 Object* proto = GetPrototype(); |
| 2233 if (proto->IsNull()) return result->NotFound(); |
| 2234 ASSERT(proto->IsJSGlobalObject()); |
| 2235 return JSObject::cast(proto)->LocalLookup(name, result); |
| 2236 } |
| 2237 |
| 2194 // Do not use inline caching if the object is a non-global object | 2238 // Do not use inline caching if the object is a non-global object |
| 2195 // that requires access checks. | 2239 // that requires access checks. |
| 2196 if (!IsJSGlobalObject() && IsAccessCheckNeeded()) { | 2240 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) { |
| 2197 result->DisallowCaching(); | 2241 result->DisallowCaching(); |
| 2198 } | 2242 } |
| 2199 | 2243 |
| 2200 // Check __proto__ before interceptor. | 2244 // Check __proto__ before interceptor. |
| 2201 if (name->Equals(Heap::Proto_symbol())) { | 2245 if (name->Equals(Heap::Proto_symbol())) { |
| 2202 result->ConstantResult(this); | 2246 result->ConstantResult(this); |
| 2203 return; | 2247 return; |
| 2204 } | 2248 } |
| 2205 | 2249 |
| 2206 // Check for lookup interceptor except when bootstrapping. | 2250 // Check for lookup interceptor except when bootstrapping. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2273 if (dict->IsFailure()) return dict; | 2317 if (dict->IsFailure()) return dict; |
| 2274 | 2318 |
| 2275 // Set the potential new dictionary on the object. | 2319 // Set the potential new dictionary on the object. |
| 2276 set_properties(Dictionary::cast(dict)); | 2320 set_properties(Dictionary::cast(dict)); |
| 2277 return array; | 2321 return array; |
| 2278 } | 2322 } |
| 2279 | 2323 |
| 2280 | 2324 |
| 2281 Object* JSObject::DefineAccessor(String* name, bool is_getter, JSFunction* fun, | 2325 Object* JSObject::DefineAccessor(String* name, bool is_getter, JSFunction* fun, |
| 2282 PropertyAttributes attributes) { | 2326 PropertyAttributes attributes) { |
| 2327 // Check access rights if needed. |
| 2328 if (IsAccessCheckNeeded() && |
| 2329 !Top::MayNamedAccess(this, name, v8::ACCESS_HAS)) { |
| 2330 Top::ReportFailedAccessCheck(this, v8::ACCESS_HAS); |
| 2331 return Heap::undefined_value(); |
| 2332 } |
| 2333 |
| 2334 if (IsJSGlobalProxy()) { |
| 2335 Object* proto = GetPrototype(); |
| 2336 if (proto->IsNull()) return this; |
| 2337 ASSERT(proto->IsJSGlobalObject()); |
| 2338 return JSObject::cast(proto)->DefineAccessor(name, is_getter, |
| 2339 fun, attributes); |
| 2340 } |
| 2341 |
| 2283 Object* array = DefineGetterSetter(name, attributes); | 2342 Object* array = DefineGetterSetter(name, attributes); |
| 2284 if (array->IsFailure() || array->IsUndefined()) return array; | 2343 if (array->IsFailure() || array->IsUndefined()) return array; |
| 2285 FixedArray::cast(array)->set(is_getter ? 0 : 1, fun); | 2344 FixedArray::cast(array)->set(is_getter ? 0 : 1, fun); |
| 2286 return this; | 2345 return this; |
| 2287 } | 2346 } |
| 2288 | 2347 |
| 2289 | 2348 |
| 2290 Object* JSObject::LookupAccessor(String* name, bool is_getter) { | 2349 Object* JSObject::LookupAccessor(String* name, bool is_getter) { |
| 2291 // Make sure that the top context does not change when doing callbacks or | 2350 // Make sure that the top context does not change when doing callbacks or |
| 2292 // interceptor calls. | 2351 // interceptor calls. |
| (...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4736 } | 4795 } |
| 4737 | 4796 |
| 4738 Object* JSObject::SetElement(uint32_t index, Object* value) { | 4797 Object* JSObject::SetElement(uint32_t index, Object* value) { |
| 4739 // Check access rights if needed. | 4798 // Check access rights if needed. |
| 4740 if (IsAccessCheckNeeded() && | 4799 if (IsAccessCheckNeeded() && |
| 4741 !Top::MayIndexedAccess(this, index, v8::ACCESS_SET)) { | 4800 !Top::MayIndexedAccess(this, index, v8::ACCESS_SET)) { |
| 4742 Top::ReportFailedAccessCheck(this, v8::ACCESS_SET); | 4801 Top::ReportFailedAccessCheck(this, v8::ACCESS_SET); |
| 4743 return value; | 4802 return value; |
| 4744 } | 4803 } |
| 4745 | 4804 |
| 4805 if (IsJSGlobalProxy()) { |
| 4806 Object* proto = GetPrototype(); |
| 4807 if (proto->IsNull()) return value; |
| 4808 ASSERT(proto->IsJSGlobalObject()); |
| 4809 return JSObject::cast(proto)->SetElement(index, value); |
| 4810 } |
| 4811 |
| 4746 // Check for lookup interceptor | 4812 // Check for lookup interceptor |
| 4747 if (HasIndexedInterceptor()) { | 4813 if (HasIndexedInterceptor()) { |
| 4748 return SetElementWithInterceptor(index, value); | 4814 return SetElementWithInterceptor(index, value); |
| 4749 } | 4815 } |
| 4750 | 4816 |
| 4751 // Fast case. | 4817 // Fast case. |
| 4752 if (HasFastElements()) return SetFastElement(index, value); | 4818 if (HasFastElements()) return SetFastElement(index, value); |
| 4753 | 4819 |
| 4754 // Dictionary case. | 4820 // Dictionary case. |
| 4755 ASSERT(!HasFastElements()); | 4821 ASSERT(!HasFastElements()); |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6478 // No break point. | 6544 // No break point. |
| 6479 if (break_point_objects()->IsUndefined()) return 0; | 6545 if (break_point_objects()->IsUndefined()) return 0; |
| 6480 // Single beak point. | 6546 // Single beak point. |
| 6481 if (!break_point_objects()->IsFixedArray()) return 1; | 6547 if (!break_point_objects()->IsFixedArray()) return 1; |
| 6482 // Multiple break points. | 6548 // Multiple break points. |
| 6483 return FixedArray::cast(break_point_objects())->length(); | 6549 return FixedArray::cast(break_point_objects())->length(); |
| 6484 } | 6550 } |
| 6485 | 6551 |
| 6486 | 6552 |
| 6487 } } // namespace v8::internal | 6553 } } // namespace v8::internal |
| OLD | NEW |