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 = JSFunction::CloneClosure(fun); |
| 2059 Handle<Symbol> home_object_symbol(isolate->heap()->home_object_symbol()); |
| 2060 JSObject::SetOwnPropertyIgnoreAttributes(clone, home_object_symbol, |
| 2061 home_object, DONT_ENUM).Assert(); |
| 2062 return *clone; |
| 2063 } |
| 2064 |
| 2065 |
| 2066 RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { |
| 2067 DCHECK(args.length() == 0); |
| 2068 return isolate->heap()->home_object_symbol(); |
| 2069 } |
| 2070 |
| 2071 |
2053 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 2072 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
2054 SealHandleScope shs(isolate); | 2073 SealHandleScope shs(isolate); |
2055 DCHECK(args.length() == 1); | 2074 DCHECK(args.length() == 1); |
2056 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 2075 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
2057 if (obj->IsJSGlobalProxy()) { | 2076 if (obj->IsJSGlobalProxy()) { |
2058 PrototypeIterator iter(isolate, obj); | 2077 PrototypeIterator iter(isolate, obj); |
2059 if (iter.IsAtEnd()) return isolate->heap()->false_value(); | 2078 if (iter.IsAtEnd()) return isolate->heap()->false_value(); |
2060 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); | 2079 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); |
2061 obj = JSObject::cast(iter.GetCurrent()); | 2080 obj = JSObject::cast(iter.GetCurrent()); |
2062 } | 2081 } |
(...skipping 13563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15626 } | 15645 } |
15627 return NULL; | 15646 return NULL; |
15628 } | 15647 } |
15629 | 15648 |
15630 | 15649 |
15631 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15650 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15632 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15651 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15633 } | 15652 } |
15634 | 15653 |
15635 } } // namespace v8::internal | 15654 } } // namespace v8::internal |
OLD | NEW |