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 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2065 return *clone; | 2065 return *clone; |
2066 } | 2066 } |
2067 | 2067 |
2068 | 2068 |
2069 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { | 2069 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
2070 DCHECK(args.length() == 0); | 2070 DCHECK(args.length() == 0); |
2071 return isolate->heap()->home_object_symbol(); | 2071 return isolate->heap()->home_object_symbol(); |
2072 } | 2072 } |
2073 | 2073 |
2074 | 2074 |
2075 RUNTIME_FUNCTION(Runtime_LoadFromSuper) { | |
2076 HandleScope scope(isolate); | |
2077 DCHECK(args.length() == 3); | |
2078 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 0); | |
2079 CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1); | |
2080 CONVERT_ARG_HANDLE_CHECKED(Name, name, 2); | |
2081 | |
2082 if (home_object->IsAccessCheckNeeded() && | |
2083 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) { | |
2084 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET); | |
2085 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | |
2086 } | |
2087 | |
2088 PrototypeIterator iter(isolate, home_object); | |
2089 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); | |
2090 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); | |
2091 | |
2092 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); | |
2093 Handle<Object> result; | |
2094 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); | |
2095 return *result; | |
2096 } | |
2097 | |
2098 | |
2075 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 2099 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
2076 SealHandleScope shs(isolate); | 2100 SealHandleScope shs(isolate); |
2077 DCHECK(args.length() == 1); | 2101 DCHECK(args.length() == 1); |
2078 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 2102 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
2079 if (obj->IsJSGlobalProxy()) { | 2103 if (obj->IsJSGlobalProxy()) { |
2080 PrototypeIterator iter(isolate, obj); | 2104 PrototypeIterator iter(isolate, obj); |
2081 if (iter.IsAtEnd()) return isolate->heap()->false_value(); | 2105 if (iter.IsAtEnd()) return isolate->heap()->false_value(); |
2082 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); | 2106 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); |
2083 obj = JSObject::cast(iter.GetCurrent()); | 2107 obj = JSObject::cast(iter.GetCurrent()); |
2084 } | 2108 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2205 // which are actually data properties, not accessor properties. | 2229 // which are actually data properties, not accessor properties. |
2206 if (old_details.IsReadOnly() || old_details.IsDontEnum() || | 2230 if (old_details.IsReadOnly() || old_details.IsDontEnum() || |
2207 old_details.type() == CALLBACKS) { | 2231 old_details.type() == CALLBACKS) { |
2208 return ThrowRedeclarationError(isolate, name); | 2232 return ThrowRedeclarationError(isolate, name); |
2209 } | 2233 } |
2210 // If the existing property is not configurable, keep its attributes. Do | 2234 // If the existing property is not configurable, keep its attributes. Do |
2211 attr = old_attributes; | 2235 attr = old_attributes; |
2212 } | 2236 } |
2213 } | 2237 } |
2214 | 2238 |
2215 // Define or redefine own property. | 2239 // Define or redefine own pro//perty. |
Toon Verwaest
2014/09/16 13:56:16
remove //
| |
2216 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( | 2240 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( |
2217 global, name, value, attr)); | 2241 global, name, value, attr)); |
2218 | 2242 |
2219 return isolate->heap()->undefined_value(); | 2243 return isolate->heap()->undefined_value(); |
2220 } | 2244 } |
2221 | 2245 |
2222 | 2246 |
2223 RUNTIME_FUNCTION(Runtime_DeclareGlobals) { | 2247 RUNTIME_FUNCTION(Runtime_DeclareGlobals) { |
2224 HandleScope scope(isolate); | 2248 HandleScope scope(isolate); |
2225 DCHECK(args.length() == 3); | 2249 DCHECK(args.length() == 3); |
(...skipping 7285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9511 | 9535 |
9512 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { | 9536 RUNTIME_FUNCTION(Runtime_ThrowReferenceError) { |
9513 HandleScope scope(isolate); | 9537 HandleScope scope(isolate); |
9514 DCHECK(args.length() == 1); | 9538 DCHECK(args.length() == 1); |
9515 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); | 9539 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); |
9516 THROW_NEW_ERROR_RETURN_FAILURE( | 9540 THROW_NEW_ERROR_RETURN_FAILURE( |
9517 isolate, NewReferenceError("not_defined", HandleVector(&name, 1))); | 9541 isolate, NewReferenceError("not_defined", HandleVector(&name, 1))); |
9518 } | 9542 } |
9519 | 9543 |
9520 | 9544 |
9545 RUNTIME_FUNCTION(Runtime_ThrowNonMethodError) { | |
9546 HandleScope scope(isolate); | |
9547 DCHECK(args.length() == 0); | |
9548 THROW_NEW_ERROR_RETURN_FAILURE( | |
9549 isolate, NewReferenceError("non_method", HandleVector<Object>(NULL, 0))); | |
9550 } | |
9551 | |
9552 | |
9553 RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) { | |
9554 HandleScope scope(isolate); | |
9555 DCHECK(args.length() == 0); | |
9556 THROW_NEW_ERROR_RETURN_FAILURE( | |
9557 isolate, | |
9558 NewReferenceError("unsupported_super", HandleVector<Object>(NULL, 0))); | |
9559 } | |
9560 | |
9561 | |
9521 RUNTIME_FUNCTION(Runtime_ThrowNotDateError) { | 9562 RUNTIME_FUNCTION(Runtime_ThrowNotDateError) { |
9522 HandleScope scope(isolate); | 9563 HandleScope scope(isolate); |
9523 DCHECK(args.length() == 0); | 9564 DCHECK(args.length() == 0); |
9524 THROW_NEW_ERROR_RETURN_FAILURE( | 9565 THROW_NEW_ERROR_RETURN_FAILURE( |
9525 isolate, NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); | 9566 isolate, NewTypeError("not_date_object", HandleVector<Object>(NULL, 0))); |
9526 } | 9567 } |
9527 | 9568 |
9528 | 9569 |
9529 RUNTIME_FUNCTION(Runtime_StackGuard) { | 9570 RUNTIME_FUNCTION(Runtime_StackGuard) { |
9530 SealHandleScope shs(isolate); | 9571 SealHandleScope shs(isolate); |
(...skipping 6126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15657 } | 15698 } |
15658 return NULL; | 15699 return NULL; |
15659 } | 15700 } |
15660 | 15701 |
15661 | 15702 |
15662 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15703 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15663 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15704 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15664 } | 15705 } |
15665 | 15706 |
15666 } } // namespace v8::internal | 15707 } } // namespace v8::internal |
OLD | NEW |