| OLD | NEW |
| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| 476 | 476 |
| 477 // ------------------------------------------------------------------------ | 477 // ------------------------------------------------------------------------ |
| 478 // StubCompiler implementation. | 478 // StubCompiler implementation. |
| 479 | 479 |
| 480 | 480 |
| 481 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { | 481 RUNTIME_FUNCTION(Object*, StoreCallbackProperty) { |
| 482 JSObject* receiver = JSObject::cast(args[0]); | 482 JSObject* receiver = JSObject::cast(args[0]); |
| 483 JSObject* holder = JSObject::cast(args[1]); | 483 JSObject* holder = JSObject::cast(args[1]); |
| 484 ExecutableAccessorInfo* callback = ExecutableAccessorInfo::cast(args[2]); | 484 ExecutableAccessorInfo* callback = ExecutableAccessorInfo::cast(args[2]); |
| 485 Address setter_address = v8::ToCData<Address>(callback->setter()); | 485 Address setter_address = v8::ToCData<Address>(callback->setter()); |
| 486 v8::AccessorSetterCallback fun = | 486 v8::AccessorSetterCallback fun = |
| 487 FUNCTION_CAST<v8::AccessorSetterCallback>(setter_address); | 487 FUNCTION_CAST<v8::AccessorSetterCallback>(setter_address); |
| 488 ASSERT(fun != NULL); | 488 ASSERT(fun != NULL); |
| 489 ASSERT(callback->IsCompatibleReceiver(receiver)); | 489 ASSERT(callback->IsCompatibleReceiver(receiver)); |
| 490 Handle<Name> name = args.at<Name>(3); | 490 Handle<Name> name = args.at<Name>(3); |
| 491 Handle<Object> value = args.at<Object>(4); | 491 Handle<Object> value = args.at<Object>(4); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 504 } | 504 } |
| 505 | 505 |
| 506 | 506 |
| 507 /** | 507 /** |
| 508 * Attempts to load a property with an interceptor (which must be present), | 508 * Attempts to load a property with an interceptor (which must be present), |
| 509 * but doesn't search the prototype chain. | 509 * but doesn't search the prototype chain. |
| 510 * | 510 * |
| 511 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 511 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
| 512 * provide any value for the given name. | 512 * provide any value for the given name. |
| 513 */ | 513 */ |
| 514 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) { | 514 RUNTIME_FUNCTION(Object*, LoadPropertyWithInterceptorOnly) { |
| 515 ASSERT(args.length() == StubCache::kInterceptorArgsLength); | 515 ASSERT(args.length() == StubCache::kInterceptorArgsLength); |
| 516 Handle<Name> name_handle = | 516 Handle<Name> name_handle = |
| 517 args.at<Name>(StubCache::kInterceptorArgsNameIndex); | 517 args.at<Name>(StubCache::kInterceptorArgsNameIndex); |
| 518 Handle<InterceptorInfo> interceptor_info = | 518 Handle<InterceptorInfo> interceptor_info = |
| 519 args.at<InterceptorInfo>(StubCache::kInterceptorArgsInfoIndex); | 519 args.at<InterceptorInfo>(StubCache::kInterceptorArgsInfoIndex); |
| 520 | 520 |
| 521 // TODO(rossberg): Support symbols in the API. | 521 // TODO(rossberg): Support symbols in the API. |
| 522 if (name_handle->IsSymbol()) | 522 if (name_handle->IsSymbol()) |
| 523 return isolate->heap()->no_interceptor_result_sentinel(); | 523 return isolate->heap()->no_interceptor_result_sentinel(); |
| 524 Handle<String> name = Handle<String>::cast(name_handle); | 524 Handle<String> name = Handle<String>::cast(name_handle); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 544 Handle<Object> result = v8::Utils::OpenHandle(*r); | 544 Handle<Object> result = v8::Utils::OpenHandle(*r); |
| 545 result->VerifyApiCallResultType(); | 545 result->VerifyApiCallResultType(); |
| 546 return *v8::Utils::OpenHandle(*r); | 546 return *v8::Utils::OpenHandle(*r); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 | 549 |
| 550 return isolate->heap()->no_interceptor_result_sentinel(); | 550 return isolate->heap()->no_interceptor_result_sentinel(); |
| 551 } | 551 } |
| 552 | 552 |
| 553 | 553 |
| 554 static MaybeObject* ThrowReferenceError(Isolate* isolate, Name* name) { | 554 static Object* ThrowReferenceError(Isolate* isolate, Name* name) { |
| 555 // If the load is non-contextual, just return the undefined result. | 555 // If the load is non-contextual, just return the undefined result. |
| 556 // Note that both keyed and non-keyed loads may end up here. | 556 // Note that both keyed and non-keyed loads may end up here. |
| 557 HandleScope scope(isolate); | 557 HandleScope scope(isolate); |
| 558 LoadIC ic(IC::NO_EXTRA_FRAME, isolate); | 558 LoadIC ic(IC::NO_EXTRA_FRAME, isolate); |
| 559 if (ic.contextual_mode() != CONTEXTUAL) { | 559 if (ic.contextual_mode() != CONTEXTUAL) { |
| 560 return isolate->heap()->undefined_value(); | 560 return isolate->heap()->undefined_value(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 // Throw a reference error. | 563 // Throw a reference error. |
| 564 Handle<Name> name_handle(name); | 564 Handle<Name> name_handle(name); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 return JSObject::GetPropertyPostInterceptor( | 617 return JSObject::GetPropertyPostInterceptor( |
| 618 holder_handle, receiver_handle, name_handle, attrs); | 618 holder_handle, receiver_handle, name_handle, attrs); |
| 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(Object*, LoadPropertyWithInterceptorForLoad) { |
| 627 PropertyAttributes attr = NONE; | 627 PropertyAttributes attr = NONE; |
| 628 HandleScope scope(isolate); | 628 HandleScope scope(isolate); |
| 629 Handle<Object> result; | 629 Handle<Object> result; |
| 630 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 630 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 631 isolate, result, LoadWithInterceptor(&args, &attr)); | 631 isolate, result, LoadWithInterceptor(&args, &attr)); |
| 632 | 632 |
| 633 // If the property is present, return it. | 633 // If the property is present, return it. |
| 634 if (attr != ABSENT) return *result; | 634 if (attr != ABSENT) return *result; |
| 635 return ThrowReferenceError(isolate, Name::cast(args[0])); | 635 return ThrowReferenceError(isolate, Name::cast(args[0])); |
| 636 } | 636 } |
| 637 | 637 |
| 638 | 638 |
| 639 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { | 639 RUNTIME_FUNCTION(Object*, LoadPropertyWithInterceptorForCall) { |
| 640 PropertyAttributes attr; | 640 PropertyAttributes attr; |
| 641 HandleScope scope(isolate); | 641 HandleScope scope(isolate); |
| 642 Handle<Object> result; | 642 Handle<Object> result; |
| 643 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 643 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 644 isolate, result, LoadWithInterceptor(&args, &attr)); | 644 isolate, result, LoadWithInterceptor(&args, &attr)); |
| 645 // 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 |
| 646 // 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 |
| 647 // function. | 647 // function. |
| 648 return *result; | 648 return *result; |
| 649 } | 649 } |
| 650 | 650 |
| 651 | 651 |
| 652 RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) { | 652 RUNTIME_FUNCTION(Object*, StoreInterceptorProperty) { |
| 653 HandleScope scope(isolate); | 653 HandleScope scope(isolate); |
| 654 ASSERT(args.length() == 3); | 654 ASSERT(args.length() == 3); |
| 655 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 655 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
| 656 Handle<JSObject> receiver = args.at<JSObject>(0); | 656 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 657 Handle<Name> name = args.at<Name>(1); | 657 Handle<Name> name = args.at<Name>(1); |
| 658 Handle<Object> value = args.at<Object>(2); | 658 Handle<Object> value = args.at<Object>(2); |
| 659 ASSERT(receiver->HasNamedInterceptor()); | 659 ASSERT(receiver->HasNamedInterceptor()); |
| 660 PropertyAttributes attr = NONE; | 660 PropertyAttributes attr = NONE; |
| 661 Handle<Object> result; | 661 Handle<Object> result; |
| 662 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 662 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 663 isolate, result, | 663 isolate, result, |
| 664 JSObject::SetPropertyWithInterceptor( | 664 JSObject::SetPropertyWithInterceptor( |
| 665 receiver, name, value, attr, ic.strict_mode())); | 665 receiver, name, value, attr, ic.strict_mode())); |
| 666 return *result; | 666 return *result; |
| 667 } | 667 } |
| 668 | 668 |
| 669 | 669 |
| 670 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor) { | 670 RUNTIME_FUNCTION(Object*, KeyedLoadPropertyWithInterceptor) { |
| 671 HandleScope scope(isolate); | 671 HandleScope scope(isolate); |
| 672 Handle<JSObject> receiver = args.at<JSObject>(0); | 672 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 673 ASSERT(args.smi_at(1) >= 0); | 673 ASSERT(args.smi_at(1) >= 0); |
| 674 uint32_t index = args.smi_at(1); | 674 uint32_t index = args.smi_at(1); |
| 675 Handle<Object> result; | 675 Handle<Object> result; |
| 676 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 676 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 677 isolate, result, | 677 isolate, result, |
| 678 JSObject::GetElementWithInterceptor(receiver, receiver, index)); | 678 JSObject::GetElementWithInterceptor(receiver, receiver, index)); |
| 679 return *result; | 679 return *result; |
| 680 } | 680 } |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 Handle<FunctionTemplateInfo>( | 1499 Handle<FunctionTemplateInfo>( |
| 1500 FunctionTemplateInfo::cast(signature->receiver())); | 1500 FunctionTemplateInfo::cast(signature->receiver())); |
| 1501 } | 1501 } |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 is_simple_api_call_ = true; | 1504 is_simple_api_call_ = true; |
| 1505 } | 1505 } |
| 1506 | 1506 |
| 1507 | 1507 |
| 1508 } } // namespace v8::internal | 1508 } } // namespace v8::internal |
| OLD | NEW |