Chromium Code Reviews| 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 FAST_HOLEY_SMI_ELEMENTS); | |
| 
 
Toon Verwaest
2015/01/14 14:16:28
Omit the last argument to get the default elements
 
 | |
| 1966 // Maintain invariant expected from any JSGlobalProxy. | |
| 1967 map->set_is_access_check_needed(true); | |
| 1968 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObjectFromMap( | |
| 1969 *map, NOT_TENURED, false), | |
| 1970 JSGlobalProxy); | |
| 1971 } | |
| 1972 | |
| 1973 | |
| 1961 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, | 1974 void Factory::ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> object, | 
| 1962 Handle<JSFunction> constructor) { | 1975 Handle<JSFunction> constructor) { | 
| 1963 DCHECK(constructor->has_initial_map()); | 1976 DCHECK(constructor->has_initial_map()); | 
| 1964 Handle<Map> map(constructor->initial_map(), isolate()); | 1977 Handle<Map> map(constructor->initial_map(), isolate()); | 
| 1965 | 1978 | 
| 1966 // The proxy's hash should be retained across reinitialization. | 1979 // The proxy's hash should be retained across reinitialization. | 
| 1967 Handle<Object> hash(object->hash(), isolate()); | 1980 Handle<Object> hash(object->hash(), isolate()); | 
| 1968 | 1981 | 
| 1969 // Check that the already allocated object has the same size and type as | 1982 // Check that the already allocated object has the same size and type as | 
| 1970 // objects allocated using the constructor. | 1983 // objects allocated using the constructor. | 
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2507 return Handle<Object>::null(); | 2520 return Handle<Object>::null(); | 
| 2508 } | 2521 } | 
| 2509 | 2522 | 
| 2510 | 2523 | 
| 2511 Handle<Object> Factory::ToBoolean(bool value) { | 2524 Handle<Object> Factory::ToBoolean(bool value) { | 
| 2512 return value ? true_value() : false_value(); | 2525 return value ? true_value() : false_value(); | 
| 2513 } | 2526 } | 
| 2514 | 2527 | 
| 2515 | 2528 | 
| 2516 } } // namespace v8::internal | 2529 } } // namespace v8::internal | 
| OLD | NEW |