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 "factory.h" | 5 #include "factory.h" |
6 | 6 |
7 #include "isolate-inl.h" | 7 #include "isolate-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 Handle<Code> code) { | 1234 Handle<Code> code) { |
1235 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); | 1235 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY); |
1236 function->shared()->set_code(*code); | 1236 function->shared()->set_code(*code); |
1237 function->set_code(*code); | 1237 function->set_code(*code); |
1238 ASSERT(!function->has_initial_map()); | 1238 ASSERT(!function->has_initial_map()); |
1239 ASSERT(!function->has_prototype()); | 1239 ASSERT(!function->has_prototype()); |
1240 return function; | 1240 return function; |
1241 } | 1241 } |
1242 | 1242 |
1243 | 1243 |
| 1244 Handle<JSObject> Factory::NewIteratorResultObject(Handle<Object> value, |
| 1245 bool done) { |
| 1246 Handle<Map> map(isolate()->native_context()->iterator_result_map()); |
| 1247 Handle<JSObject> result = NewJSObjectFromMap(map, NOT_TENURED, false); |
| 1248 result->InObjectPropertyAtPut( |
| 1249 JSGeneratorObject::kResultValuePropertyIndex, *value); |
| 1250 result->InObjectPropertyAtPut( |
| 1251 JSGeneratorObject::kResultDonePropertyIndex, *ToBoolean(done)); |
| 1252 return result; |
| 1253 } |
| 1254 |
| 1255 |
1244 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1256 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
1245 Handle<FixedArray> array = NewFixedArray(length, TENURED); | 1257 Handle<FixedArray> array = NewFixedArray(length, TENURED); |
1246 array->set_map_no_write_barrier(*scope_info_map()); | 1258 array->set_map_no_write_barrier(*scope_info_map()); |
1247 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); | 1259 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); |
1248 return scope_info; | 1260 return scope_info; |
1249 } | 1261 } |
1250 | 1262 |
1251 | 1263 |
1252 Handle<JSObject> Factory::NewExternal(void* value) { | 1264 Handle<JSObject> Factory::NewExternal(void* value) { |
1253 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); | 1265 Handle<Foreign> foreign = NewForeign(static_cast<Address>(value)); |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 if (String::Equals(name, nan_string())) return nan_value(); | 2001 if (String::Equals(name, nan_string())) return nan_value(); |
1990 if (String::Equals(name, infinity_string())) return infinity_value(); | 2002 if (String::Equals(name, infinity_string())) return infinity_value(); |
1991 return Handle<Object>::null(); | 2003 return Handle<Object>::null(); |
1992 } | 2004 } |
1993 | 2005 |
1994 | 2006 |
1995 Handle<Object> Factory::ToBoolean(bool value) { | 2007 Handle<Object> Factory::ToBoolean(bool value) { |
1996 return value ? true_value() : false_value(); | 2008 return value ? true_value() : false_value(); |
1997 } | 2009 } |
1998 | 2010 |
| 2011 |
1999 } } // namespace v8::internal | 2012 } } // namespace v8::internal |
OLD | NEW |