| 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 Handle<JSObject> result = NewJSObjectFromMap(map); | 2230 Handle<JSObject> result = NewJSObjectFromMap(map); |
| 2231 Handle<Smi> value(Smi::FromInt(length), isolate()); | 2231 Handle<Smi> value(Smi::FromInt(length), isolate()); |
| 2232 Object::SetProperty(result, length_string(), value, STRICT).Assert(); | 2232 Object::SetProperty(result, length_string(), value, STRICT).Assert(); |
| 2233 if (!strict_mode_callee) { | 2233 if (!strict_mode_callee) { |
| 2234 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); | 2234 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); |
| 2235 } | 2235 } |
| 2236 return result; | 2236 return result; |
| 2237 } | 2237 } |
| 2238 | 2238 |
| 2239 | 2239 |
| 2240 Handle<JSWeakMap> Factory::NewJSWeakMap() { |
| 2241 // TODO(adamk): Currently the map is only created three times per |
| 2242 // isolate. If it's created more often, the map should be moved into the |
| 2243 // strong root list. |
| 2244 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); |
| 2245 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map)); |
| 2246 } |
| 2247 |
| 2248 |
| 2240 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, | 2249 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, |
| 2241 int number_of_properties, | 2250 int number_of_properties, |
| 2242 bool* is_result_from_cache) { | 2251 bool* is_result_from_cache) { |
| 2243 const int kMapCacheSize = 128; | 2252 const int kMapCacheSize = 128; |
| 2244 | 2253 |
| 2245 if (number_of_properties > kMapCacheSize) { | 2254 if (number_of_properties > kMapCacheSize) { |
| 2246 *is_result_from_cache = false; | 2255 *is_result_from_cache = false; |
| 2247 return Map::Create(isolate(), number_of_properties); | 2256 return Map::Create(isolate(), number_of_properties); |
| 2248 } | 2257 } |
| 2249 *is_result_from_cache = true; | 2258 *is_result_from_cache = true; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2320 return Handle<Object>::null(); | 2329 return Handle<Object>::null(); |
| 2321 } | 2330 } |
| 2322 | 2331 |
| 2323 | 2332 |
| 2324 Handle<Object> Factory::ToBoolean(bool value) { | 2333 Handle<Object> Factory::ToBoolean(bool value) { |
| 2325 return value ? true_value() : false_value(); | 2334 return value ? true_value() : false_value(); |
| 2326 } | 2335 } |
| 2327 | 2336 |
| 2328 | 2337 |
| 2329 } } // namespace v8::internal | 2338 } } // namespace v8::internal |
| OLD | NEW |