| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 Handle<JSObject> current(JSObject::cast(*p)); | 484 Handle<JSObject> current(JSObject::cast(*p)); |
| 485 | 485 |
| 486 // Check access rights if required. | 486 // Check access rights if required. |
| 487 if (current->IsAccessCheckNeeded() && | 487 if (current->IsAccessCheckNeeded() && |
| 488 !Top::MayNamedAccess(*current, Heap::undefined_value(), | 488 !Top::MayNamedAccess(*current, Heap::undefined_value(), |
| 489 v8::ACCESS_KEYS)) { | 489 v8::ACCESS_KEYS)) { |
| 490 Top::ReportFailedAccessCheck(*current, v8::ACCESS_KEYS); | 490 Top::ReportFailedAccessCheck(*current, v8::ACCESS_KEYS); |
| 491 break; | 491 break; |
| 492 } | 492 } |
| 493 | 493 |
| 494 // Compute the property keys. | |
| 495 content = UnionOfKeys(content, GetEnumPropertyKeys(current)); | |
| 496 | |
| 497 // Add the property keys from the interceptor. | |
| 498 if (current->HasNamedInterceptor()) { | |
| 499 v8::Handle<v8::Array> result = | |
| 500 GetKeysForNamedInterceptor(object, current); | |
| 501 if (!result.IsEmpty()) | |
| 502 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); | |
| 503 } | |
| 504 | |
| 505 // Compute the element keys. | 494 // Compute the element keys. |
| 506 Handle<FixedArray> element_keys = | 495 Handle<FixedArray> element_keys = |
| 507 Factory::NewFixedArray(current->NumberOfEnumElements()); | 496 Factory::NewFixedArray(current->NumberOfEnumElements()); |
| 508 current->GetEnumElementKeys(*element_keys); | 497 current->GetEnumElementKeys(*element_keys); |
| 509 content = UnionOfKeys(content, element_keys); | 498 content = UnionOfKeys(content, element_keys); |
| 510 | 499 |
| 511 // Add the element keys from the interceptor. | 500 // Add the element keys from the interceptor. |
| 512 if (current->HasIndexedInterceptor()) { | 501 if (current->HasIndexedInterceptor()) { |
| 513 v8::Handle<v8::Array> result = | 502 v8::Handle<v8::Array> result = |
| 514 GetKeysForIndexedInterceptor(object, current); | 503 GetKeysForIndexedInterceptor(object, current); |
| 515 if (!result.IsEmpty()) | 504 if (!result.IsEmpty()) |
| 516 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); | 505 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); |
| 517 } | 506 } |
| 507 |
| 508 // Compute the property keys. |
| 509 content = UnionOfKeys(content, GetEnumPropertyKeys(current)); |
| 510 |
| 511 // Add the property keys from the interceptor. |
| 512 if (current->HasNamedInterceptor()) { |
| 513 v8::Handle<v8::Array> result = |
| 514 GetKeysForNamedInterceptor(object, current); |
| 515 if (!result.IsEmpty()) |
| 516 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); |
| 517 } |
| 518 } | 518 } |
| 519 } | 519 } |
| 520 return content; | 520 return content; |
| 521 } | 521 } |
| 522 | 522 |
| 523 | 523 |
| 524 Handle<JSArray> GetKeysFor(Handle<JSObject> object) { | 524 Handle<JSArray> GetKeysFor(Handle<JSObject> object) { |
| 525 Counters::for_in.Increment(); | 525 Counters::for_in.Increment(); |
| 526 Handle<FixedArray> elements = GetKeysInFixedArrayFor(object); | 526 Handle<FixedArray> elements = GetKeysInFixedArrayFor(object); |
| 527 return Factory::NewJSArrayWithElements(elements); | 527 return Factory::NewJSArrayWithElements(elements); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 542 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); | 542 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); |
| 543 for (DescriptorReader r(object->map()->instance_descriptors()); | 543 for (DescriptorReader r(object->map()->instance_descriptors()); |
| 544 !r.eos(); | 544 !r.eos(); |
| 545 r.advance()) { | 545 r.advance()) { |
| 546 if (r.IsProperty() && !r.IsDontEnum()) { | 546 if (r.IsProperty() && !r.IsDontEnum()) { |
| 547 (*storage)->set(index, r.GetKey()); | 547 (*storage)->set(index, r.GetKey()); |
| 548 (*sort_array)->set(index, Smi::FromInt(r.GetDetails().index())); | 548 (*sort_array)->set(index, Smi::FromInt(r.GetDetails().index())); |
| 549 index++; | 549 index++; |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 (*storage)->SortPairs(*sort_array); | 552 (*storage)->SortPairs(*sort_array, sort_array->length()); |
| 553 Handle<FixedArray> bridge_storage = | 553 Handle<FixedArray> bridge_storage = |
| 554 Factory::NewFixedArray(DescriptorArray::kEnumCacheBridgeLength); | 554 Factory::NewFixedArray(DescriptorArray::kEnumCacheBridgeLength); |
| 555 DescriptorArray* desc = object->map()->instance_descriptors(); | 555 DescriptorArray* desc = object->map()->instance_descriptors(); |
| 556 desc->SetEnumCache(*bridge_storage, *storage); | 556 desc->SetEnumCache(*bridge_storage, *storage); |
| 557 ASSERT(storage->length() == index); | 557 ASSERT(storage->length() == index); |
| 558 return storage; | 558 return storage; |
| 559 } else { | 559 } else { |
| 560 int num_enum = object->NumberOfEnumProperties(); | 560 int num_enum = object->NumberOfEnumProperties(); |
| 561 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum); | 561 Handle<FixedArray> storage = Factory::NewFixedArray(num_enum); |
| 562 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); | 562 Handle<FixedArray> sort_array = Factory::NewFixedArray(num_enum); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 Handle<Context> compile_context, | 679 Handle<Context> compile_context, |
| 680 Handle<Context> function_context) { | 680 Handle<Context> function_context) { |
| 681 Handle<FixedArray> arr = Factory::NewFixedArray(3); | 681 Handle<FixedArray> arr = Factory::NewFixedArray(3); |
| 682 arr->set(0, Smi::FromInt(index)); | 682 arr->set(0, Smi::FromInt(index)); |
| 683 arr->set(1, *compile_context); // Compile in this context | 683 arr->set(1, *compile_context); // Compile in this context |
| 684 arr->set(2, *function_context); // Set function context to this | 684 arr->set(2, *function_context); // Set function context to this |
| 685 fun->shared()->set_lazy_load_data(*arr); | 685 fun->shared()->set_lazy_load_data(*arr); |
| 686 } | 686 } |
| 687 | 687 |
| 688 } } // namespace v8::internal | 688 } } // namespace v8::internal |
| OLD | NEW |