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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "accessors.h" | 30 #include "accessors.h" |
31 #include "api.h" | 31 #include "api.h" |
| 32 #include "arguments.h" |
32 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
33 #include "compiler.h" | 34 #include "compiler.h" |
34 #include "debug.h" | 35 #include "debug.h" |
35 #include "execution.h" | 36 #include "execution.h" |
36 #include "global-handles.h" | 37 #include "global-handles.h" |
37 #include "natives.h" | 38 #include "natives.h" |
38 #include "runtime.h" | 39 #include "runtime.h" |
39 | 40 |
40 namespace v8 { | 41 namespace v8 { |
41 namespace internal { | 42 namespace internal { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 line = i; | 473 line = i; |
473 break; | 474 break; |
474 } | 475 } |
475 } | 476 } |
476 } | 477 } |
477 | 478 |
478 return line != -1 ? line + script->line_offset()->value() : line; | 479 return line != -1 ? line + script->line_offset()->value() : line; |
479 } | 480 } |
480 | 481 |
481 | 482 |
| 483 void CustomArguments::IterateInstance(ObjectVisitor* v) { |
| 484 v->VisitPointers(values_, values_ + 4); |
| 485 } |
| 486 |
| 487 |
482 // Compute the property keys from the interceptor. | 488 // Compute the property keys from the interceptor. |
483 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, | 489 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, |
484 Handle<JSObject> object) { | 490 Handle<JSObject> object) { |
485 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 491 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
486 Handle<Object> data(interceptor->data()); | 492 CustomArguments args(interceptor->data(), *receiver, *object); |
487 v8::AccessorInfo info( | 493 v8::AccessorInfo info(args.end()); |
488 v8::Utils::ToLocal(receiver), | |
489 v8::Utils::ToLocal(data), | |
490 v8::Utils::ToLocal(object)); | |
491 v8::Handle<v8::Array> result; | 494 v8::Handle<v8::Array> result; |
492 if (!interceptor->enumerator()->IsUndefined()) { | 495 if (!interceptor->enumerator()->IsUndefined()) { |
493 v8::NamedPropertyEnumerator enum_fun = | 496 v8::NamedPropertyEnumerator enum_fun = |
494 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator()); | 497 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator()); |
495 LOG(ApiObjectAccess("interceptor-named-enum", *object)); | 498 LOG(ApiObjectAccess("interceptor-named-enum", *object)); |
496 { | 499 { |
497 // Leaving JavaScript. | 500 // Leaving JavaScript. |
498 VMState state(EXTERNAL); | 501 VMState state(EXTERNAL); |
499 result = enum_fun(info); | 502 result = enum_fun(info); |
500 } | 503 } |
501 } | 504 } |
502 return result; | 505 return result; |
503 } | 506 } |
504 | 507 |
505 | 508 |
506 // Compute the element keys from the interceptor. | 509 // Compute the element keys from the interceptor. |
507 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSObject> receiver, | 510 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSObject> receiver, |
508 Handle<JSObject> object) { | 511 Handle<JSObject> object) { |
509 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); | 512 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); |
510 Handle<Object> data(interceptor->data()); | 513 CustomArguments args(interceptor->data(), *receiver, *object); |
511 v8::AccessorInfo info( | 514 v8::AccessorInfo info(args.end()); |
512 v8::Utils::ToLocal(receiver), | |
513 v8::Utils::ToLocal(data), | |
514 v8::Utils::ToLocal(object)); | |
515 v8::Handle<v8::Array> result; | 515 v8::Handle<v8::Array> result; |
516 if (!interceptor->enumerator()->IsUndefined()) { | 516 if (!interceptor->enumerator()->IsUndefined()) { |
517 v8::IndexedPropertyEnumerator enum_fun = | 517 v8::IndexedPropertyEnumerator enum_fun = |
518 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); | 518 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); |
519 LOG(ApiObjectAccess("interceptor-indexed-enum", *object)); | 519 LOG(ApiObjectAccess("interceptor-indexed-enum", *object)); |
520 { | 520 { |
521 // Leaving JavaScript. | 521 // Leaving JavaScript. |
522 VMState state(EXTERNAL); | 522 VMState state(EXTERNAL); |
523 result = enum_fun(info); | 523 result = enum_fun(info); |
524 } | 524 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 757 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
758 obj->set_map(*new_map); | 758 obj->set_map(*new_map); |
759 new_map->set_needs_loading(true); | 759 new_map->set_needs_loading(true); |
760 // Store the lazy loading info in the constructor field. We'll | 760 // Store the lazy loading info in the constructor field. We'll |
761 // reestablish the constructor from the fixed array after loading. | 761 // reestablish the constructor from the fixed array after loading. |
762 new_map->set_constructor(*arr); | 762 new_map->set_constructor(*arr); |
763 ASSERT(!obj->IsLoaded()); | 763 ASSERT(!obj->IsLoaded()); |
764 } | 764 } |
765 | 765 |
766 } } // namespace v8::internal | 766 } } // namespace v8::internal |
OLD | NEW |