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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 result = enum_fun(info); | 325 result = enum_fun(info); |
326 } | 326 } |
327 } | 327 } |
328 return result; | 328 return result; |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSObject> object) { | 332 Handle<FixedArray> GetKeysInFixedArrayFor(Handle<JSObject> object) { |
333 Handle<FixedArray> content = Factory::empty_fixed_array(); | 333 Handle<FixedArray> content = Factory::empty_fixed_array(); |
334 | 334 |
335 // Check access rights if required. | |
336 if (object->IsAccessCheckNeeded() && | |
337 !Top::MayNamedAccess(*object, Heap::undefined_value(), v8::ACCESS_KEYS)) { | |
338 Top::ReportFailedAccessCheck(*object, v8::ACCESS_KEYS); | |
339 return content; | |
340 } | |
341 | |
342 JSObject* arguments_boilerplate = | 335 JSObject* arguments_boilerplate = |
343 Top::context()->global_context()->arguments_boilerplate(); | 336 Top::context()->global_context()->arguments_boilerplate(); |
344 JSFunction* arguments_function = | 337 JSFunction* arguments_function = |
345 JSFunction::cast(arguments_boilerplate->map()->constructor()); | 338 JSFunction::cast(arguments_boilerplate->map()->constructor()); |
346 bool allow_enumeration = (object->map()->constructor() != arguments_function); | 339 bool allow_enumeration = (object->map()->constructor() != arguments_function); |
347 | 340 |
348 // Only collect keys if access is permitted. | 341 // Only collect keys if access is permitted. |
349 if (allow_enumeration) { | 342 if (allow_enumeration) { |
350 for (Handle<Object> p = object; | 343 for (Handle<Object> p = object; |
351 *p != Heap::null_value(); | 344 *p != Heap::null_value(); |
352 p = Handle<Object>(p->GetPrototype())) { | 345 p = Handle<Object>(p->GetPrototype())) { |
353 Handle<JSObject> current(JSObject::cast(*p)); | 346 Handle<JSObject> current(JSObject::cast(*p)); |
354 | 347 |
| 348 // Check access rights if required. |
| 349 if (current->IsAccessCheckNeeded() && |
| 350 !Top::MayNamedAccess(*current, Heap::undefined_value(), |
| 351 v8::ACCESS_KEYS)) { |
| 352 Top::ReportFailedAccessCheck(*current, v8::ACCESS_KEYS); |
| 353 break; |
| 354 } |
| 355 |
355 // Compute the property keys. | 356 // Compute the property keys. |
356 content = UnionOfKeys(content, GetEnumPropertyKeys(current)); | 357 content = UnionOfKeys(content, GetEnumPropertyKeys(current)); |
357 | 358 |
358 // Add the property keys from the interceptor. | 359 // Add the property keys from the interceptor. |
359 if (current->HasNamedInterceptor()) { | 360 if (current->HasNamedInterceptor()) { |
360 v8::Handle<v8::Array> result = | 361 v8::Handle<v8::Array> result = |
361 GetKeysForNamedInterceptor(object, current); | 362 GetKeysForNamedInterceptor(object, current); |
362 if (!result.IsEmpty()) | 363 if (!result.IsEmpty()) |
363 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); | 364 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); |
364 } | 365 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 Handle<Context> security_context) { | 543 Handle<Context> security_context) { |
543 Handle<FixedArray> arr = Factory::NewFixedArray(4); | 544 Handle<FixedArray> arr = Factory::NewFixedArray(4); |
544 arr->set(0, Smi::FromInt(index)); | 545 arr->set(0, Smi::FromInt(index)); |
545 arr->set(1, *compile_context); // Compile in this context | 546 arr->set(1, *compile_context); // Compile in this context |
546 arr->set(2, *function_context); // Set function context to this | 547 arr->set(2, *function_context); // Set function context to this |
547 arr->set(3, *security_context); // Receiver for call | 548 arr->set(3, *security_context); // Receiver for call |
548 fun->shared()->set_lazy_load_data(*arr); | 549 fun->shared()->set_lazy_load_data(*arr); |
549 } | 550 } |
550 | 551 |
551 } } // namespace v8::internal | 552 } } // namespace v8::internal |
OLD | NEW |