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

Side by Side Diff: src/handles.cc

Issue 16537005: interceptor return values escape their scope (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object)); 559 LOG(isolate, ApiObjectAccess("interceptor-named-enum", *object));
560 { 560 {
561 // Leaving JavaScript. 561 // Leaving JavaScript.
562 VMState<EXTERNAL> state(isolate); 562 VMState<EXTERNAL> state(isolate);
563 result = args.Call(enum_fun); 563 result = args.Call(enum_fun);
564 } 564 }
565 } 565 }
566 #if ENABLE_EXTRA_CHECKS 566 #if ENABLE_EXTRA_CHECKS
567 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); 567 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
568 #endif 568 #endif
569 return result; 569 return v8::Local<v8::Array>::New(reinterpret_cast<v8::Isolate*>(isolate),
570 result);
570 } 571 }
571 572
572 573
573 // Compute the element keys from the interceptor. 574 // Compute the element keys from the interceptor.
574 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver, 575 v8::Handle<v8::Array> GetKeysForIndexedInterceptor(Handle<JSReceiver> receiver,
575 Handle<JSObject> object) { 576 Handle<JSObject> object) {
576 Isolate* isolate = receiver->GetIsolate(); 577 Isolate* isolate = receiver->GetIsolate();
577 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor()); 578 Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor());
578 PropertyCallbackArguments 579 PropertyCallbackArguments
579 args(isolate, interceptor->data(), *receiver, *object); 580 args(isolate, interceptor->data(), *receiver, *object);
580 v8::Handle<v8::Array> result; 581 v8::Handle<v8::Array> result;
581 if (!interceptor->enumerator()->IsUndefined()) { 582 if (!interceptor->enumerator()->IsUndefined()) {
582 v8::IndexedPropertyEnumerator enum_fun = 583 v8::IndexedPropertyEnumerator enum_fun =
583 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator()); 584 v8::ToCData<v8::IndexedPropertyEnumerator>(interceptor->enumerator());
584 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object)); 585 LOG(isolate, ApiObjectAccess("interceptor-indexed-enum", *object));
585 { 586 {
586 // Leaving JavaScript. 587 // Leaving JavaScript.
587 VMState<EXTERNAL> state(isolate); 588 VMState<EXTERNAL> state(isolate);
588 result = args.Call(enum_fun); 589 result = args.Call(enum_fun);
589 #if ENABLE_EXTRA_CHECKS 590 #if ENABLE_EXTRA_CHECKS
590 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject()); 591 CHECK(result.IsEmpty() || v8::Utils::OpenHandle(*result)->IsJSObject());
591 #endif 592 #endif
592 } 593 }
593 } 594 }
594 return result; 595 return v8::Local<v8::Array>::New(reinterpret_cast<v8::Isolate*>(isolate),
596 result);
595 } 597 }
596 598
597 599
598 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) { 600 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) {
599 Isolate* isolate = script->GetIsolate(); 601 Isolate* isolate = script->GetIsolate();
600 Handle<String> name_or_source_url_key = 602 Handle<String> name_or_source_url_key =
601 isolate->factory()->InternalizeOneByteString( 603 isolate->factory()->InternalizeOneByteString(
602 STATIC_ASCII_VECTOR("nameOrSourceURL")); 604 STATIC_ASCII_VECTOR("nameOrSourceURL"));
603 Handle<JSValue> script_wrapper = GetScriptWrapper(script); 605 Handle<JSValue> script_wrapper = GetScriptWrapper(script);
604 Handle<Object> property = GetProperty(isolate, 606 Handle<Object> property = GetProperty(isolate,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 data->next = prev_next_; 924 data->next = prev_next_;
923 data->limit = prev_limit_; 925 data->limit = prev_limit_;
924 #ifdef DEBUG 926 #ifdef DEBUG
925 handles_detached_ = true; 927 handles_detached_ = true;
926 #endif 928 #endif
927 return deferred; 929 return deferred;
928 } 930 }
929 931
930 932
931 } } // namespace v8::internal 933 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698