| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/factory.h" | 5 #include "src/factory.h" |
| 6 | 6 |
| 7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 map->set_function_with_prototype(true); | 1951 map->set_function_with_prototype(true); |
| 1952 Handle<JSFunction> js_function = Handle<JSFunction>::cast(proxy); | 1952 Handle<JSFunction> js_function = Handle<JSFunction>::cast(proxy); |
| 1953 InitializeFunction(js_function, shared.ToHandleChecked(), context); | 1953 InitializeFunction(js_function, shared.ToHandleChecked(), context); |
| 1954 } else { | 1954 } else { |
| 1955 // Provide JSObjects with a constructor. | 1955 // Provide JSObjects with a constructor. |
| 1956 map->set_constructor(context->object_function()); | 1956 map->set_constructor(context->object_function()); |
| 1957 } | 1957 } |
| 1958 } | 1958 } |
| 1959 | 1959 |
| 1960 | 1960 |
| 1961 Handle<JSGlobalProxy> Factory::NewUninitializedJSGlobalProxy() { |
| 1962 // Create an empty shell of a JSGlobalProxy that needs to be reinitialized |
| 1963 // via ReinitializeJSGlobalProxy later. |
| 1964 Handle<Map> map = NewMap(JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); |
| 1965 // Maintain invariant expected from any JSGlobalProxy. |
| 1966 map->set_is_access_check_needed(true); |
| 1967 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObjectFromMap( |
| 1968 *map, NOT_TENURED, false), |
| 1969 JSGlobalProxy); |
| 1970 } |
| 1971 |
| 1972 |
| 1961 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, | 1973 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, |
| 1962 Handle<JSFunction> constructor) { | 1974 Handle<JSFunction> constructor) { |
| 1963 DCHECK(constructor->has_initial_map()); | 1975 DCHECK(constructor->has_initial_map()); |
| 1964 Handle<Map> map(constructor->initial_map(), isolate()); | 1976 Handle<Map> map(constructor->initial_map(), isolate()); |
| 1965 | 1977 |
| 1966 // The proxy's hash should be retained across reinitialization. | 1978 // The proxy's hash should be retained across reinitialization. |
| 1967 Handle<Object> hash(object->hash(), isolate()); | 1979 Handle<Object> hash(object->hash(), isolate()); |
| 1968 | 1980 |
| 1969 // Check that the already allocated object has the same size and type as | 1981 // Check that the already allocated object has the same size and type as |
| 1970 // objects allocated using the constructor. | 1982 // objects allocated using the constructor. |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 return Handle<Object>::null(); | 2519 return Handle<Object>::null(); |
| 2508 } | 2520 } |
| 2509 | 2521 |
| 2510 | 2522 |
| 2511 Handle<Object> Factory::ToBoolean(bool value) { | 2523 Handle<Object> Factory::ToBoolean(bool value) { |
| 2512 return value ? true_value() : false_value(); | 2524 return value ? true_value() : false_value(); |
| 2513 } | 2525 } |
| 2514 | 2526 |
| 2515 | 2527 |
| 2516 } } // namespace v8::internal | 2528 } } // namespace v8::internal |
| OLD | NEW |