Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2076 | 2076 |
| 2077 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { | 2077 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
| 2078 DCHECK(args.length() == 0); | 2078 DCHECK(args.length() == 0); |
| 2079 return isolate->heap()->home_object_symbol(); | 2079 return isolate->heap()->home_object_symbol(); |
| 2080 } | 2080 } |
| 2081 | 2081 |
| 2082 | 2082 |
| 2083 RUNTIME_FUNCTION(Runtime_LoadFromSuper) { | 2083 RUNTIME_FUNCTION(Runtime_LoadFromSuper) { |
| 2084 HandleScope scope(isolate); | 2084 HandleScope scope(isolate); |
| 2085 DCHECK(args.length() == 3); | 2085 DCHECK(args.length() == 3); |
| 2086 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 0); | 2086 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); |
| 2087 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); | 2087 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); |
| 2088 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); | 2088 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); |
| 2089 | 2089 |
| 2090 if (home_object->IsAccessCheckNeeded() && | 2090 if (home_object->IsAccessCheckNeeded() && |
| 2091 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) { | 2091 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) { |
| 2092 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET); | 2092 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET); |
| 2093 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 2093 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
| 2094 } | 2094 } |
| 2095 | 2095 |
| 2096 PrototypeIterator iter(isolate, home_object); | 2096 PrototypeIterator iter(isolate, home_object); |
| 2097 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | 2097 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); |
| 2098 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); | 2098 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); |
| 2099 | 2099 |
| 2100 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); | 2100 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); |
| 2101 Handle<Object> result; | 2101 Handle<Object> result; |
| 2102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); | 2102 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); |
| 2103 return *result; | 2103 return *result; |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 | 2106 |
| 2107 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, | |
| 2108 Handle<Object> receiver, Handle<Name> name, | |
| 2109 Handle<Object> value, StrictMode strict_mode) { | |
| 2110 if (home_object->IsAccessCheckNeeded() && | |
| 2111 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_SET)) { | |
| 2112 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET); | |
| 2113 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | |
| 2114 } | |
| 2115 | |
| 2116 PrototypeIterator iter(isolate, home_object); | |
| 2117 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | |
| 2118 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); | |
|
arv (Not doing code reviews)
2014/09/24 14:53:57
Is this correct? I believe the following should wo
Dmitry Lomov (no reviews)
2014/09/24 16:23:46
I have a bit of a hard time deciphering what you a
arv (Not doing code reviews)
2014/09/25 13:51:41
I was trying to give an example where this is not
Dmitry Lomov (no reviews)
2014/09/25 13:59:59
'this' is 'receiver' here, and it is an v8::intren
| |
| 2119 | |
| 2120 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); | |
| 2121 Handle<Object> result; | |
| 2122 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | |
| 2123 isolate, result, | |
| 2124 Object::SetProperty(&it, value, strict_mode, | |
| 2125 Object::CERTAINLY_NOT_STORE_FROM_KEYED, | |
| 2126 Object::SUPER_PROPERTY)); | |
| 2127 return *result; | |
| 2128 } | |
| 2129 | |
| 2130 | |
| 2131 RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) { | |
| 2132 HandleScope scope(isolate); | |
| 2133 DCHECK(args.length() == 4); | |
| 2134 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | |
| 2135 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); | |
| 2136 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | |
| 2137 CONVERT_ARG_HANDLE_CHECKED(Name, name, 3); | |
| 2138 | |
| 2139 return StoreToSuper(isolate, home_object, receiver, name, value, STRICT); | |
| 2140 } | |
| 2141 | |
| 2142 | |
| 2143 RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) { | |
| 2144 HandleScope scope(isolate); | |
| 2145 DCHECK(args.length() == 4); | |
| 2146 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0); | |
| 2147 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); | |
| 2148 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | |
| 2149 CONVERT_ARG_HANDLE_CHECKED(Name, name, 3); | |
| 2150 | |
| 2151 return StoreToSuper(isolate, home_object, receiver, name, value, SLOPPY); | |
| 2152 } | |
| 2153 | |
| 2154 | |
| 2107 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 2155 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
| 2108 SealHandleScope shs(isolate); | 2156 SealHandleScope shs(isolate); |
| 2109 DCHECK(args.length() == 1); | 2157 DCHECK(args.length() == 1); |
| 2110 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 2158 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
| 2111 if (obj->IsJSGlobalProxy()) { | 2159 if (obj->IsJSGlobalProxy()) { |
| 2112 PrototypeIterator iter(isolate, obj); | 2160 PrototypeIterator iter(isolate, obj); |
| 2113 if (iter.IsAtEnd()) return isolate->heap()->false_value(); | 2161 if (iter.IsAtEnd()) return isolate->heap()->false_value(); |
| 2114 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); | 2162 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); |
| 2115 obj = JSObject::cast(iter.GetCurrent()); | 2163 obj = JSObject::cast(iter.GetCurrent()); |
| 2116 } | 2164 } |
| (...skipping 13631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15748 } | 15796 } |
| 15749 return NULL; | 15797 return NULL; |
| 15750 } | 15798 } |
| 15751 | 15799 |
| 15752 | 15800 |
| 15753 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15801 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15754 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15802 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15755 } | 15803 } |
| 15756 | 15804 |
| 15757 } } // namespace v8::internal | 15805 } } // namespace v8::internal |
| OLD | NEW |