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 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2043 HandleScope scope(isolate); | 2043 HandleScope scope(isolate); |
2044 DCHECK(args.length() == 1); | 2044 DCHECK(args.length() == 1); |
2045 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 2045 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
2046 Handle<Object> result; | 2046 Handle<Object> result; |
2047 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2047 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2048 isolate, result, JSObject::PreventExtensions(obj)); | 2048 isolate, result, JSObject::PreventExtensions(obj)); |
2049 return *result; | 2049 return *result; |
2050 } | 2050 } |
2051 | 2051 |
2052 | 2052 |
2053 RUNTIME_FUNCTION(Runtime_ToMethod) { | |
2054 HandleScope scope(isolate); | |
2055 DCHECK(args.length() == 2); | |
2056 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | |
2057 CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1); | |
2058 Handle<JSFunction> clone(Handle<JSFunction>::cast( | |
2059 isolate->factory()->CopyJSObject(fun))); | |
2060 Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol()); | |
2061 RETURN_FAILURE_ON_EXCEPTION( | |
2062 isolate, | |
2063 Object::SetProperty(clone, home_object_symbol, home_object, STRICT)); | |
Toon Verwaest
2014/08/18 14:15:35
Perhaps use JSObject::SetOwnPropertyIgnoreAttribut
Dmitry Lomov (no reviews)
2014/08/19 20:02:48
Done.
| |
2064 return *clone; | |
2065 } | |
2066 | |
2067 | |
2068 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { | |
2069 DCHECK(args.length() == 0); | |
2070 return isolate->heap()->home_object_symbol(); | |
2071 } | |
2072 | |
2073 | |
2053 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 2074 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
2054 SealHandleScope shs(isolate); | 2075 SealHandleScope shs(isolate); |
2055 DCHECK(args.length() == 1); | 2076 DCHECK(args.length() == 1); |
2056 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 2077 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
2057 if (obj->IsJSGlobalProxy()) { | 2078 if (obj->IsJSGlobalProxy()) { |
2058 PrototypeIterator iter(isolate, obj); | 2079 PrototypeIterator iter(isolate, obj); |
2059 if (iter.IsAtEnd()) return isolate->heap()->false_value(); | 2080 if (iter.IsAtEnd()) return isolate->heap()->false_value(); |
2060 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); | 2081 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); |
2061 obj = JSObject::cast(iter.GetCurrent()); | 2082 obj = JSObject::cast(iter.GetCurrent()); |
2062 } | 2083 } |
(...skipping 13558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15621 } | 15642 } |
15622 return NULL; | 15643 return NULL; |
15623 } | 15644 } |
15624 | 15645 |
15625 | 15646 |
15626 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15647 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15627 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15648 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15628 } | 15649 } |
15629 | 15650 |
15630 } } // namespace v8::internal | 15651 } } // namespace v8::internal |
OLD | NEW |