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/runtime.cc

Issue 458813002: Prototype implementation of GET_OWN_PROPERTY intrinsic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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.h ('k') | src/stub-cache.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 4897 matching lines...) Expand 10 before | Expand all | Expand 10 after
4908 4908
4909 // Fall back to GetObjectProperty. 4909 // Fall back to GetObjectProperty.
4910 Handle<Object> result; 4910 Handle<Object> result;
4911 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 4911 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4912 isolate, result, 4912 isolate, result,
4913 Runtime::GetObjectProperty(isolate, receiver_obj, key_obj)); 4913 Runtime::GetObjectProperty(isolate, receiver_obj, key_obj));
4914 return *result; 4914 return *result;
4915 } 4915 }
4916 4916
4917 4917
4918 RUNTIME_FUNCTION(Runtime_KeyedGetOwnProperty) {
4919 HandleScope scope(isolate);
4920 DCHECK(args.length() == 2);
4921
4922 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0);
4923 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
4924
4925 Handle<Name> name;
4926 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, ToName(isolate, key_obj));
4927
4928 LookupIterator it(receiver_obj, name, LookupIterator::CHECK_OWN_REAL);
4929
4930 Handle<Object> result;
4931 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4932 isolate, result,
4933 receiver_obj->GetProperty(&it));
4934 return *result;
4935 }
4936
4937 RUNTIME_FUNCTION(Runtime_LoadOwnProperty) {
4938 HandleScope scope(isolate);
4939 DCHECK(args.length() == 2);
4940
4941 CONVERT_ARG_HANDLE_CHECKED(Object, receiver_obj, 0);
4942 CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
4943
4944 Handle<Name> name;
4945 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
4946 ToName(isolate, key_obj));
4947
4948 LookupIterator it(receiver_obj, name, LookupIterator::CHECK_OWN_REAL);
4949
4950 Handle<Object> result;
4951 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
4952 isolate, result,
4953 receiver_obj->GetProperty(&it));
4954 return *result;
4955 }
4956
4957
4918 static bool IsValidAccessor(Handle<Object> obj) { 4958 static bool IsValidAccessor(Handle<Object> obj) {
4919 return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull(); 4959 return obj->IsUndefined() || obj->IsSpecFunction() || obj->IsNull();
4920 } 4960 }
4921 4961
4922 4962
4923 // Transform getter or setter into something DefineAccessor can handle. 4963 // Transform getter or setter into something DefineAccessor can handle.
4924 static Handle<Object> InstantiateAccessorComponent(Isolate* isolate, 4964 static Handle<Object> InstantiateAccessorComponent(Isolate* isolate,
4925 Handle<Object> component) { 4965 Handle<Object> component) {
4926 if (component->IsUndefined()) return isolate->factory()->null_value(); 4966 if (component->IsUndefined()) return isolate->factory()->null_value();
4927 Handle<FunctionTemplateInfo> info = 4967 Handle<FunctionTemplateInfo> info =
(...skipping 9850 matching lines...) Expand 10 before | Expand all | Expand 10 after
14778 } 14818 }
14779 #endif 14819 #endif
14780 14820
14781 14821
14782 RUNTIME_FUNCTION(Runtime_IS_VAR) { 14822 RUNTIME_FUNCTION(Runtime_IS_VAR) {
14783 UNREACHABLE(); // implemented as macro in the parser 14823 UNREACHABLE(); // implemented as macro in the parser
14784 return NULL; 14824 return NULL;
14785 } 14825 }
14786 14826
14787 14827
14828 RUNTIME_FUNCTION(Runtime_GET_OWN_PROPERTY) {
14829 UNREACHABLE(); // implemented as macro in the parser
14830 return NULL;
14831 }
14832
14833
14788 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \ 14834 #define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \
14789 RUNTIME_FUNCTION(Runtime_Has##Name) { \ 14835 RUNTIME_FUNCTION(Runtime_Has##Name) { \
14790 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ 14836 CONVERT_ARG_CHECKED(JSObject, obj, 0); \
14791 return isolate->heap()->ToBoolean(obj->Has##Name()); \ 14837 return isolate->heap()->ToBoolean(obj->Has##Name()); \
14792 } 14838 }
14793 14839
14794 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements) 14840 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiElements)
14795 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements) 14841 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastObjectElements)
14796 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements) 14842 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements)
14797 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements) 14843 ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements)
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
15223 #define U(name) \ 15269 #define U(name) \
15224 RUNTIME_FUNCTION(RuntimeReference_##name) { \ 15270 RUNTIME_FUNCTION(RuntimeReference_##name) { \
15225 UNIMPLEMENTED(); \ 15271 UNIMPLEMENTED(); \
15226 return NULL; \ 15272 return NULL; \
15227 } 15273 }
15228 15274
15229 U(IsStringWrapperSafeForDefaultValueOf) 15275 U(IsStringWrapperSafeForDefaultValueOf)
15230 U(GeneratorNext) 15276 U(GeneratorNext)
15231 U(GeneratorThrow) 15277 U(GeneratorThrow)
15232 U(DebugBreakInOptimizedCode) 15278 U(DebugBreakInOptimizedCode)
15279 U(GetOwnPrivateProperty)
15233 15280
15234 #undef U 15281 #undef U
15235 15282
15236 15283
15237 RUNTIME_FUNCTION(RuntimeReference_IsSmi) { 15284 RUNTIME_FUNCTION(RuntimeReference_IsSmi) {
15238 SealHandleScope shs(isolate); 15285 SealHandleScope shs(isolate);
15239 DCHECK(args.length() == 1); 15286 DCHECK(args.length() == 1);
15240 CONVERT_ARG_CHECKED(Object, obj, 0); 15287 CONVERT_ARG_CHECKED(Object, obj, 0);
15241 return isolate->heap()->ToBoolean(obj->IsSmi()); 15288 return isolate->heap()->ToBoolean(obj->IsSmi());
15242 } 15289 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
15605 } 15652 }
15606 return NULL; 15653 return NULL;
15607 } 15654 }
15608 15655
15609 15656
15610 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15657 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15611 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15658 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15612 } 15659 }
15613 15660
15614 } } // namespace v8::internal 15661 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698