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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 if (String::Equals(name, nan_string())) return nan_value(); | 1989 if (String::Equals(name, nan_string())) return nan_value(); |
1990 if (String::Equals(name, infinity_string())) return infinity_value(); | 1990 if (String::Equals(name, infinity_string())) return infinity_value(); |
1991 return Handle<Object>::null(); | 1991 return Handle<Object>::null(); |
1992 } | 1992 } |
1993 | 1993 |
1994 | 1994 |
1995 Handle<Object> Factory::ToBoolean(bool value) { | 1995 Handle<Object> Factory::ToBoolean(bool value) { |
1996 return value ? true_value() : false_value(); | 1996 return value ? true_value() : false_value(); |
1997 } | 1997 } |
1998 | 1998 |
| 1999 |
| 2000 Handle<JSObject> Factory::CreateIteratorResultObject(Handle<Object> value, |
| 2001 bool done) { |
| 2002 Handle<Map> map(isolate()->native_context()->iterator_result_map()); |
| 2003 Handle<JSObject> result = NewJSObjectFromMap(map, NOT_TENURED, false); |
| 2004 result->InObjectPropertyAtPut( |
| 2005 JSGeneratorObject::kResultValuePropertyIndex, *value); |
| 2006 result->InObjectPropertyAtPut( |
| 2007 JSGeneratorObject::kResultDonePropertyIndex, *ToBoolean(done)); |
| 2008 return result; |
| 2009 } |
| 2010 |
1999 } } // namespace v8::internal | 2011 } } // namespace v8::internal |
OLD | NEW |