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 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 Handle<JSObject> result = NewJSObjectFromMap(map); | 2229 Handle<JSObject> result = NewJSObjectFromMap(map); |
2230 Handle<Smi> value(Smi::FromInt(length), isolate()); | 2230 Handle<Smi> value(Smi::FromInt(length), isolate()); |
2231 Object::SetProperty(result, length_string(), value, STRICT).Assert(); | 2231 Object::SetProperty(result, length_string(), value, STRICT).Assert(); |
2232 if (!strict_mode_callee) { | 2232 if (!strict_mode_callee) { |
2233 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); | 2233 Object::SetProperty(result, callee_string(), callee, STRICT).Assert(); |
2234 } | 2234 } |
2235 return result; | 2235 return result; |
2236 } | 2236 } |
2237 | 2237 |
2238 | 2238 |
| 2239 Handle<JSWeakMap> Factory::NewJSWeakMap() { |
| 2240 // TODO(adamk): Currently the map is only created three times per |
| 2241 // isolate. If it's created more often, the map should be moved into the |
| 2242 // strong root list. |
| 2243 Handle<Map> map = NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize); |
| 2244 return Handle<JSWeakMap>::cast(NewJSObjectFromMap(map)); |
| 2245 } |
| 2246 |
| 2247 |
2239 Handle<JSFunction> Factory::CreateApiFunction( | 2248 Handle<JSFunction> Factory::CreateApiFunction( |
2240 Handle<FunctionTemplateInfo> obj, | 2249 Handle<FunctionTemplateInfo> obj, |
2241 Handle<Object> prototype, | 2250 Handle<Object> prototype, |
2242 ApiInstanceType instance_type) { | 2251 ApiInstanceType instance_type) { |
2243 Handle<Code> code = isolate()->builtins()->HandleApiCall(); | 2252 Handle<Code> code = isolate()->builtins()->HandleApiCall(); |
2244 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); | 2253 Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi(); |
2245 | 2254 |
2246 obj->set_instantiated(true); | 2255 obj->set_instantiated(true); |
2247 Handle<JSFunction> result; | 2256 Handle<JSFunction> result; |
2248 if (obj->remove_prototype()) { | 2257 if (obj->remove_prototype()) { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 return Handle<Object>::null(); | 2523 return Handle<Object>::null(); |
2515 } | 2524 } |
2516 | 2525 |
2517 | 2526 |
2518 Handle<Object> Factory::ToBoolean(bool value) { | 2527 Handle<Object> Factory::ToBoolean(bool value) { |
2519 return value ? true_value() : false_value(); | 2528 return value ? true_value() : false_value(); |
2520 } | 2529 } |
2521 | 2530 |
2522 | 2531 |
2523 } } // namespace v8::internal | 2532 } } // namespace v8::internal |
OLD | NEW |