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

Side by Side Diff: src/stub-cache.cc

Issue 225673003: Return MaybeHandle from GetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/runtime.cc ('k') | 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 562
563 // Throw a reference error. 563 // Throw a reference error.
564 Handle<Name> name_handle(name); 564 Handle<Name> name_handle(name);
565 Handle<Object> error = 565 Handle<Object> error =
566 isolate->factory()->NewReferenceError("not_defined", 566 isolate->factory()->NewReferenceError("not_defined",
567 HandleVector(&name_handle, 1)); 567 HandleVector(&name_handle, 1));
568 return isolate->Throw(*error); 568 return isolate->Throw(*error);
569 } 569 }
570 570
571 571
572 static Handle<Object> LoadWithInterceptor(Arguments* args, 572 MUST_USE_RESULT static MaybeHandle<Object> LoadWithInterceptor(
573 PropertyAttributes* attrs) { 573 Arguments* args,
574 PropertyAttributes* attrs) {
574 ASSERT(args->length() == StubCache::kInterceptorArgsLength); 575 ASSERT(args->length() == StubCache::kInterceptorArgsLength);
575 Handle<Name> name_handle = 576 Handle<Name> name_handle =
576 args->at<Name>(StubCache::kInterceptorArgsNameIndex); 577 args->at<Name>(StubCache::kInterceptorArgsNameIndex);
577 Handle<InterceptorInfo> interceptor_info = 578 Handle<InterceptorInfo> interceptor_info =
578 args->at<InterceptorInfo>(StubCache::kInterceptorArgsInfoIndex); 579 args->at<InterceptorInfo>(StubCache::kInterceptorArgsInfoIndex);
579 Handle<JSObject> receiver_handle = 580 Handle<JSObject> receiver_handle =
580 args->at<JSObject>(StubCache::kInterceptorArgsThisIndex); 581 args->at<JSObject>(StubCache::kInterceptorArgsThisIndex);
581 Handle<JSObject> holder_handle = 582 Handle<JSObject> holder_handle =
582 args->at<JSObject>(StubCache::kInterceptorArgsHolderIndex); 583 args->at<JSObject>(StubCache::kInterceptorArgsHolderIndex);
583 584
(...skipping 13 matching lines...) Expand all
597 598
598 PropertyCallbackArguments callback_args(isolate, 599 PropertyCallbackArguments callback_args(isolate,
599 interceptor_info->data(), 600 interceptor_info->data(),
600 *receiver_handle, 601 *receiver_handle,
601 *holder_handle); 602 *holder_handle);
602 { 603 {
603 HandleScope scope(isolate); 604 HandleScope scope(isolate);
604 // Use the interceptor getter. 605 // Use the interceptor getter.
605 v8::Handle<v8::Value> r = 606 v8::Handle<v8::Value> r =
606 callback_args.Call(getter, v8::Utils::ToLocal(name)); 607 callback_args.Call(getter, v8::Utils::ToLocal(name));
607 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); 608 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
608 if (!r.IsEmpty()) { 609 if (!r.IsEmpty()) {
609 *attrs = NONE; 610 *attrs = NONE;
610 Handle<Object> result = v8::Utils::OpenHandle(*r); 611 Handle<Object> result = v8::Utils::OpenHandle(*r);
611 result->VerifyApiCallResultType(); 612 result->VerifyApiCallResultType();
612 return scope.CloseAndEscape(result); 613 return scope.CloseAndEscape(result);
613 } 614 }
614 } 615 }
615 616
616 Handle<Object> result = JSObject::GetPropertyPostInterceptor( 617 return JSObject::GetPropertyPostInterceptor(
617 holder_handle, receiver_handle, name_handle, attrs); 618 holder_handle, receiver_handle, name_handle, attrs);
618 return result;
619 } 619 }
620 620
621 621
622 /** 622 /**
623 * Loads a property with an interceptor performing post interceptor 623 * Loads a property with an interceptor performing post interceptor
624 * lookup if interceptor failed. 624 * lookup if interceptor failed.
625 */ 625 */
626 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) { 626 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) {
627 PropertyAttributes attr = NONE; 627 PropertyAttributes attr = NONE;
628 HandleScope scope(isolate); 628 HandleScope scope(isolate);
629 Handle<Object> result = LoadWithInterceptor(&args, &attr); 629 Handle<Object> result;
630 RETURN_IF_EMPTY_HANDLE(isolate, result); 630 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
631 isolate, result, LoadWithInterceptor(&args, &attr));
631 632
632 // If the property is present, return it. 633 // If the property is present, return it.
633 if (attr != ABSENT) return *result; 634 if (attr != ABSENT) return *result;
634 return ThrowReferenceError(isolate, Name::cast(args[0])); 635 return ThrowReferenceError(isolate, Name::cast(args[0]));
635 } 636 }
636 637
637 638
638 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { 639 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) {
639 PropertyAttributes attr; 640 PropertyAttributes attr;
640 HandleScope scope(isolate); 641 HandleScope scope(isolate);
641 Handle<Object> result = LoadWithInterceptor(&args, &attr); 642 Handle<Object> result;
642 RETURN_IF_EMPTY_HANDLE(isolate, result); 643 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
644 isolate, result, LoadWithInterceptor(&args, &attr));
643 // This is call IC. In this case, we simply return the undefined result which 645 // This is call IC. In this case, we simply return the undefined result which
644 // will lead to an exception when trying to invoke the result as a 646 // will lead to an exception when trying to invoke the result as a
645 // function. 647 // function.
646 return *result; 648 return *result;
647 } 649 }
648 650
649 651
650 RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) { 652 RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
651 HandleScope scope(isolate); 653 HandleScope scope(isolate);
652 ASSERT(args.length() == 3); 654 ASSERT(args.length() == 3);
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 Handle<FunctionTemplateInfo>( 1497 Handle<FunctionTemplateInfo>(
1496 FunctionTemplateInfo::cast(signature->receiver())); 1498 FunctionTemplateInfo::cast(signature->receiver()));
1497 } 1499 }
1498 } 1500 }
1499 1501
1500 is_simple_api_call_ = true; 1502 is_simple_api_call_ = true;
1501 } 1503 }
1502 1504
1503 1505
1504 } } // namespace v8::internal 1506 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698