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

Side by Side Diff: src/handles.cc

Issue 10928083: Add more checks for native callback results. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/objects.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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 if (!interceptor->enumerator()->IsUndefined()) { 554 if (!interceptor->enumerator()->IsUndefined()) {
555 v8::NamedPropertyEnumerator enum_fun = 555 v8::NamedPropertyEnumerator enum_fun =
556 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator()); 556 v8::ToCData<v8::NamedPropertyEnumerator>(interceptor->enumerator());
557 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); 557 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
558 { 558 {
559 // Leaving JavaScript. 559 // Leaving JavaScript.
560 VMState state(isolate, EXTERNAL); 560 VMState state(isolate, EXTERNAL);
561 result = enum_fun(info); 561 result = enum_fun(info);
562 } 562 }
563 } 563 }
564 #if ENABLE_EXTRA_CHECKS
565 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
566 #endif
564 return result; 567 return result;
565 } 568 }
566 569
567 570
568 // Compute the element keys from the interceptor. 571 // Compute the element keys from the interceptor.
569 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, 572 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver,
570 Handle<JSObject> object) { 573 Handle<JSObject> object) {
571 Isolate* isolate = receiver->GetIsolate(); 574 Isolate* isolate = receiver->GetIsolate();
572 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); 575 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor());
573 CustomArguments args(isolate, interceptor->data(), *receiver, *object); 576 CustomArguments args(isolate, interceptor->data(), *receiver, *object);
574 v8::AccessorInfo info(args.end()); 577 v8::AccessorInfo info(args.end());
575 v8::Handle<v8::Array> result; 578 v8::Handle<v8::Array> result;
576 if (!interceptor->enumerator()->IsUndefined()) { 579 if (!interceptor->enumerator()->IsUndefined()) {
577 v8::IndexedPropertyEnumerator enum_fun = 580 v8::IndexedPropertyEnumerator enum_fun =
578 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); 581 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator());
579 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object)); 582 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object));
580 { 583 {
581 // Leaving JavaScript. 584 // Leaving JavaScript.
582 VMState state(isolate, EXTERNAL); 585 VMState state(isolate, EXTERNAL);
583 result = enum_fun(info); 586 result = enum_fun(info);
587 #if ENABLE_EXTRA_CHECKS
588 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
589 #endif
584 } 590 }
585 } 591 }
586 return result; 592 return result;
587 } 593 }
588 594
589 595
590 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { 596 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) {
591 int len = array->length(); 597 int len = array->length();
592 for (int i = 0; i < len; i++) { 598 for (int i = 0; i < len; i++) {
593 Object* e = array->get(i); 599 Object* e = array->get(i);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 data->next = prev_next_; 1032 data->next = prev_next_;
1027 data->limit = prev_limit_; 1033 data->limit = prev_limit_;
1028 #ifdef DEBUG 1034 #ifdef DEBUG
1029 handles_detached_ = true; 1035 handles_detached_ = true;
1030 #endif 1036 #endif
1031 return deferred; 1037 return deferred;
1032 } 1038 }
1033 1039
1034 1040
1035 } } // namespace v8::internal 1041 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698