Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/handles.cc

Issue 12494012: new style of property/function callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: make arm look like other architectures Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 break; 538 break;
539 } 539 }
540 if (source->Get(pos) == '\n') { 540 if (source->Get(pos) == '\n') {
541 line++; 541 line++;
542 } 542 }
543 } 543 }
544 return line; 544 return line;
545 } 545 }
546 546
547 547
548 void CustomArguments::IterateInstance(ObjectVisitor* v) {
549 v->VisitPointers(values_, values_ + ARRAY_SIZE(values_));
550 }
551
552
553 // Compute the property keys from the interceptor. 548 // Compute the property keys from the interceptor.
554 // TODO(rossberg): support symbols in API, and filter here if needed. 549 // TODO(rossberg): support symbols in API, and filter here if needed.
555 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver, 550 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSReceiver> receiver,
556 Handle<JSObject> object) { 551 Handle<JSObject> object) {
557 Isolate* isolate = receiver->GetIsolate(); 552 Isolate* isolate = receiver->GetIsolate();
558 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); 553 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
559 CustomArguments args(isolate, interceptor->data(), *receiver, *object); 554 PropertyCallbackArguments
560 v8::AccessorInfo info(args.end()); 555 args(isolate, interceptor->data(), *receiver, *object);
561 v8::Handle<v8::Array> result; 556 v8::Handle<v8::Array> result;
562 if (!interceptor->enumerator()->IsUndefined()) { 557 if (!interceptor->enumerator()->IsUndefined()) {
563 v8::NamedPropertyEnumerator enum_fun = 558 v8::NamedPropertyEnumerator enum_fun =
564 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator()); 559 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator());
565 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); 560 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
566 { 561 {
567 // Leaving JavaScript. 562 // Leaving JavaScript.
568 VMState<EXTERNAL> state(isolate); 563 VMState<EXTERNAL> state(isolate);
569 result = enum_fun(info); 564 result = args.Call(enum_fun);
570 } 565 }
571 } 566 }
572 #if ENABLE_EXTRA_CHECKS 567 #if ENABLE_EXTRA_CHECKS
573 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); 568 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
574 #endif 569 #endif
575 return result; 570 return result;
576 } 571 }
577 572
578 573
579 // Compute the element keys from the interceptor. 574 // Compute the element keys from the interceptor.
580 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, 575 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver,
581 Handle<JSObject> object) { 576 Handle<JSObject> object) {
582 Isolate* isolate = receiver->GetIsolate(); 577 Isolate* isolate = receiver->GetIsolate();
583 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); 578 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor());
584 CustomArguments args(isolate, interceptor->data(), *receiver, *object); 579 PropertyCallbackArguments
585 v8::AccessorInfo info(args.end()); 580 args(isolate, interceptor->data(), *receiver, *object);
586 v8::Handle<v8::Array> result; 581 v8::Handle<v8::Array> result;
587 if (!interceptor->enumerator()->IsUndefined()) { 582 if (!interceptor->enumerator()->IsUndefined()) {
588 v8::IndexedPropertyEnumerator enum_fun = 583 v8::IndexedPropertyEnumerator enum_fun =
589 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); 584 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator());
590 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object)); 585 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object));
591 { 586 {
592 // Leaving JavaScript. 587 // Leaving JavaScript.
593 VMState<EXTERNAL> state(isolate); 588 VMState<EXTERNAL> state(isolate);
594 result = enum_fun(info); 589 result = args.Call(enum_fun);
595 #if ENABLE_EXTRA_CHECKS 590 #if ENABLE_EXTRA_CHECKS
596 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); 591 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
597 #endif 592 #endif
598 } 593 }
599 } 594 }
600 return result; 595 return result;
601 } 596 }
602 597
603 598
604 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) { 599 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 data->next = prev_next_; 923 data->next = prev_next_;
929 data->limit = prev_limit_; 924 data->limit = prev_limit_;
930 #ifdef DEBUG 925 #ifdef DEBUG
931 handles_detached_ = true; 926 handles_detached_ = true;
932 #endif 927 #endif
933 return deferred; 928 return deferred;
934 } 929 }
935 930
936 931
937 } } // namespace v8::internal 932 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698