| 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 result->set_call_trap(*call_trap); | 2012 result->set_call_trap(*call_trap); |
| 2013 result->set_construct_trap(*construct_trap); | 2013 result->set_construct_trap(*construct_trap); |
| 2014 return result; | 2014 return result; |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 | 2017 |
| 2018 void Factory::ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, | 2018 void Factory::ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, |
| 2019 int size) { | 2019 int size) { |
| 2020 DCHECK(type == JS_OBJECT_TYPE || type == JS_FUNCTION_TYPE); | 2020 DCHECK(type == JS_OBJECT_TYPE || type == JS_FUNCTION_TYPE); |
| 2021 | 2021 |
| 2022 // Allocate fresh map. | 2022 Handle<Map> proxy_map(proxy->map()); |
| 2023 // TODO(rossberg): Once we optimize proxies, cache these maps. | 2023 Handle<Map> map = Map::FixProxy(proxy_map, type, size); |
| 2024 Handle<Map> map = NewMap(type, size); | |
| 2025 | 2024 |
| 2026 // Check that the receiver has at least the size of the fresh object. | 2025 // Check that the receiver has at least the size of the fresh object. |
| 2027 int size_difference = proxy->map()->instance_size() - map->instance_size(); | 2026 int size_difference = proxy_map->instance_size() - map->instance_size(); |
| 2028 DCHECK(size_difference >= 0); | 2027 DCHECK(size_difference >= 0); |
| 2029 | 2028 |
| 2030 Handle<Object> prototype(proxy->map()->prototype(), isolate()); | |
| 2031 Map::SetPrototype(map, prototype); | |
| 2032 | |
| 2033 // Allocate the backing storage for the properties. | 2029 // Allocate the backing storage for the properties. |
| 2034 int prop_size = map->InitialPropertiesLength(); | 2030 int prop_size = map->InitialPropertiesLength(); |
| 2035 Handle<FixedArray> properties = NewFixedArray(prop_size, TENURED); | 2031 Handle<FixedArray> properties = NewFixedArray(prop_size, TENURED); |
| 2036 | 2032 |
| 2037 Heap* heap = isolate()->heap(); | 2033 Heap* heap = isolate()->heap(); |
| 2038 MaybeHandle<SharedFunctionInfo> shared; | 2034 MaybeHandle<SharedFunctionInfo> shared; |
| 2039 if (type == JS_FUNCTION_TYPE) { | 2035 if (type == JS_FUNCTION_TYPE) { |
| 2040 OneByteStringKey key(STATIC_CHAR_VECTOR("<freezing call trap>"), | 2036 OneByteStringKey key(STATIC_CHAR_VECTOR("<freezing call trap>"), |
| 2041 heap->HashSeed()); | 2037 heap->HashSeed()); |
| 2042 Handle<String> name = InternalizeStringWithKey(&key); | 2038 Handle<String> name = InternalizeStringWithKey(&key); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2464 return Handle<Object>::null(); | 2460 return Handle<Object>::null(); |
| 2465 } | 2461 } |
| 2466 | 2462 |
| 2467 | 2463 |
| 2468 Handle<Object> Factory::ToBoolean(bool value) { | 2464 Handle<Object> Factory::ToBoolean(bool value) { |
| 2469 return value ? true_value() : false_value(); | 2465 return value ? true_value() : false_value(); |
| 2470 } | 2466 } |
| 2471 | 2467 |
| 2472 | 2468 |
| 2473 } } // namespace v8::internal | 2469 } } // namespace v8::internal |
| OLD | NEW |