| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); | 384 content = AddKeysFromJSArray(content, v8::Utils::OpenHandle(*result)); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 return content; | 388 return content; |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 Handle<JSArray> GetKeysFor(Handle<JSObject> object) { | 392 Handle<JSArray> GetKeysFor(Handle<JSObject> object) { |
| 393 Counters::for_in.Increment(); | 393 Counters::for_in.Increment(); |
| 394 | 394 Handle<FixedArray> elements = GetKeysInFixedArrayFor(object); |
| 395 Handle<FixedArray> content = GetKeysInFixedArrayFor(object); | 395 return Factory::NewJSArrayWithElements(elements); |
| 396 | |
| 397 // Allocate the JSArray with the result. | |
| 398 Handle<JSArray> obj = Factory::NewJSArray(content->length()); | |
| 399 Handle<JSArray>::cast(obj)->SetContent(*content); | |
| 400 return Handle<JSArray>::cast(obj); | |
| 401 } | 396 } |
| 402 | 397 |
| 403 | 398 |
| 404 Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object) { | 399 Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object) { |
| 405 int index = 0; | 400 int index = 0; |
| 406 if (object->HasFastProperties()) { | 401 if (object->HasFastProperties()) { |
| 407 if (object->map()->instance_descriptors()->HasEnumCache()) { | 402 if (object->map()->instance_descriptors()->HasEnumCache()) { |
| 408 Counters::enum_cache_hits.Increment(); | 403 Counters::enum_cache_hits.Increment(); |
| 409 DescriptorArray* desc = object->map()->instance_descriptors(); | 404 DescriptorArray* desc = object->map()->instance_descriptors(); |
| 410 return Handle<FixedArray>(FixedArray::cast(desc->GetEnumCache())); | 405 return Handle<FixedArray>(FixedArray::cast(desc->GetEnumCache())); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 Handle<Context> security_context) { | 544 Handle<Context> security_context) { |
| 550 Handle<FixedArray> arr = Factory::NewFixedArray(4); | 545 Handle<FixedArray> arr = Factory::NewFixedArray(4); |
| 551 arr->set(0, Smi::FromInt(index)); | 546 arr->set(0, Smi::FromInt(index)); |
| 552 arr->set(1, *compile_context); // Compile in this context | 547 arr->set(1, *compile_context); // Compile in this context |
| 553 arr->set(2, *function_context); // Set function context to this | 548 arr->set(2, *function_context); // Set function context to this |
| 554 arr->set(3, *security_context); // Receiver for call | 549 arr->set(3, *security_context); // Receiver for call |
| 555 fun->shared()->set_lazy_load_data(*arr); | 550 fun->shared()->set_lazy_load_data(*arr); |
| 556 } | 551 } |
| 557 | 552 |
| 558 } } // namespace v8::internal | 553 } } // namespace v8::internal |
| OLD | NEW |